hotosm / galaxy-api

Backend to fetch data from Underpass
https://galaxy-api.hotosm.org/latest/redoc
GNU Affero General Public License v3.0
14 stars 5 forks source link

Enhance User statistics endpoint #213

Closed kshitijrajsharma closed 2 years ago

kshitijrajsharma commented 2 years ago

Changed Query , Changed Query generator logic , Created New Validation Model Based on the response we are getting from DB

Sample Request to test : For request without hashtag :

{"userId":8938340,"fromTimestamp":"2022-04-12T12:23:35.646Z","toTimestamp":"2022-05-11T12:23:35.646Z","projectIds":[],"hashtags":[]}

For request with hashtag :

{"userId":8938340,"fromTimestamp":"2022-04-12T12:23:35.646Z","toTimestamp":"2022-05-11T12:23:35.646Z","projectIds":[],"hashtags":["missingmaps"]}

New Response will include count automatically hence aggregation on response is not required :

[
  {
    "addedBuildings": 0,
    "modifiedBuildings": 0,
    "addedHighway": 0,
    "modifiedHighway": 0,
    "addedHighwayMeters": 0,
    "modifiedHighwayMeters": 0
  }
]
d-rita commented 2 years ago

Tested with the sample queries provided using both this modified query and the current query on production:

1. sample query without hashtag:

current - result 1

2. sample query with hashtag:

modified - result 2 current - result 2

Result: This information is consistent with both the current query on production and this modification.