ResEnv / chain-api

RESTful sensor API
MIT License
39 stars 16 forks source link

added support for TSV download #58

Closed kkleidal closed 2 years ago

kkleidal commented 9 years ago

by adding tsv=true GET param

Can easily be changed to CSV if need be, but tabs are generally a better delimiter than commas.

XXX: I only changed the generic Resource class; individual resources may still need to be changed

9

ssfrr commented 9 years ago

Thanks for hopping on this, looks good.

We should figure out how to make this feature discoverable via links. One option would be to have a parallel link for collections that includes the __tsv__=true in the link. This also might be a good opportunity to start using templated links, so we can add the optional parameter to existing collection links.

Also please add a couple unit tests to verify that the correct data is coming back in the right format, with the right content type header.

-s

kkleidal commented 9 years ago

Added TSV links to list views (I can add them to single views too if you want). It currently only links to the TSV with the exact same filter.

It might be helpful to create a new view that lets you tailor the filters and download a TSV containing the data obeying the filters. Sort of like a query. Should I put that idea in a separate issue?

I also added two test cases.

kkleidal commented 9 years ago

Need to add some tests Tuesday, but TSV upload seems to be working.

kkleidal commented 9 years ago

Also, I don't think the fields in TSV upload/TSV download are necessarily consistent with each other (but they are internally consistent--ie, if you download a scalar data TSV from two different sensors, they will have the same fields), but the properties in the JSON create/JSON get are not necessarily consistent either, so I didn't think it would be a problem.

kkleidal commented 9 years ago

Implemented upload tests

ssfrr commented 9 years ago

Looks good. I'll pull it to my dev environment and play around with it soon.