Skip to content

Commit cf522d4

Browse files
committed
Merge branch 'nans_cdc_covidnet' of https://github.com/dshemetov/covidcast-indicators into nans_cdc_covidnet
2 parents 80134af + aefab74 commit cf522d4

File tree

182 files changed

+16339
-34107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+16339
-34107
lines changed

.github/CONTRIBUTING.md

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
* `main`
66

7-
The primary/authoritative branch of this repository is called `main`, and contains up-to-date code and supporting libraries. This should be your starting point when creating a new indicator. It is protected so that only reviewed pull requests can be merged in.
7+
The primary branch of this repository is called `main`, and contains the version of the code and supporting libraries currently under development. This should be your starting point when creating a new indicator. It is protected so that only reviewed pull requests can be merged in. The main branch is configured to deploy to our staging environment on push. CI is set up to build and test all indicators on PR.
88

9-
* `deploy-*`
9+
* `prod`
1010

11-
Each automated pipeline has a corresponding branch which automatically deploys to a runtime host which runs the pipeline at a designated time each day. New features and bugfixes are merged into this branch using a pull request, so that our CI system can run the lint and test cycles and make sure the package will run correctly on the runtime host. If an indicator does not have a branch named after it starting with `deploy-`, that means the indicator has not yet been automated, and has a designated human keeper who is responsible for making sure the indicator runs each day -- whether that is manually or using a scheduler like cron is the keeper's choice.
11+
The production branch is configured to automatically deploy to our production environment on push, and is protected so that only administrators can push or merge. CI is set up to build and test all indicators on PR.
1212

1313
* everything else
1414

