communitysnowobs / cso-api

0 stars 2 forks source link

Changes to MountainHub API list of returned variables #8

Open aaarendt opened 4 years ago

aaarendt commented 4 years ago

It appears the Mountain Hub API has changed the names for some of the variables we need. This will require changing the mountainhub.js code.

@aaarendt is working to figure out correct variable names.

aaarendt commented 4 years ago

See this PR for attempts to use Python for direct access to the API.

We need to find out which field contains the notes, for example to parse out the contest and SnowEx observations.

aaarendt commented 4 years ago

From David Hill: we seek to grab snow depths both from the 'snow conditions' option, but also the 'snowpack test' option. There are a lot of depths in the latter category that we would miss otherwise.

Be sure to check on this.

emiliom commented 4 years ago

From David Hill: we seek to grab snow depths both from the 'snow conditions' option, but also the 'snowpack test' option. There are a lot of depths in the latter category that we would miss otherwise.

From what I can tell on the current mountainhub.js code (last modified 11 months ago, on 2019-2-19), both 'snow_conditions' and 'snowpack_test' are already handled. I've also confirmed via Python requests that the API obs_type parameter being used in mountainhub.js still works with those two values.

We need to find out which field contains the notes, for example to parse out the contest and SnowEx observations.

Based on the responses with Python and browser requests, it looks like you've captured the main observation comment (record.observation.description) in PR #10.

emiliom commented 4 years ago

@aaarendt I've worked with your retrieve_from_MountainHub.ipynb Jupyter notebook, tweaking the code it and reissuing many requests. I've also examined the MountainHub JSON responses very closely, to wrap my head around it. Here are some observations and questions:

I'll issue a PR to push a new notebook, a modified version of retrieve_from_MountainHub.ipynb but with a new name.

emiliom commented 4 years ago

The PR with my new notebook is #13. The notebook has lots of notes

emiliom commented 4 years ago

@aaarendt have you had a chance to review where things stand, including my comments above and notebook? Let me know if you have follow-up questions that I can help with.

emiliom commented 4 years ago

@aaarendt could you add details here about the problem you're still seeing with the API, that we talked about on Friday? Specifically, you said you don't get any returns when you query for recent data for specific submissions done by your colleagues, which are visible on the MountainHub web app map.

emiliom commented 4 years ago

Just wanted to note here that the validation repo also contains Python code to read from the MountainHub API: https://github.com/communitysnowobs/validation/blob/master/validation/MountainHub.py. That code has basically the same functionality as the one at cso-legacy-api, https://github.com/communitysnowobs/cso-legacy-api/blob/master/src/resources/obs/MountainHub.py. But they're not identical. Ultimately, we should consolidate these two and leave a single, well documented, master code (package?) to access the MountainHub API.

Both of these code bases were last updated in mid 2018.