CIVIS-project / YouPower

Work repository for development of the CIVIS project
Apache License 2.0
4 stars 6 forks source link

endpoint for community (consortium) consumption #79

Open danielmiorandi opened 9 years ago

danielmiorandi commented 9 years ago

Need an endpoint to fetch data about the total community (consortium for the case of Trento) consumption. Data shall be for the last available month, with a variation field wrt previous one.

taha-k commented 9 years ago

mail REPLY, send list of users.. Or households where users are connected..

taha-k commented 9 years ago

@danielmiorandi Can u just check if this is what you want. I could have contacted REPLY, but they take really long to respond, so I just managed another way around. If you find it proper, then let me know and close this issue. You will have to query this way curl -i -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $API_TOKEN" -d '{ "from": "2015-06-01", "to":"2015-06-06", "type":"S_CONS", "res":"MONTHLY" }' http://localhost:3000/api/community/55df054e92ffe001537ff727/consortium

and the response will be [ { "refObject": { "householdId": "55d46b3439659b8018435234", "usagePointId": "20" }, "consumptionData": { "IntervalBlock": [ { "apartmentId": "20", "type": "S_CONS", "kind": "0" } ], "IntervalReadings": [ { "value": "6187.03857421875", "timeslot": "F3", "timePeriod": { "start": "2015-06-01T00:00:00+02:00", "duration": "2592000", "datacoverage": "81493" } }, { "value": "29161.4579982758", "timeslot": "F1", "timePeriod": { "start": "2015-06-01T00:00:00+02:00", "duration": "2592000", "datacoverage": "291726" } }, { "value": "201890.381847382", "timeslot": "F2", "timePeriod": { "start": "2015-06-01T00:00:00+02:00", "duration": "2592000", "datacoverage": "1491540" } } ] } }, { "refObject": { "householdId": "55d46b3c39659b8018435238", "usagePointId": "14" }, "consumptionData": { "IntervalBlock": [ { "apartmentId": "14", "type": "S_CONS", "kind": "0" } ], "IntervalReadings": [ { "value": "67155.7825641632", "timeslot": "F2", "timePeriod": { "start": "2015-06-01T00:00:00+02:00", "duration": "2592000", "datacoverage": "598406" } }, { "value": "86960.249256134", "timeslot": "F1", "timePeriod": { "start": "2015-06-01T00:00:00+02:00", "duration": "2592000", "datacoverage": "831245" } }, { "value": "102922.147701263", "timeslot": "F3", "timePeriod": { "start": "2015-06-01T00:00:00+02:00", "duration": "2592000", "datacoverage": "1144717" } } ] } } ]

danielmiorandi commented 9 years ago

not really, this is just for one household, whereas I need the whole aggregated value for the consortium. The response shall be something like: { "lastMonth": xxx, '"trend": yyy } where xxx and yyy are numbers, the first one indicating the actual value for the last month and the second one the trend (in %) over the previous one. Can you for the time being just setup the endpoint and return random numbers, so that at least we can check integration with the frontend? (We should try to decouple frontend/backend integration with backend/Reply integration, with the backend including all the logic for transforming requests from the frontend into appropriate requests to Reply and processing the response in order to respond to the frontend.)