openaq / openaq-data-format

A description of the data format provided by the OpenAQ platform.
MIT License
29 stars 4 forks source link

add location schema & related files, implement node module #18

Closed sethvincent closed 4 years ago

sethvincent commented 5 years ago

This adds a json schema for locations & associated instruments, and includes initial implementation of a node module that exposes the location schema and a validate function. This will allow us to write tests against the schema and/or use the schema as a dependency for validating api requests, generating test data, etc.

The schema is based on discussion in https://github.com/openaq/project-metadata-format/issues/7, some editing may be needed.

I considered breaking the instrument schema out into its own file but it didn't seem like there was a use case for having it separate.

The docs in docs/location.md are generated by running npm run build.

jflasher commented 5 years ago

Thanks for this @sethvincent! I don't have any feedback on the content, but just wanted to mention we're already using https://www.npmjs.com/package/jsonschema for other OpenAQ projects. If possible, it'd be nice to avoid duping schema packages, but if you really want to use this one, just give a reason why and it's not a problem.

sethvincent commented 5 years ago

Ah, I hadn't seen that. Switching to jsonschema makes sense to me.

sethvincent commented 5 years ago

Updated to use jsonschema and added a fix for a missing schema property.

sethvincent commented 5 years ago

I realized that the locations table/endpoint uses parameters instead of pollutants so it would probably be best to use parameters here as well. I'll take a look through and see if there are any other similar mismatches.