Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/actions/mkdocs-build/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: mkdocs-build
description: Build mkdocs
runs:
using: composite
steps:
- run: pipx install poetry
shell: bash
- uses: actions/setup-python@v5
with:
python-version: 3.10.12
- run: poetry install --only mkdocs
shell: bash
- run: poetry run mkdocs build
shell: bash
47 changes: 47 additions & 0 deletions .github/workflows/mkdocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: mkdocs
on:
pull_request:
push:
branches:
- main

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/mkdocs-build

deploy:
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}

runs-on: ubuntu-latest
needs: build

permissions:
contents: read
id-token: write
pages: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/mkdocs-build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: site
retention-days: "3"
- name: deploy to gh pages
uses: actions/deploy-pages@v4
with:
artifact_name: github-pages
preview: false
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ instance/
# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/
Expand Down Expand Up @@ -367,10 +364,6 @@ deps/downloads/
deps/usr/
deps/src/

# Build artifacts for creating documentation generated by the Documenter package
docs/build/
docs/site/

# File generated by Pkg, the package manager, based on a corresponding
# Project.toml It records a fixed state of all packages used by the project. As
# such, it should not be committed for packages, but should be committed for
Expand All @@ -382,3 +375,6 @@ docs/site/
tmp/
*/logs/
logs/

# mkdocs local build
site/
123 changes: 26 additions & 97 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,86 +14,39 @@ This project provides data tools and low friction access to versioned datasets w
- Utilities for time-stamping and template loading
- Data validation and quality checks
- Custom workflows
- Tooling for easy access to Socrata Open Data API (e.i., data.cdc.gov)
(copied and modified from [here](https://github.com/CDCgov/cfasodapy))
- Tooling for easy access to Socrata Open Data API (e.i., data.cdc.gov) (copied and modified from [here](https://github.com/CDCgov/cfasodapy))

## Getting started

To use this repository:

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

To add a new dataset:
1. Create a new TOML configuration file in `cfa/dataops/datasets/{team_dir}/`
2. Create a new ETL script in `cfa/dataops/etl/{team_dir}/`
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/)

## Deep Dive Documentation

- [Dataset Developer Guide](docs/dataset_developer.md)
- [Dataset User Guide](docs/dataset_user.md)

## Accessing Datasets

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:
- name: the name of the data source
- version: either 'latest' or string containing the datetime of required version. Default is 'latest'.
- type: either 'raw' or 'transformed'. Default is 'transformed'.
- output: the type of dataframe to output, either 'pandas' or 'polars'. Default is 'pandas'.

The available datasets can be found by running `list_datasets()`, which can be found in the `cfa.dataops.catalog` submodule.

An example for getting the polars dataframes for the latest raw versions of the covid19vax_trends and seroprevalence datasets is below:
```python
from cfa.dataops import get_data
vax_df = get_data("scenarios.covid19vax_trends", type = "transformed", output = "polars")
sero_df = get_data("scenarios.seroprevalence", type = "transformed", output = "polars")
```

## Running Workflows

This `cfa.dataops` repository contains a `workflows` module. The following workflows are currently available:
- covid

Workflows can be run in a python virtual environment terminal where `cfa.dataops` is installed with the following format:
```bash
python3 -m cfa.dataops.workflows.<name>.<module> --<args>
```

### Covid Workflow
There are two modules to the covid workflow with the following optional command line arguments:
- generate_data (this must be run before the next module)
- -p, --path: path to store generated data; default is covid/data. Not needed if -b flag is used.
- -b, --blob: whether to store generated data to Blob Storage (flag)
- run:
- -c, --config: path to intialization config
- -b, --blob: whether to pull from and push prepped data to Blob Storage (flag)

Ex:
```bash
python3 -m cfa.dataops.workflows.covid.generate_data -b
python3 -m cfa.dataops.workflows.covid.run -b
```
Read the [Dataset User Guide](docs/dataset_user.md) for more information about accessing datasets.

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.

## Project admins

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

---

## Disclaimers

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

### Public Domain Standard Notice

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.
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.

### License Standard Notice

This repository is licensed under ASL v2 or later.

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.
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.

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.
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.

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
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

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

### Privacy Standard Notice

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).
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).

### Contributing Standard Notice

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.
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.

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).
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).

### Records Management Standard Notice

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).
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).
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ The versioning pattern is `YYYY.MM.DD.micro(a/b/{none if release})

---

## [2025.08.14.0a]

- Updates to documentation
- Reduced Getting Started material in `README.md`
- Migration information that was in `README.md` to the developer guide
- Removed duplicated user guide that was at the bottom of the developer guide
- Add support for mkdocs
- Add CI to automatically serve/update the docs on GitHub Pages

## [2025.08.01.0a]

### Fixes
Expand Down
5 changes: 5 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# API reference

::: cfa.dataops.catalog.get_data

::: cfa.dataops.catalog.list_datasets
2 changes: 1 addition & 1 deletion docs/assets/badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading