|
| 1 | +# NWSS wastewater data |
| 2 | + |
| 3 | +We import the wastewater data, currently only the smoothed concentration, from the CDC website, aggregate to the state and national level from the wastewater sample site level, and export the aggregated data. |
| 4 | +For details see the `DETAILS.md` file in this directory. |
| 5 | + |
| 6 | +## Create a MyAppToken |
| 7 | +`MyAppToken` is required when fetching data from SODA Consumer API |
| 8 | +(https://dev.socrata.com/foundry/data.cdc.gov/r8kw-7aab). Follow the |
| 9 | +steps below to create a MyAppToken. |
| 10 | +- Click the `Sign up for an app token` button in the linked website |
| 11 | +- Sign In or Sign Up with Socrata ID |
| 12 | +- Click the `Create New App Token` button |
| 13 | +- Fill in `Application Name` and `Description` (You can just use delphi_wastewater |
| 14 | + for both) and click `Save` |
| 15 | +- Copy the `App Token` |
| 16 | + |
| 17 | + |
| 18 | +## Running the Indicator |
| 19 | + |
| 20 | +The indicator is run by directly executing the Python module contained in this |
| 21 | +directory. The safest way to do this is to create a virtual environment, |
| 22 | +installed the common DELPHI tools, and then install the module and its |
| 23 | +dependencies. To do this, run the following command from this directory: |
| 24 | + |
| 25 | +``` |
| 26 | +make install |
| 27 | +``` |
| 28 | + |
| 29 | +This command will install the package in editable mode, so you can make changes that |
| 30 | +will automatically propagate to the installed package. |
| 31 | + |
| 32 | +All of the user-changable parameters are stored in `params.json`. To execute |
| 33 | +the module and produce the output datasets (by default, in `receiving`), run |
| 34 | +the following: |
| 35 | + |
| 36 | +``` |
| 37 | +env/bin/python -m delphi_nwss |
| 38 | +``` |
| 39 | + |
| 40 | +If you want to enter the virtual environment in your shell, |
| 41 | +you can run `source env/bin/activate`. Run `deactivate` to leave the virtual environment. |
| 42 | + |
| 43 | +Once you are finished, you can remove the virtual environment and |
| 44 | +params file with the following: |
| 45 | + |
| 46 | +``` |
| 47 | +make clean |
| 48 | +``` |
| 49 | + |
| 50 | +## Testing the code |
| 51 | + |
| 52 | +To run static tests of the code style, run the following command: |
| 53 | + |
| 54 | +``` |
| 55 | +make lint |
| 56 | +``` |
| 57 | + |
| 58 | +Unit tests are also included in the module. To execute these, run the following |
| 59 | +command from this directory: |
| 60 | + |
| 61 | +``` |
| 62 | +make test |
| 63 | +``` |
| 64 | + |
| 65 | +To run individual tests, run the following: |
| 66 | + |
| 67 | +``` |
| 68 | +(cd tests && ../env/bin/pytest <your_test>.py --cov=delphi_NAME --cov-report=term-missing) |
| 69 | +``` |
| 70 | + |
| 71 | +The output will show the number of unit tests that passed and failed, along |
| 72 | +with the percentage of code covered by the tests. |
| 73 | + |
| 74 | +None of the linting or unit tests should fail, and the code lines that are not covered by unit tests should be small and |
| 75 | +should not include critical sub-routines. |
0 commit comments