Skip to content

Conversation

@whitehat007
Copy link

Also added source info field

Also added source info field
Copy link
Owner

@ExpDev07 ExpDev07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn’t really give the last updates, it’ll just say whatever time is the endpoint is accessed. Also, to comply with the JSON-API spec, should perhaps this information be put under a “meta” key?

@whitehat007
Copy link
Author

Is it possible to get the time of the last update? If so I think that would be preferable.

We could put it under a meta key, but I feel like that's rather unnecessary for just 1-2 keys--plus, that doesn't conform to the v1 API. Either way works, but I just think it should be consistent (and backward-compatible so it doesn't break workflows).

@ExpDev07
Copy link
Owner

ExpDev07 commented Mar 19, 2020

The point of the /v2/ was to introduce major changes. We just have to stay compatible with the current v2 endpoints and not v1 (they are now undocumented but staying for legacy support and not to break apps).

And yes, it’s possible. You can go into the timeline.py, and add a computed field which just grabs the latest key in the timelines property dict (see latest). Then you just gotta make sure to add it to the serialization method dict.

@ExpDev07
Copy link
Owner

Oops, I meant timeline.py, not location. The last_update would technically be apart of the timelines.

However, I agree that it would be better having it attached to the actual location object, in which case we can just store the time when the data was last retrieved from JHU. Either way works, but which one is the best, idk.

@whitehat007
Copy link
Author

Alright, then adding the meta key is the way to go.

I looked at the return data from the timelines property, but the timestamp is always at midnight GMT, which isn't really useful. However, the Last update field here shows the latest update by country, which would be very useful (and can be attached to the location object). For the case of /v2/latest, we could just take the most recent date/time from that field and use that.

@ExpDev07
Copy link
Owner

Yup, it’s always midnight. JHU updates their data only once a day anyways.

@Kilo59 Kilo59 closed this Feb 27, 2021
@Kilo59
Copy link
Collaborator

Kilo59 commented Feb 27, 2021

Will be adding a similar feature, hopefully soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants