Ecolyo Documentation
website·Indexed 41 days ago
https://doc-self-data.apps.grandlyon.comTechnical documentation for Ecolyo, a public digital service focused on behavioral change and energy consumption. It includes details on system architecture, konnectors for fetching data from APIs like Enedis SGE and GRDF, service definitions for consumption alerts and monthly reports, and deployment guides for Openshift and Cozy environments.
What's inside Ecolyo
- Ecolyo was a free, gamified digital service designed to help users monitor electricity, gas, and water consumption to reduce bills and support energy sobriety policies. It targeted users with Linky (electricity) and Gazpar (gas) meters across France. The service provided daily data retrieval, up to 3 years of history, and comparative analysis against similar households. Key features included consumption visualization (by hour, day, month, or year), behavioral challenges, and eco-gesture tips prioritized by impact.
Overview of Redux state management
The application uses Redux for state management, maintaining the entire application state in a single immutable state tree. State changes are handled via actions and reducers to create new state objects.Overview of Cozy-Stack core server
Cozy-Stack is the core server of the Cozy platform, consisting of a single process. Its primary responsibility is serving Web applications installed by users from the application store. It acts as the central hub for interacting with Cozy apps and data.Overview of Enedis SGE Konnector
The Enedis SGE konnector fetches electricity consumption measures from the Enedis SGE SOAP API. Unlike the Enedis OAuth konnector, this is a regular authentication konnector. The API is proxied via the WSO2 API Manager.Overview of Ecolyo Konnectors
Konnectors are independent scripts managed by the cozy home application that import data from web services into cozy. Ecolyo specifically utilizes konnectors for three web services: Enedis, Grdf, and Eau du grand Lyon (EGL). Since version 3.1.0, these konnectors also handle price data.Overview of the DACC Infrastructure Workflow
DACC is a system used by apps to send data for anonymization and aggregation to provide usage statistics. The infrastructure consists of two environments: development (Alpha VM) and production. A core service calledaggregatorUsageEventruns daily (randomly before 07:00 AM) to parse traced events from the database and send pre-processed data to Cozy.Overview of the enedisHalfHourMonthlyAnalysis service
The
enedisHalfHourMonthlyAnalysisservice is exclusively for electricity fluid. It runs on the 3rd of every month between 10am and 12pm. Its primary responsibilities are to calculate the average consumption load for half-hour timesteps, the maximum power consumed, and the off-peak hours consumption ratio for a given month.Execution Logic:
- Checks
com.grandlyon.enedis.minutedoctype. If empty, the service stops. - Calculates analysis data and stores it in
com.grandlyon.enedis.monthly.analysis.data. - Backfilling:
- If previous entries exist in the analysis doctype, it creates analysis for every month between the first
enedis.minuteentry and the firstenedis.monthly.analysis.dataentry. - If no previous entries exist, it creates analysis from the last month's analysis up to the minimum date between one year ago and the first
enedis.minuteentry.
- If previous entries exist in the analysis doctype, it creates analysis for every month between the first
"enedisHalfHourMonthlyAnalysis": { "type": "node", "file": "services/enedisHalfHourMonthlyAnalysis/ecolyo.js", "trigger": "@monthly on the 3 between 10am and 12pm" }- Checks
Overview of the Ecolyo application
Ecolyo is a multi-fluid application designed for users of the Grand Lyon metropolis to monitor and optimize energy consumption. It is built as a Cozy application and utilizes Cozy konnectors to allow users to connect energy accounts from providers such as EGL, ENEDIS, and GRDF.Understand the Ecolyo Agent newsletter structure
The Ecolyo Agent newsletter is composed of four primary sections that define the layout and content of the email sent to users:
- subject: Manages the email subject line.
- monthlyInfo: Contains a global information section and a corresponding image URL.
- monthlyNews: Contains an editable title and details regarding recent novelties/updates.
- poll: Contains a specific question and a link directing the user to a survey.
Use Gorm as the Go ORM
Gorm is the Object-Relational Mapper (ORM) for Go used in this project to facilitate communication between the backend and a relational database.Manage user onboarding flow in Ecolyo
Ecolyo handles new user onboarding through a sequence of screens triggered during the first connection. The system determines if a user is connecting for the first time by checking theisFirstConnectionboolean located within theprofiledoctype. The onboarding sequence consists of the GCU screen followed by a Welcome modal.Understand Ecolyo build branch environments
Ecolyo utilizes three distinct build branches to manage different deployment environments:
build: Reflects the master branch and the version currently deployed in the production environment.build-test: A temporary build used for testing purposes.build-dev: Reflects the dev branch and the version deployed in the development environment.