@@ -22,15 +22,6 @@ If you ensure that each issue deals with a single topic (ie a single new propose
2222

2323
Admins will assign issues to one or more people based on balancing expediency, expertise, and team robustness. It may be faster for one person to fix something, but we can reduce the risk of having too many single points of failure if two people work on it together.
2424

25-
## Project Boards
26-
27-
The Delphi Engineering team uses project boards to structure its weekly calls and track active tasks.
28-
29-
Immediate work is tracked on [Release Planning](https://github.com/cmu-delphi/covidcast-indicators/projects/2)
30-
31-
Long-term work and modeling collaborations are tracked on [Refactoring](https://github.com/cmu-delphi/covidcast-indicators/projects/3)
32-
33-
3425
## General workflow for indicators creation and deployment
3526

3627
So, how does one go about developing a pipeline for a new data source?
@@ -40,13 +31,11 @@ So, how does one go about developing a pipeline for a new data source?
4031
1. Create your new indicator branch from `main`.
4132
2. Build it using the appropriate template, following the guidelines in the included README.md and REVIEW.md files.
4233
3. Make some stuff!
43-
4. When your stuff works, push your `dev-*` branch to remote for review.
44-
5. Consult with a platform engineer for the remaining production setup needs. They will create a branch called `deploy-*` for your indicator.
45-
6. Initiate a pull request against this new branch.
46-
7. Following [the source documentation template](https://github.com/cmu-delphi/delphi-epidata/blob/main/docs/api/covidcast-signals/_source-template.md), create public API documentation for the source. You can submit this as a pull request against the delphi-epidata repository.
47-
8. If your peers like the code, the documentation is ready, and Jenkins approves, deploy your changes by merging the PR.
48-
9. An admin will propagate your successful changes to `main`.
49-
10. Rejoice!
34+
4. When your stuff works, push your development branch to remote, and open a PR against `main` for review.
35+
5. Once your PR has been merged, consult with a platform engineer for the remaining production setup needs. They will create a deployment workflow for your indicator including any necessary production parameters. Production secrets are encrypted in the Ansible vault. This workflow will be tested in staging by admins, who will consult you about any problems they encounter.
36+
6. Following [the source documentation template](https://github.com/cmu-delphi/delphi-epidata/blob/main/docs/api/covidcast-signals/_source-template.md), create public API documentation for the source. You can submit this as a pull request against the delphi-epidata repository.
37+
7. If your peers like the code, the documentation is ready, and the staging runs are successful, work with admins to schedule your indicator in production, merge the documentation, and announce the new indicator to the mailing list.
38+
8. Rejoice!
5039

5140
### Starting out
5241

@@ -86,12 +75,11 @@ becomes available to the public.
8675

8776
Once you have your branch set up you should get in touch with a platform engineer to pair up on the remaining production needs. These include:
8877

89-
- Creating the corresponding `deploy-*` branch in the repo.
9078
- Adding the necessary Jenkins scripts for your indicator.
9179
- Preparing the runtime host with any Automation configuration necessities.
9280
- Reviewing the workflow to make sure it meets the general guidelines and will run as expected on the runtime host.
9381

94-
Once all the last mile configuration is in place you can create a pull request against the correct `deploy-*` branch to initiate the CI/CD pipeline which will build, test, and package your indicator for deployment.
82+
Once all the last mile configuration is in place you can create a pull request against `prod` to initiate the CI/CD pipeline which will build, test, and package your indicator for deployment.
9583

9684
If everything looks ok, you've drafted source documentation, platform engineering has validated the last mile, and the pull request is accepted, you can merge the PR. Deployment will start automatically.
9785

.github/workflows/python-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
if: github.event.pull_request.draft == false
1717
strategy:
1818
matrix:
19-
packages: [_delphi_utils_python, cdc_covidnet, changehc, claims_hosp, combo_cases_and_deaths, covid_act_now, doctor_visits, google_symptoms, hhs_hosp, hhs_facilities, jhu, nchs_mortality, nowcast, quidel, quidel_covidtest, safegraph, safegraph_patterns, usafacts]
19+
packages: [_delphi_utils_python, changehc, claims_hosp, combo_cases_and_deaths, covid_act_now, doctor_visits, google_symptoms, hhs_hosp, hhs_facilities, jhu, nchs_mortality, nowcast, quidel, quidel_covidtest, safegraph, safegraph_patterns, usafacts]
2020
defaults:
2121
run:
2222
working-directory: ${{ matrix.packages }}

_delphi_utils_python/DEVELOP.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# DELPHI Common Utility Functions (Python)
2+
3+
This directory contains the Python module `delphi_utils`. It includes a number of
4+
common functions that are useful across multiple indicators.
5+
6+
## Installing the Module
7+
8+
To install the module in your default version of Python, run the
9+
following from this directory:
10+
11+
```
12+
pip install .
13+
```
14+
15+
As described in each of the indicator code directories, you will want to install
16+
this module within a virtual environment when testing the various code bases.
17+
18+
### Testing the code
19+
20+
To do a static test of the code style, it is recommended to run **pylint** on
21+
the module. To do this, run the following from the main module directory:
22+
23+
```
24+
pylint delphi_utils
25+
```
26+
27+
The most aggressive checks are turned off; only relatively important issues
28+
should be raised and they should be manually checked (or better, fixed).
29+
30+
Unit tests are also included in the module. These should be run by first
31+
installing the module into a virtual environment:
32+
33+
```
34+
python -m venv env
35+
source env/bin/activate
36+
pip install .
37+
```
38+
39+
And then running the unit tests with:
40+
41+
```
42+
(cd tests && ../env/bin/pytest --cov=delphi_utils --cov-report=term-missing)
43+
```
44+
45+
The output will show the number of unit tests that passed and failed, along
46+
with the percentage of code covered by the tests. None of the tests should
47+
fail and the code lines that are not covered by unit tests should be small and
48+
should not include critical sub-routines.
49+
50+
When you are finished, the virtual environment can be deactivated and
51+
(optionally) removed.
52+
53+
```
54+
deactivate
55+
rm -r env
56+
```

_delphi_utils_python/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2021 The Delphi Group at Carnegie Mellon University
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

_delphi_utils_python/README.md

Lines changed: 21 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,21 @@
1-
# DELPHI Common Utility Functions (Python)
2-
3-
This director contains the Python module `delphi_utils`. It includes a number of
4-
common functions that are useful across multiple indicators.
5-
6-
## Installing the Module
7-
8-
To install the module in your default version of Python, run the
9-
following from this directory:
10-
11-
```
12-
pip install .
13-
```
14-
15-
As described in each of the indicator code directories, you will want to install
16-
this module within a virtual environment when testing the various code bases.
17-
18-
### Testing the code
19-
20-
To do a static test of the code style, it is recommended to run **pylint** on
21-
the module. To do this, run the following from the main module directory:
22-
23-
```
24-
pylint delphi_utils
25-
```
26-
27-
The most aggressive checks are turned off; only relatively important issues
28-
should be raised and they should be manually checked (or better, fixed).
29-
30-
Unit tests are also included in the module. These should be run by first
31-
installing the module into a virtual environment:
32-
33-
```
34-
python -m venv env
35-
source env/bin/activate
36-
pip install .
37-
```
38-
39-
And then running the unit tests with:
40-
41-
```
42-
(cd tests && ../env/bin/pytest --cov=delphi_utils --cov-report=term-missing)
43-
```
44-
45-
The output will show the number of unit tests that passed and failed, along
46-
with the percentage of code covered by the tests. None of the tests should
47-
fail and the code lines that are not covered by unit tests should be small and
48-
should not include critical sub-routines.
49-
50-
When you are finished, the virtual environment can be deactivated and
51-
(optionally) removed.
52-
53-
```
54-
deactivate
55-
rm -r env
56-
```
1+
# Delphi Python Utilities
2+
3+
This package provides various utilities used by the [Delphi group](https://delphi.cmu.edu/) at [Carnegie Mellon
4+
University](https://www.cmu.edu) for its data pipelines and analyses.
5+
6+
Submodules:
7+
- `archive`: Diffing and archiving CSV files.
8+
- `export`: DataFrame to CSV export.
9+
- `geomap`: Mappings between geographic resolutions.
10+
- `logger`: Structured JSON logger.
11+
- `nancodes`: Enum constants encoding not-a-number cases.
12+
- `runner`: Orchestrator for running an indicator pipeline.
13+
- `signal`: Indicator (signal) naming.
14+
- `slack_notifier`: Slack notification integration.
15+
- `smooth`: Data smoothing functions.
16+
- `utils`: JSON parameter interactions.
17+
- `validator`: Data sanity checks and anomaly detection.
18+
19+
20+
Source code can be found here:
21+
[https://github.com/cmu-delphi/covidcast-indicators/](https://github.com/cmu-delphi/covidcast-indicators/)

0 commit comments

Comments
 (0)