diff --git a/docs/ecolyo/functionalities/dacc.md b/docs/ecolyo/functionalities/dacc.md index e2a30628efe23cda38a7e204037ec3b145c54ad4..414194d81b01a99421e6c0a476907fb494d37567 100644 --- a/docs/ecolyo/functionalities/dacc.md +++ b/docs/ecolyo/functionalities/dacc.md @@ -16,14 +16,95 @@ There is a service named `aggregatorUsageEvent`, running on a daily basis, sendi ## Usage events +This section explains how the application is tracking usage events. Here are the main step: + +- All events are stored during the use of the application in the doctype **com.grandlyon.ecolyo.usageevents** +- A service is responsible of the aggregation of these events to create ANONYMIZED indicators. These indicators are then sent to a remote docType. + + | Title | Tech name | target | context | startDate | result | trigger | Cozy Dacc Name | | --- | --- | --- | --- | --- | --- | --- | --- | | Changement d'action dans un challenge | ActionChangeEvent | Id de l'action | Id du challenge en cours | --- | --- | Chaque appui sur le bouton `selectEcogesture` dans le `ActionCard` | navigation-action-daily | | Validation de la fin d'une action | ActionEndEvent | Id de l'ecogeste | Id du challenge en cours | Date de début de l'action | --- | Lors de l'appui sur le bouton de fin d'action | event-duration | | Connexion d'un utilisateur | ConnectionEvent | --- | Navigateur utilisé | --- | Si c'est la première connexion `firstConnection` est stocké | A chaque chargement de l'application | connection-count-daily | -| Connecteur Classique | KonnectorConnectEvent | Slug du connecteur | --- | Connecteur | Success ou error | Le succès dans le cas ou on a la pop-up 'félicitation', le 'error' en cas d'erreur de quelque type que ce soit (catch) | konnector-event-daily | -| Connecteur Oauth (enedis, GRDF) | KonnectorConnectEvent | Slug du connecteur | --- | Connecteur | Success ou error | Le succès dans le cas ou on a la pop-up 'félicitation', le 'error' dans le cas ou aucun accoun n'est créé | konnector-event-daily | -| Refresh manuel du connecteur | KonnectorRefreshEvent | Slug du connecteur | --- | Connecteur | Success ou error. Le succès est set quand l'état du trigger est a 'done' | Lors de l'appuie sur le bouton 'mettre a jour' | konnector-event-daily | +| Connecteur Classique | KonnectorConnectEvent | Slug du connecteur | --- | --- | Success ou error | Le succès dans le cas ou on a la pop-up 'félicitation', le 'error' en cas d'erreur de quelque type que ce soit (catch) | konnector-event-daily | +| Connecteur Oauth (enedis, GRDF) | KonnectorConnectEvent | Slug du connecteur | --- | --- | Success ou error | Le succès dans le cas ou on a la pop-up 'félicitation', le 'error' dans le cas ou aucun accoun n'est créé | konnector-event-daily | +| Refresh manuel du connecteur | KonnectorRefreshEvent | Slug du connecteur | --- | --- | Success ou error. Le succès est set quand l'état du trigger est a 'done' | Lors de l'appuie sur le bouton 'mettre a jour' | konnector-event-daily | +| Navigation utilisateur dans l'application | NavigationEvent | Nom de la page ( voir 1. en dessous ) | --- | --- | --- | --- | navigation-count-daily | +| Comparaison de consomation | ConsumptionCompareEvent | timestep in lowercase | fluid type in lowercase | --- | --- | --- | navigation-action-daily | +| Changement de pas de temps | ConsumptionChangeTimeStepEvent | timestep in lowercase | fluid type | --- | --- | --- | navigation-action-daily | +| Lancement d'un challenge | ChallengeLaunchEvent | challenge id | --- | --- | --- | Appuie sur le bouton de lancement de challenge dans le cas on la pop-up 'pas de fluid' ne s'affiche pas | event-duration | +| Title | Tech name | target | context | startDate | result | trigger | Cozy Dacc Name | +| Fin d'un challenge | ChallengeEndEvent | challenge id | --- | date de début du challenge | --- | Lors de la visualisation d'un challenge, si le resultat de celui-ci est a 'fini' on enregistre l'événement | event-duration | +| Début d'un duel | DuelLaunchEvent | duel id | challenge id | --- | --- | Appuie sur le bouton de lancement d'un duel | event-duration | +| Fin d'un duel | DuelEndEvent | duel id | --- | challenge start date | 'win' or 'loss' | Lors de la visualisation d'un duel, si le resultat de celui-ci est a 'fini' on enregistre l'événement | event-duration | +| Fin d'un quiz | QuizEndEvent | Quiz id | Challenge Id | Quiz start date | Resultat du quiz (de 0 a 5) | Lors de la pop-up de résultat | event-duration | +| --- | ExplorationEndEvent | --- | --- | --- | --- | --- | --- | +| --- | ActionChangeEvent | --- | --- | --- | --- | --- | --- | +| --- | ActionEndEvent | --- | --- | --- | --- | --- | --- | +| --- | ProfileSetEvent | --- | --- | --- | --- | --- | --- | +| --- | ReportFromEvent | --- | --- | --- | --- | --- | --- | + + + +1. Nom de la page, différents cas existant + +| Page | target | Trigger | +| --- | --- | --- | +| Consomation | 'electricity', 'gas', 'eau', 'multifluid' | Click sur un des fluids dans la bar navigation | +| FAQ | 'faq' | Click sur la card de consultation | +| CGU | 'legalNotice' | Click sur la card de Legal Notice | +| Autres | 'consumption' 'challenges' 'ecogestures' 'analysis' 'options' | Click dans la navbar | + +## Functionnalities + +The service will retrieve all new events by filter on the _aggregated_ flag to **false** and the event date before than today. +For each aggregator type we will defined the right calculation to apply to create the appropriate indicator: + +- calculation of the session time indicator based on ConnectionEvent +- calculation of the konnectors connected per day based on the fluidStatus +- calculates if a user launched a duel just after earned 15 stars +- calculation of the period between 2 different challenges based on the ChallengeLaunchEvent +- calculation of the period between the first connection and the first challenge based on ChallengeLaunchEvent and ConnectionEvent +- calculation of an indicator based on a single event +- calculation of an aggregated indicator to sum an event type per days. + +Once the indicators is calculated we will: + +1. post the indicator to the remote doctype +2. push the event used to calculate the indicator to a array, which will be used to identify all events taken into account during the process. + +At the end of the service, the service will change the _aggregated_ flag to **true** for all events present in the array. + +More technical information are available [here](/ecolyo/services/aggregator_usage_events.md) + +## Remote doctype + +TODO: Rewrite + +All indicator are post to a remote doctype, which will allow the application to read a defined external API. This doctype is created by Cozy itself. +Here are the actual structure of this remote doctype: + +``` +{ + source: string + name: string + startDate: string + endDate: string + value?: number + groups: { [key: string]: string } +} +``` + +with: + +- source: contains "ecolyo" value. +- name: contains the indicator type +- startDate and endDate: used to defined a period or if not relevant, it contains both the date of the events. +- value: contains aggreated value (example: number of page viewed on a day). +- groups: contains all other attribute useful for the indicator (example: context, target, result) + + ## Indicators TODO \ No newline at end of file