|
1 | 1 | # Covidcast Indicators
|
2 | 2 |
|
3 |
| -Pipeline code and supporting libraries for the **Real-time COVID-19 Indicators** used in the Delphi Group's [**COVIDcast** map](https://covidcast.cmu.edu). |
| 3 | +[![License: MIT][mit-image]][mit-url] |
4 | 4 |
|
5 |
| -## The indicators |
| 5 | +In early April 2020, Delphi developed a uniform data schema for [a new Epidata endpoint focused on COVID-19](https://cmu-delphi.github.io/delphi-epidata/api/covidcast.html). Our intent was to provide signals that would track in real-time and in fine geographic granularity all facets of the COVID-19 pandemic, aiding both nowcasting and forecasting. Delphi's long history in tracking and forecasting influenza made us uniquely situated to provide access to data streams not available anywhere else, including medical claims data, electronic medical records, lab test records, massive public surveys, and internet search trends. We also process commonly-used publicly-available data sources, both for user convenience and to provide data versioning for sources that do not track revisions themselves. |
6 | 6 |
|
7 |
| -Each subdirectory contained here that is named after an indicator has specific documentation. Please review as necessary! |
| 7 | +Each data stream arrives in a different format using a different delivery technique, be it sftp, an access-controlled API, or an email attachment. The purpose of each pipeline in this repository is to fetch the raw source data, extract informative aggregate signals, and output those signals---which we call **COVID-19 indicators**---in a common format for upload to the [COVIDcast API](https://cmu-delphi.github.io/delphi-epidata/api/covidcast.html). |
8 | 8 |
|
9 |
| -## General workflow for indicators creation and deployment |
| 9 | +For client access to the API, along with a variety of other utilities, see our [R](https://cmu-delphi.github.io/covidcast/covidcastR/) and [Python](https://cmu-delphi.github.io/covidcast/covidcast-py/html/) packages. |
10 | 10 |
|
11 |
| -**tl;dr** |
| 11 | +For interactive visualizations (of a subset of the available indicators), see our [COVIDcast map](https://covidcast.cmu.edu). |
12 | 12 |
|
13 |
| -1. Create your new indicator branch from `main`. |
14 |
| -2. Build it using the appropriate template, following the guidelines in the included README.md and REVIEW.md files. |
15 |
| -3. Make some stuff! |
16 |
| -4. When your stuff works, push your `dev-*` branch to remote for review. |
17 |
| -5. Consult with a platform engineer for the remaining production setup needs. They will create a branch called `deploy-*` for your indicator. |
18 |
| -6. Initiate a pull request against this new branch. |
19 |
| -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. |
20 |
| -8. If your peers like the code, the documentation is ready, and Jenkins approves, deploy your changes by merging the PR. |
21 |
| -9. Rejoice! |
| 13 | +## Organization |
22 | 14 |
|
23 |
| -### Starting out |
| 15 | +Utilities: |
| 16 | +* `_delphi_utils_python` - common behaviors |
| 17 | +* `_template_python` & `_template_r` - starting points for new data sources |
| 18 | +* `ansible` & `jenkins` - automated testing and deployment |
| 19 | +* `sir_complainsalot` - a Slack bot to check for missing data |
24 | 20 |
|
25 |
| -The `main` branch should contain up-to-date code and supporting libraries. This should be your starting point when creating a new indicator. |
| 21 | +Indicator pipelines: all remaining directories. |
26 | 22 |
|
27 |
| -```shell |
28 |
| -# Hint |
29 |
| -# |
30 |
| -git checkout main |
31 |
| -git checkout -b dev-my-feature-branch |
32 |
| -``` |
| 23 | +Each indicator pipeline includes its own documentation. |
33 | 24 |
|
34 |
| -### Creating your indicator |
| 25 | +* Consult README.md for directions to install, lint, test, and run the pipeline for that indicator. |
| 26 | +* Consult REVIEW.md for the checklist to use for code reviews. |
| 27 | +* Consult DETAILS.md (if present) for implementation details, including handling of corner cases. |
35 | 28 |
|
36 |
| -Create a directory for your new indicator by making a copy of `_template_r` or `_template_python` depending on the programming language you intend to use. The template copies of `README.md` and `REVIEW.md` include the minimum requirements for code structure, documentation, linting, testing, and method of configuration. Beyond that, we don't have any established restrictions on implementation; you can look at other existing indicators see some examples of code layout, organization, and general approach. |
37 | 29 |
|
38 |
| -- Consult your peers with questions! :handshake: |
| 30 | +## License |
39 | 31 |
|
40 |
| -Once you have something that runs locally and passes tests you set up your remote branch eventual review and production deployment. |
| 32 | +This repository is released under the **MIT License**. |
41 | 33 |
|
42 |
| -```shell |
43 |
| -# Hint |
44 |
| -# |
45 |
| -git push -u origin dev-my-feature-branch |
46 |
| -``` |
47 |
| - |
48 |
| -You can then set draft public API documentation for people who would fetch this |
49 |
| -data from the API. Public API documentation is kept in the delphi-epidata |
50 |
| -repository, and there is a [template Markdown |
51 |
| -file](https://github.com/cmu-delphi/delphi-epidata/blob/main/docs/api/covidcast-signals/_source-template.md) |
52 |
| -that outlines the features that need to be documented. You can create a pull |
53 |
| -request to add a new file to `docs/api/covidcast-signals/` for your source. Our |
54 |
| -goal is to have public API documentation for the data at the same time as it |
55 |
| -becomes available to the public. |
56 |
| - |
57 |
| -### Setting up for review and deployment |
58 |
| - |
59 |
| -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: |
60 |
| - |
61 |
| -- Creating the corresponding `deploy-*` branch in the repo. |
62 |
| -- Adding the necessary Jenkins scripts for your indicator. |
63 |
| -- Preparing the runtime host with any Automation configuration necessities. |
64 |
| -- Reviewing the workflow to make sure it meets the general guidelines and will run as expected on the runtime host. |
65 |
| - |
66 |
| -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. |
67 |
| - |
68 |
| -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. |
69 |
| - |
70 |
| -Hopefully it'll be a full on :tada:, after that :crossed_fingers: |
71 |
| - |
72 |
| -If not, circle back and try again. |
73 |
| - |
74 |
| -## Production overview |
75 |
| - |
76 |
| -### Running production code |
77 |
| - |
78 |
| -Currently, the production indicators all live and run on the venerable and perennially useful Delphi primary server (also known generically as "the runtime host"). |
79 |
| - |
80 |
| -- This is a virtual machine running RHEL 7.5 and living in CMU's Campus Cloud vSphere-based infrastructure environemnt. |
81 |
| - |
82 |
| -### Delivering an indicator to the production environment |
83 |
| - |
84 |
| -We use a branch-based git workflow coupled with [Jenkins](https://www.jenkins.io/) and [Ansible](https://www.ansible.com/) to build, test, package, and deploy each indicator individually to the runtime host. |
85 |
| - |
86 |
| -- Jenkins dutifully manages the whole process for us by executing several "stages" in the context of a [CI/CD pipeline](https://dzone.com/articles/learn-how-to-setup-a-cicd-pipeline-from-scratch). Each stage does something unique, building on the previous stage. The stages are: |
87 |
| - - Environment - Sets up some environment-specific needs that the other stages depend on. |
88 |
| - - Build - Create the Python venv on the Jenkins host. |
89 |
| - - Test - Run linting and unit tests. |
90 |
| - - Package - Tar and gzip the built environment. |
91 |
| - - Deploy - Trigger an Ansible playbook to place the built package onto the runtime host, place any necessary production configuration, and adjust the runtime envirnemnt (if necessary). |
92 |
| - |
93 |
| -There are several additional Jenkins-specific files that will need to be created for each indicator, as well as some configuration additions to the runtime host. It will be important to pair with a platform engineer to prepare the necessary production environment needs, test the workflow, validate on production, and ultimately sign off on a production release. |
| 34 | +[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg |
| 35 | +[mit-url]: https://opensource.org/licenses/MIT |
0 commit comments