Skip to content
Snippets Groups Projects
Commit fe0773e1 authored by Rémi PAILHAREY's avatar Rémi PAILHAREY :fork_knife_plate:
Browse files

doc: update or create for EGL

parent 8cdf2d9f
No related branches found
No related tags found
No related merge requests found
Pipeline #100612 passed
...@@ -51,5 +51,6 @@ ...@@ -51,5 +51,6 @@
"style": "dash" "style": "dash"
}, },
"no-bare-urls": false, "no-bare-urls": false,
"line_length": false "line_length": false,
} "MD054": false
}
\ No newline at end of file
...@@ -11,6 +11,12 @@ You should also check Cozy's official documentations for konnectors : ...@@ -11,6 +11,12 @@ You should also check Cozy's official documentations for konnectors :
- API Url for Development : [https://agence-rec.eaudugrandlyon.com](https://agence-rec.eaudugrandlyon.com/) - API Url for Development : [https://agence-rec.eaudugrandlyon.com](https://agence-rec.eaudugrandlyon.com/)
- API Url for Production : [https://agence.eaudugrandlyon.com/ws](https://agence.eaudugrandlyon.com/ws) - API Url for Production : [https://agence.eaudugrandlyon.com/ws](https://agence.eaudugrandlyon.com/ws)
## Update or create data
This konnector updates data if it has changed since the last execution or creates a new entry if the data is new. It also updates month and year aggregates except for start month and start year to prevent overriding data if user has more than 3 years of data.
For this we use a combinaison of the hydrateAndFilter function and the updateOrCreate function.
## Authentication ## Authentication
In order to authenticate to the EGL API we have to request the following route In order to authenticate to the EGL API we have to request the following route
...@@ -56,7 +62,7 @@ Once you've sent this request the API should answer with a code 100 if everythin ...@@ -56,7 +62,7 @@ Once you've sent this request the API should answer with a code 100 if everythin
## Fetch Data ## Fetch Data
:::warning :::warning
The earliest data that can be fetched is November 2022 (not 3 years) due to migration from EGL to EPGL The earliest data that can be fetched is November 2022 (not 3 years) due to migration from EGL to EPGL
::: :::
...@@ -118,12 +124,9 @@ If you're looking for more information about the API, checkout the [complete API ...@@ -118,12 +124,9 @@ If you're looking for more information about the API, checkout the [complete API
### Konnector Methods ### Konnector Methods
| Method | Description | | Method | Description |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ----------------------------- | ------------- |
| start | Init Function | | start | Init Function |
| getData | Retrieve data from API | | 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. |
| authenticate | Authentication method. Requires login, password, baseUrl and ApiAuthKey. | | format | Format data for DB storage and remove bad data (former "T" typeagregats remain in response even if the data was added later, leading to duplicated data)|
| storeData | Save data in the right doctype db and prevent duplicated keys |
| format | Format data for DB storage and remove bad data (former "T" typeagregats remain in response even if the data was added later, leading to duplicated data) |
| resetInProgressAggregatedData | Function handling special case.The temporary aggregated data need to be remove in order for the most recent one to 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 |
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