Skip to content

Commit 49224af

Browse files
authored
Merge 1b15255 into 70d9a64
2 parents 70d9a64 + 1b15255 commit 49224af

12 files changed

Lines changed: 445 additions & 455 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: mkdocs-build
2+
description: Build mkdocs
3+
runs:
4+
using: composite
5+
steps:
6+
- run: pipx install poetry
7+
shell: bash
8+
- uses: actions/setup-python@v5
9+
with:
10+
python-version: 3.10.12
11+
- run: poetry install --only mkdocs
12+
shell: bash
13+
- run: poetry run mkdocs build
14+
shell: bash

.github/workflows/mkdocs.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: mkdocs
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: ./.github/actions/mkdocs-build
18+
19+
deploy:
20+
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
21+
22+
runs-on: ubuntu-latest
23+
needs: build
24+
25+
permissions:
26+
contents: read
27+
id-token: write
28+
pages: write
29+
30+
environment:
31+
name: github-pages
32+
url: ${{ steps.deployment.outputs.page_url }}
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: ./.github/actions/mkdocs-build
37+
- name: Upload artifact
38+
uses: actions/upload-pages-artifact@v3
39+
with:
40+
name: github-pages
41+
path: site
42+
retention-days: "3"
43+
- name: deploy to gh pages
44+
uses: actions/deploy-pages@v4
45+
with:
46+
artifact_name: github-pages
47+
preview: false

.gitignore

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ instance/
113113
# Scrapy stuff:
114114
.scrapy
115115

116-
# Sphinx documentation
117-
docs/_build/
118-
119116
# PyBuilder
120117
.pybuilder/
121118
target/
@@ -367,10 +364,6 @@ deps/downloads/
367364
deps/usr/
368365
deps/src/
369366

370-
# Build artifacts for creating documentation generated by the Documenter package
371-
docs/build/
372-
docs/site/
373-
374367
# File generated by Pkg, the package manager, based on a corresponding
375368
# Project.toml It records a fixed state of all packages used by the project. As
376369
# such, it should not be committed for packages, but should be committed for
@@ -382,3 +375,6 @@ docs/site/
382375
tmp/
383376
*/logs/
384377
logs/
378+
379+
# mkdocs local build
380+
site/

README.md

