Skip to content

Commit 7123331

Browse files
committed
mkdocs setup
1 parent 70d9a64 commit 7123331

9 files changed

Lines changed: 285 additions & 150 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: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,31 @@ 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:
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())
27+
```
28+
4. See which versions of a dataset are available:
29+
```python
30+
print(cfa.dataops.datacat.scenarios.seroprevalence.load.get_versions())
31+
```
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()
36+
```
37+
38+
Read the [Dataset User Guide](docs/dataset_user.md) for more information about accessing datasets.
39+
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.
2341

24-
1. Clone the repository
2542
2. Install dependencies (**requires: `poetry >= 2.0`**):
2643
```
2744
poetry install
@@ -36,6 +53,7 @@ To use this repository:
3653
```
3754

3855
To add a new dataset:
56+
3957
1. Create a new TOML configuration file in `cfa/dataops/datasets/{team_dir}/`
4058
2. Create a new ETL script in `cfa/dataops/etl/{team_dir}/`
4159
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/)
@@ -48,6 +66,7 @@ To add a new dataset:
4866
## Accessing Datasets
4967

5068
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:
69+
5170
- name: the name of the data source
5271
- version: either 'latest' or string containing the datetime of required version. Default is 'latest'.
5372
- type: either 'raw' or 'transformed'. Default is 'transformed'.
@@ -56,6 +75,7 @@ When the ETL pipelines are run, the data sources (raw and/or transformed) are st
5675
The available datasets can be found by running `list_datasets()`, which can be found in the `cfa.dataops.catalog` submodule.
5776

5877
An example for getting the polars dataframes for the latest raw versions of the covid19vax_trends and seroprevalence datasets is below:
78+
5979
```python
6080
from cfa.dataops import get_data
6181
vax_df = get_data("scenarios.covid19vax_trends", type = "transformed", output = "polars")
@@ -65,29 +85,33 @@ sero_df = get_data("scenarios.seroprevalence", type = "transformed", output = "p
6585
## Running Workflows
6686

6787
This `cfa.dataops` repository contains a `workflows` module. The following workflows are currently available:
88+
6889
- covid
6990

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

7597
### Covid Workflow
98+
7699
There are two modules to the covid workflow with the following optional command line arguments:
100+
77101
- 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)
102+
- -p, --path: path to store generated data; default is covid/data. Not needed if -b flag is used.
103+
- -b, --blob: whether to store generated data to Blob Storage (flag)
80104
- run:
81-
- -c, --config: path to intialization config
82-
- -b, --blob: whether to pull from and push prepped data to Blob Storage (flag)
105+
- -c, --config: path to intialization config
106+
- -b, --blob: whether to pull from and push prepped data to Blob Storage (flag)
83107

84108
Ex:
109+
85110
```bash
86111
python3 -m cfa.dataops.workflows.covid.generate_data -b
87112
python3 -m cfa.dataops.workflows.covid.run -b
88113
```
89114

90-
91115
## Project admins
92116

93117
- Thomas Hladish <utx5@cdc.gov> (CDC/OD/ORR/CFA)
@@ -102,54 +126,30 @@ This repository was created for use by CDC programs to collaborate on public hea
102126

103127
### Public Domain Standard Notice
104128

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.
129+
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.
112130

113131
### License Standard Notice
114132

115133
This repository is licensed under ASL v2 or later.
116134

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.
135+
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.
120136

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.
137+
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.
124138

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
139+
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
127140

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

130143
### Privacy Standard Notice
131144

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).
145+
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).
137146

138147
### Contributing Standard Notice
139148

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.
149+
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.
147150

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).
151+
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).
150152

151153
### Records Management Standard Notice
152154

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

0 commit comments

Comments
 (0)