A marshmallow schema for the National Wastewater Surveillance System
Project description
💧 nwss-data-standard
A marshmallow
schema for the National Wastewater Surveillance System.
Usage
Installation
# Install from PyPI
pip install nwss
# Install local copy
git clone https://github.com/datamade/nwss-data-standard.git && cd nwss-data-standard
pip install .
See Data dictionary version compatibility for historical versions of the schema.
Data dictionary version compatibility
The CDC uses semantic versioning to track changes to the expected format for
DCIPHER uploads.
This table maps versions of the nwss
Python package to versions of the data
dictionary.
Package version | CDC version |
---|---|
1.0.0 | 2.0.2 |
You can retrieve the CDC version from the nwss
module for use in your scripts:
>>> import nwss
>>> print(nwss.CDC_VERSION)
'2.0.2'
Demo
On the web
Head to https://datamade.github.io/nwss-data-standard/ to validate a file against the standard!
In Python
from marshmallow import ValidationError
from nwss.schemas import WaterSampleSchema
sample_data = [
# array of dictionaries
]
schema = WaterSampleSchema(many=True)
try:
schema.load(sample_data)
except ValidationError as e:
print(e.messages)
else:
print('Data is valid!')
Development
Patches and pull requests
Your patches are welcome. Here's our suggested workflow:
- Fork the project.
- Create a new branch, then make your feature addition or bug fix.
- Send us a pull request with a description of your work.
Python Schema
Install the app locally.
git clone https://github.com/datamade/nwss-data-standard.git && cd nwss-data-standard
pip install -e .[dev]
Make your changes, then run the tests.
pytest
JSON Schema
nwss
comes with a Python implementation of the NWSS schema, as well as a
convenience script to translate it to a JSON schema:
python3 -m nwss.dump_to_jsonschema > schema.json
Much of the JSON schema is determined by the marshmallow
schema, however
some conditional validation is written into the convenience script. You may
need to update the script to make your desired change.
Demo
Run a local server and auto-bundle your scripts:
npm run develop
Navigate to the app: http://localhost:8000/docs/
Errors and bugs
If something is not behaving intuitively, it is a bug and should be reported. Report it here by creating an issue: https://github.com/datamade/nwss-data-standard/issues
Help us fix the problem as quickly as possible by following Mozilla's guidelines for reporting bugs.
Copyright and attribution
Copyright (c) 2021 DataMade. Released under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nwss-1.0.0.tar.gz
.
File metadata
- Download URL: nwss-1.0.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/2.7.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c87e8f5f63eb7c7c15cf315ff5ded06bd0248da40626e03c71afd919132cb47e |
|
MD5 | f821e2691b0cd169fc4571d1ac168a8e |
|
BLAKE2b-256 | 01549e7f76b19140d5a1ebfcadfa32b6531bf0a53a1e6e97db9d0185e0a5927c |
File details
Details for the file nwss-1.0.0-py2-none-any.whl
.
File metadata
- Download URL: nwss-1.0.0-py2-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/2.7.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa1a239eb2091f8b8ce4c891a9ced486c178c070261a6859b591df5da97fdc67 |
|
MD5 | 2e4bc6e7467bf1957c31df4e30e439e7 |
|
BLAKE2b-256 | d4600abe7cd11cc690a60a89e320a1e74beddad7c0088f5cd50a11cf3898da07 |