Lines changed: 26 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -14,86 +14,39 @@ This project provides data tools and low friction access to versioned datasets w
1414
- Utilities for time-stamping and template loading
1515
- Data validation and quality checks
1616
- Custom workflows
17-
- Tooling for easy access to Socrata Open Data API (e.i., data.cdc.gov)
18-
(copied and modified from [here](https://github.com/CDCgov/cfasodapy))
17+
- Tooling for easy access to Socrata Open Data API (e.i., data.cdc.gov) (copied and modified from [here](https://github.com/CDCgov/cfasodapy))
1918

2019
## Getting started
2120

22-
To use this repository:
23-
24-
1. Clone the repository
25-
2. Install dependencies (**requires: `poetry >= 2.0`**):
26-
```
27-
poetry install
28-
```
29-
3. Example: run the COVID-19 vaccination trends ETL pipeline, with extraction, raw data schema validation (-v) and transformed data validation (-t).
30-
```
31-
python -m cfa.dataops.etl.covid19vax_trends --extract -v -t
21+
1. Clone the repository and install dependencies with `poetry install` (**requires `poetry >= 2.0`**)
22+
2. Ensure your have access to the relevant resources (e.g., `az login --identity`)
23+
3. See which datasets are available:
24+
```python
25+
import cfa.dataops
26+
print(cfa.dataops.list_datasets())
3227
```
33-
4. [Optional] installing developer dependencies:
28+
4. See which versions of a dataset are available:
29+
```python
30+
print(cfa.dataops.datacat.scenarios.seroprevalence.load.get_versions())
3431
```
35-
poetry install --with dev
32+
5. Get a specific version of a dataset:
33+
```python
34+
df = cfa.dataops.get_data(name="scenarios.seroprevalence", version="latest", output="polars")
35+
df.glimpse()
3636
```
3737

38-
To add a new dataset:
39-
1. Create a new TOML configuration file in `cfa/dataops/datasets/{team_dir}/`
40-
2. Create a new ETL script in `cfa/dataops/etl/{team_dir}/`
41-
3. Add SQL transformation templates in `cfa/dataops/etl/transform_templates/{team_dir}/` (is using SQL for transforms). These are [Mako templates](https://www.makotemplates.org/)
42-
43-
## Deep Dive Documentation
44-
45-
- [Dataset Developer Guide](docs/dataset_developer.md)
46-
- [Dataset User Guide](docs/dataset_user.md)
47-
48-
## Accessing Datasets
49-
50-
When the ETL pipelines are run, the data sources (raw and/or transformed) are stored into Azure Blob Storage. There will be times when we want to access these datasets directly. The function `get_data()` found in `cfa.dataops.datasets.catalog` helps retrieve that data, compile into a single dataframe, and return that dataframe. The parameters for `get_data()` are as follows:
51-
- name: the name of the data source
52-
- version: either 'latest' or string containing the datetime of required version. Default is 'latest'.
53-
- type: either 'raw' or 'transformed'. Default is 'transformed'.
54-
- output: the type of dataframe to output, either 'pandas' or 'polars'. Default is 'pandas'.
55-
56-
The available datasets can be found by running `list_datasets()`, which can be found in the `cfa.dataops.catalog` submodule.
57-
58-
An example for getting the polars dataframes for the latest raw versions of the covid19vax_trends and seroprevalence datasets is below:
59-
```python
60-
from cfa.dataops import get_data
61-
vax_df = get_data("scenarios.covid19vax_trends", type = "transformed", output = "polars")
62-
sero_df = get_data("scenarios.seroprevalence", type = "transformed", output = "polars")
63-
```
64-
65-
## Running Workflows
66-
67-
This `cfa.dataops` repository contains a `workflows` module. The following workflows are currently available:
68-
- covid
69-
70-
Workflows can be run in a python virtual environment terminal where `cfa.dataops` is installed with the following format:
71-
```bash
72-
python3 -m cfa.dataops.workflows.<name>.<module> --<args>
73-
```
74-
75-
### Covid Workflow
76-
There are two modules to the covid workflow with the following optional command line arguments:
77-
- generate_data (this must be run before the next module)
78-
- -p, --path: path to store generated data; default is covid/data. Not needed if -b flag is used.
79-
- -b, --blob: whether to store generated data to Blob Storage (flag)
80-
- run:
81-
- -c, --config: path to intialization config
82-
- -b, --blob: whether to pull from and push prepped data to Blob Storage (flag)
83-
84-
Ex:
85-
```bash
86-
python3 -m cfa.dataops.workflows.covid.generate_data -b
87-
python3 -m cfa.dataops.workflows.covid.run -b
88-
```
38+
Read the [Dataset User Guide](docs/dataset_user.md) for more information about accessing datasets.
8939

40+
Read the [Dataset Developer Guide](docs/dataset_developer.md) for information about how to run ETL to add new versions of an existing datasets and about how to create new datasets.
9041

9142
## Project admins
9243

9344
- Thomas Hladish <utx5@cdc.gov> (CDC/OD/ORR/CFA)
9445
- Phillip Rogers <ap66@cdc.gov> (CDC/OD/ORR/CFA)(CTR)
9546
- Ryan Raasch <xng3@cdc.gov> (CDC/OD/ORR/CFA)(CTR)
9647

48+
---
49+
9750
## Disclaimers
9851

9952
### General Disclaimer
@@ -102,54 +55,30 @@ This repository was created for use by CDC programs to collaborate on public hea
10255

10356
### Public Domain Standard Notice
10457

105-
This repository constitutes a work of the United States Government and is not
106-
subject to domestic copyright protection under 17 USC § 105. This repository is in
107-
the public domain within the United States, and copyright and related rights in
108-
the work worldwide are waived through the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/).
109-
All contributions to this repository will be released under the CC0 dedication. By
110-
submitting a pull request you are agreeing to comply with this waiver of
111-
copyright interest.
58+
This repository constitutes a work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105. This repository is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/). All contributions to this repository will be released under the CC0 dedication. By submitting a pull request you are agreeing to comply with this waiver of copyright interest.
11259

11360
### License Standard Notice
11461

11562
This repository is licensed under ASL v2 or later.
11663

117-
This source code in this repository is free: you can redistribute it and/or modify it under
118-
the terms of the Apache Software License version 2, or (at your option) any
119-
later version.
64+
This source code in this repository is free: you can redistribute it and/or modify it under the terms of the Apache Software License version 2, or (at your option) any later version.
12065

121-
This source code in this repository is distributed in the hope that it will be useful, but WITHOUT ANY
122-
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
123-
PARTICULAR PURPOSE. See the Apache Software License for more details.
66+
This source code in this repository is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache Software License for more details.
12467

125-
You should have received a copy of the Apache Software License along with this
126-
program. If not, see http://www.apache.org/licenses/LICENSE-2.0.html
68+
You should have received a copy of the Apache Software License along with this program. If not, see http://www.apache.org/licenses/LICENSE-2.0.html
12769

12870
The source code forked from other open source projects will inherit its license.
12971

13072
### Privacy Standard Notice
13173

132-
This repository contains only non-sensitive, publicly available data and
133-
information. All material and community participation is covered by the
134-
[Disclaimer](https://github.com/CDCgov/template/blob/master/DISCLAIMER.md)
135-
and [Code of Conduct](https://github.com/CDCgov/template/blob/master/code-of-conduct.md).
136-
For more information about CDC's privacy policy, please visit [http://www.cdc.gov/other/privacy.html](https://www.cdc.gov/other/privacy.html).
74+
This repository contains only non-sensitive, publicly available data and information. All material and community participation is covered by the [Disclaimer](https://github.com/CDCgov/template/blob/master/DISCLAIMER.md) and [Code of Conduct](https://github.com/CDCgov/template/blob/master/code-of-conduct.md). For more information about CDC's privacy policy, please visit [http://www.cdc.gov/other/privacy.html](https://www.cdc.gov/other/privacy.html).
13775

13876
### Contributing Standard Notice
13977

140-
Anyone is encouraged to contribute to the repository by [forking](https://help.github.com/articles/fork-a-repo)
141-
and submitting a pull request. (If you are new to GitHub, you might start with a
142-
[basic tutorial](https://help.github.com/articles/set-up-git).) By contributing
143-
to this project, you grant a world-wide, royalty-free, perpetual, irrevocable,
144-
non-exclusive, transferable license to all users under the terms of the
145-
[Apache Software License v2](http://www.apache.org/licenses/LICENSE-2.0.html) or
146-
later.
78+
Anyone is encouraged to contribute to the repository by [forking](https://help.github.com/articles/fork-a-repo) and submitting a pull request. (If you are new to GitHub, you might start with a [basic tutorial](https://help.github.com/articles/set-up-git).) By contributing to this project, you grant a world-wide, royalty-free, perpetual, irrevocable, non-exclusive, transferable license to all users under the terms of the [Apache Software License v2](http://www.apache.org/licenses/LICENSE-2.0.html) or later.
14779

148-
All comments, messages, pull requests, and other submissions received through
149-
CDC including this GitHub page may be subject to applicable federal law, including but not limited to the Federal Records Act, and may be archived. Learn more at [http://www.cdc.gov/other/privacy.html](http://www.cdc.gov/other/privacy.html).
80+
All comments, messages, pull requests, and other submissions received through CDC including this GitHub page may be subject to applicable federal law, including but not limited to the Federal Records Act, and may be archived. Learn more at [http://www.cdc.gov/other/privacy.html](http://www.cdc.gov/other/privacy.html).
15081

15182
### Records Management Standard Notice
15283

153-
This repository is not a source of government records but is a copy to increase
154-
collaboration and collaborative potential. All government records will be
155-
published through the [CDC web site](http://www.cdc.gov).
84+
This repository is not a source of government records but is a copy to increase collaboration and collaborative potential. All government records will be published through the [CDC web site](http://www.cdc.gov).

docs/api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# API reference
2+
3+
::: cfa.dataops.catalog.get_data
4+
5+
::: cfa.dataops.catalog.list_datasets

docs/assets/badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)