Skip to content
Snippets Groups Projects
Commit f198bacc authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Add konnector functions

parent 90ad6988
No related branches found
No related tags found
No related merge requests found
......@@ -125,6 +125,19 @@ You'll have to subtract a day value with the previous's to get a consumption for
If you're looking for more information about the API, checkout the [complete API documentation](/documents/egl-api-doc.pdf)
### Usage
TODO : add explanation of how we manage data in the konnector
### Konnector Methods
| Method | Description |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| start | Init Function |
| getData | Retrieve data from API |
| processData | Parse data. Remove existing data from DB using hydrateAndFilter, store filtered data and return the list of filtered data |
| authenticate | Authentication method. Requires login, password, baseUrl and ApiAuthKey. |
| storeData | Save data in the right doctype db and prevent duplicated keys |
| format | Format data for DB storage and remove bad data |
| processYearAgregation | |
| processMonthlyAgregation | |
| groupBy | |
| reduceYearFunction | |
| reduceMonthFunction | |
| resetInProgressAggregatedData | Function handling special case.The temporary aggregated data need to be remove in order for the most recent one te be saved. Ex for com.grandlyon.egl.year : `{ load: 76.712, year: 2020, ... }` need to be replace by `{ load: 82.212, year: 2020, ... }` after egl data reprocess |
......@@ -22,7 +22,7 @@ On its first launch, following the Oauth Client Connect authentification.
- The account has now an access_token and an id_token from the oauth call
!!! info ""
id_token is only given when requesting the token endpoint in _authorization_code_ grant_type.
id*token is only given when requesting the token endpoint in \_authorization_code* grant_type.
This token holds several meta datas, including the pce_id (id of user's meter) that will be needed further to fetch user's datas.
- Konnector starts, fails to find a pce_id in database on first launch therefore decodes the id_token to store the pce_id in db (see [addData](https://docs.cozy.io/en/cozy-konnector-libs/api/#adddata_1)).
......@@ -58,3 +58,16 @@ Build the konnector with `yarn build`.
Type `yarn deploy` to build on a dedicated branch.
Build branch is stored as a docker image in a registry : [Container Registry](https://forge.grandlyon.com/web-et-numerique/llle_project/grdf-adict-konnector/container_registry).
### Konnector Methods
| Method | Description |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| start | Init Function |
| getData | Retrieve data from API |
| processData | Parse data. Remove existing data from DB using hydrateAndFilter, store filtered data and return the list of filtered data |
| storeData | Save data in the right doctype db and prevent duplicated keys |
| formateData | Format data for DB storage and remove bad data |
| buildAgregatedData | Retrieve and remove old data for a specific doctype and return an array of agregated data |
| buildDataFromKey | Format an entry for DB storage using key and value. For year doctype: key = "YYYY". For month doctype: key = "YYYY-MM" |
| resetInProgressAggregatedData | Function handling special case.The temporary aggregated data need to be remove in order for the most recent one te be saved. Ex for com.grandlyon.grdf.year : `{ load: 76.712, year: 2020, ... }` need to be replace by `{ load: 82.212, year: 2020, ... }` after grdf data reprocess |
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment