Skip to content
Snippets Groups Projects
Commit 3b8ab63d authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

Update docs/ecolyo/functionalities/dacc.md

parent 56058c42
No related branches found
No related tags found
No related merge requests found
Pipeline #44507 passed
...@@ -121,7 +121,7 @@ with: ...@@ -121,7 +121,7 @@ with:
- *createdBy*: contains "ecolyo" value. - *createdBy*: contains "ecolyo" value.
- *startDate*: used to defined the start date of the indicator - *startDate*: used to defined the start date of the indicator
- *value*: contains a value relevant to the defined indicator (example: number of page viewed on a day). - *value*: contains a value relevant to the defined indicator (example: number of page viewed on a day).
- *groups*: contains all attributes defining a indicator. Please refer to indicators definition (https://stats.cozycloud.cc/question#eyJkYXRhc2V0X3F1ZXJ5Ijp7ImRhdGFiYXNlIjo0LCJxdWVyeSI6eyJzb3VyY2UtdGFibGUiOjh9LCJ0eXBlIjoicXVlcnkifSwiZGlzcGxheSI6InRhYmxlIiwidmlzdWFsaXphdGlvbl9zZXR0aW5ncyI6e319) - *groups*: contains all attributes defining a indicator. Please refer to [indicators definition](https://stats.cozycloud.cc/question#eyJkYXRhc2V0X3F1ZXJ5Ijp7ImRhdGFiYXNlIjo0LCJxdWVyeSI6eyJzb3VyY2UtdGFibGUiOjh9LCJ0eXBlIjoicXVlcnkifSwiZGlzcGxheSI6InRhYmxlIiwidmlzdWFsaXphdGlvbl9zZXR0aW5ncyI6e319)
- *mesureName*: contains one of the following value - *mesureName*: contains one of the following value
| ENUM | value | | ENUM | value |
...@@ -161,22 +161,26 @@ There is two remote doctypes pointing to two different mode. `dacc-dev` is used ...@@ -161,22 +161,26 @@ There is two remote doctypes pointing to two different mode. `dacc-dev` is used
First you need to modify the service in order to be able to see data in local : First you need to modify the service in order to be able to see data in local :
- Run a local server that will listen and log events.
```sh
node srcipts/server.js
```
- Modify dacc URL in order to see data (ligne 67) - Edit dacc URL (line 67) to send requests to your local server at `http://localhost:8081`
```js ```js
await client await client
.getStackClient() .getStackClient()
.fetchJSON( .fetchJSON(
'POST', 'POST',
environments.isProduction() environments.isProduction()
? 'http://localhost:8081' ? '/remote/cc.cozycloud.daccv_2'
: '/remote/cc.cozycloud.dacc.dev', : 'http://localhost:8081',
{ {
data: JSON.stringify(indicator), data: JSON.stringify(indicator),
} }
) )
``` ```
- Remove date protection if you want to test monthly indicators (ligne 1100) - For **monthly indicators**, remove date protection (ligne 1100)
```js ```js
if ( if (
profile profile
...@@ -189,20 +193,25 @@ First you need to modify the service in order to be able to see data in local : ...@@ -189,20 +193,25 @@ First you need to modify the service in order to be able to see data in local :
) { ) {
``` ```
- Generate usage events by navigating through the app
Then you need to launch a script that will simulate dacc api. This terminal will listen to incoming request You will be able to see previous events and freshly genereated events in the db `com-grandlyon-ecolyo-usageevent`
```sh :warning: because the cron run every day at 2am, it will take events from the day before. So if you want to test specific usage, you will have to edit the `eventDate` of events you want to send.
cd ./scripts
node server.js
```
Then you are finally ready to test ! Just run the following :
- Then you are finally ready to test ! Just run the following :
*If aggregatorUsageEvents changed*
```sh
yarn build-dev:browser & yarn run cozy-konnector-dev -m ./manifest.webapp ./build/services/aggregatorUsageEvents/ecolyo.js
```
*To save time, when running multiple times and if aggregatorUsageEvents didn't change, you don't have to build.*
```sh ```sh
yarn build-dev:browser; yarn run cozy-konnector-dev -m .\manifest.webapp .\build\services\aggregatorUsageEvents\ecolyo.js yarn run cozy-konnector-dev -m ./manifest.webapp ./build/services/aggregatorUsageEvents/ecolyo.js
``` ```
You must see sent indicators in the previously open terminal
- You should see sent indicators in the logs of your local server
```json ```json
{ {
...@@ -215,8 +224,21 @@ You must see sent indicators in the previously open terminal ...@@ -215,8 +224,21 @@ You must see sent indicators in the previously open terminal
## How to add new indicator ? ## How to add new indicator ?
You have to reach cozy and discuss with them about new indicators. They will implement it for `dacc-dev` and `dacc` and you will be able to test it on alpha env. Remember you will need at least 5 data of each type to see it in metabase. You have to reach cozy and discuss with them about new indicators. They will implement it for `dacc-dev` and `dacc` and you will be able to test it on alpha env. Remember you will need **at least 5 data** of each type to see it in metabase.
## Visualisation ## Visualisation
All the data aggregated in the dacc can be visualized with a *Metabase* website hosted by cozy (https://stats.cozycloud.cc/). All the data aggregated in the dacc can be visualized with a *Metabase* website hosted by [cozy](https://stats.cozycloud.cc/).
## Errors
More here in [DJU](https://doc.self-data.alpha.grandlyon.com/ecolyo/functionalities/profile_type/).
If there is an authentication error, the api will returns an error in html format to cozy, so you'll get from cozy an error 502 as following, because cozy expects a json response :
```json
{
"status": "502",
"title": "Bad Gateway",
"detail": "the content-type for the response is not authorized",
"source": {}
}
```
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