Skip to content

Commit dea1e11

Browse files
Merge pull request #82 from PopHIVE/feat/claude-skills-mmr-epic
feat: add Claude skills and mmr_epic data source
2 parents b759732 + 4deda28 commit dea1e11

File tree

8 files changed

+215
-1
lines changed

8 files changed

+215
-1
lines changed

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
"Bash(cmd.exe /c \"Rscript -e \"\"dcf::dcf_check\\(\\)\"\"\")",
4242
"Bash(cmd.exe /c \"cd /d \"\"c:\\\\Users\\\\DMW63\\\\OneDrive - Yale University\\\\Desktop\\\\R_Projects\\\\POPHIVE PROJECT\\\\ingest\"\" && \"\"C:\\\\Program Files\\\\R\\\\R-4.3.0\\\\bin\\\\Rscript.exe\"\" -e \"\"dcf::dcf_check\\(\\)\"\"\")",
4343
"Bash(\"C:/Program Files/R/R-4.4.2/bin/Rscript.exe\" -e \"dcf::dcf_add_source\\(''schoolvax_washpost''\\)\")",
44-
"Bash(gzip:*)"
44+
"Bash(gzip:*)",
45+
"Bash(git checkout:*)",
46+
"Bash(git stash:*)"
4547
]
4648
}
4749
}

.claude/skills/add-source.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# add-source
2+
3+
Add a new data source to the PopHIVE/Ingest repository.
4+
5+
## Usage
6+
7+
```
8+
/add-source <source_name>
9+
```
10+
11+
## Description
12+
13+
Creates a new data source folder structure using `dcf::dcf_add_source()`. This initializes all required files and directories for a new data ingestion pipeline.
14+
15+
## Instructions
16+
17+
When the user invokes this skill with a source name:
18+
19+
1. **Validate the source name**:
20+
- Must be lowercase with underscores (e.g., `cdc_flu_data`, `epic_diabetes`)
21+
- No spaces or special characters
22+
- Should be descriptive of the data source
23+
24+
2. **Detect the R installation** (Windows only):
25+
First, find available R versions:
26+
```bash
27+
powershell -Command "Get-ChildItem 'C:\Program Files\R' | Select-Object Name"
28+
```
29+
Use the most recent version found (e.g., `R-4.3.0`).
30+
31+
3. **Run the dcf command** from the project root:
32+
```r
33+
dcf::dcf_add_source("<source_name>")
34+
```
35+
36+
**On Windows**, use PowerShell with the detected R version:
37+
```bash
38+
cd "<project_root>" && powershell -Command "& 'C:\Program Files\R\<R_VERSION>\bin\Rscript.exe' -e \"dcf::dcf_add_source('<source_name>')\""
39+
```
40+
Replace `<R_VERSION>` with the detected version (e.g., `R-4.3.0`).
41+
42+
**On macOS/Linux**, use:
43+
```bash
44+
cd "<project_root>" && Rscript -e 'dcf::dcf_add_source("<source_name>")'
45+
```
46+
47+
4. **Verify the created structure**:
48+
The command should create:
49+
```
50+
data/<source_name>/
51+
├── raw/ # For downloaded source files
52+
├── standard/ # For standardized output files
53+
├── ingest.R # Transformation script (needs editing)
54+
├── measure_info.json # Variable metadata (needs editing)
55+
└── process.json # Processing state (auto-generated)
56+
```
57+
58+
5. **Report success** and remind the user of next steps:
59+
- Edit `ingest.R` to implement the data transformation
60+
- Edit `measure_info.json` to document variables
61+
- Follow the templates in CLAUDE.md
62+
63+
## Example
64+
65+
User: `/add-source wastewater_influenza`
66+
67+
Response: Create the data source folder, then provide guidance on next steps.

.claude/skills/commit-push-pr.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Commit, Push, and Create PR
2+
3+
Automate the git workflow for completing a feature or fix.
4+
5+
## Usage
6+
7+
```
8+
/commit-push-pr [optional commit message]
9+
```
10+
11+
## Pre-computed Context
12+
13+
Before proceeding, gather this information:
14+
- Current branch: `git branch --show-current`
15+
- Git status: `git status --short`
16+
- Recent commits on this branch: `git log --oneline -5`
17+
- Diff summary: `git diff --stat`
18+
19+
## Workflow
20+
21+
1. **Review Changes**
22+
- Check `git status` for all modified/added files
23+
- Review the diff to understand what's being committed
24+
- Ensure no sensitive files are staged (.env, credentials, etc.)
25+
26+
2. **Run Pre-commit Checks** (if applicable)
27+
- For R files: Check syntax with `Rscript -e "parse(file='<file>')"`
28+
- Verify data files are compressed (.csv.gz, .parquet)
29+
30+
3. **Stage and Commit**
31+
- Stage relevant files: `git add <files>`
32+
- Create a commit with Conventional Commits format:
33+
- `feat:` for new features (new data sources, new bundles)
34+
- `fix:` for bug fixes (data corrections, pipeline fixes)
35+
- `docs:` for documentation (CLAUDE.md, README updates)
36+
- `refactor:` for refactoring (code cleanup)
37+
- `data:` for data updates (new raw data, re-processed outputs)
38+
- `chore:` for maintenance (dependency updates)
39+
- Write a clear, concise commit message focusing on "why"
40+
- Include co-author line: `Co-Authored-By: Claude <noreply@anthropic.com>`
41+
42+
4. **Push to Remote**
43+
- Push the branch: `git push -u origin HEAD`
44+
- If branch doesn't exist on remote, create it
45+
46+
5. **Create Pull Request**
47+
- Use GitHub CLI: `gh pr create`
48+
- Include:
49+
- Clear title summarizing the change
50+
- Description with summary and context
51+
- Reference any related issues
52+
- Format PR body with:
53+
```
54+
## Summary
55+
<1-3 bullet points>
56+
57+
## Test plan
58+
[Bulleted checklist of testing steps]
59+
60+
🤖 Generated with [Claude Code](https://claude.ai/code)
61+
```
62+
63+
## Arguments
64+
65+
Pass a commit message or leave empty for auto-generated message based on changes.
66+
67+
Example: `/commit-push-pr feat: add mmr_epic data source`
68+
69+
## Output
70+
71+
Return the PR URL when complete.

data/mmr_epic/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# mmr_epic
2+
3+
This is a dcf data source project, initialized with `dcf::dcf_add_source`.
4+
5+
You can us the `dcf` package to check the project:
6+
7+
```R
8+
dcf_check_source("mmr_epic", "..")
9+
```
10+
11+
And process it:
12+
13+
```R
14+
dcf_process("mmr_epic", "..")
15+
```

data/mmr_epic/ingest.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# Download
3+
#
4+
5+
# add files to the `raw` directory
6+
7+
#
8+
# Reformat
9+
#
10+
11+
# read from the `raw` directory, and write to the `standard` directory
12+

data/mmr_epic/measure_info.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"example_variable": {
3+
"id": "example_variable",
4+
"short_name": "",
5+
"long_name": "",
6+
"category": "",
7+
"short_description": "",
8+
"long_description": "",
9+
"statement": "",
10+
"measure_type": "",
11+
"unit": "",
12+
"time_resolution": "",
13+
"restrictions": "",
14+
"sources": [],
15+
"citations": []
16+
}
17+
}

data/mmr_epic/process.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "mmr_epic",
3+
"type": "source",
4+
"scripts": [
5+
{
6+
"path": "ingest.R",
7+
"manual": false,
8+
"frequency": 0,
9+
"last_run": "",
10+
"run_time": "",
11+
"last_status": {
12+
"log": "",
13+
"success": true
14+
}
15+
}
16+
],
17+
"checked": "",
18+
"check_results": []
19+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "mmr_epic",
3+
"title": "Mmr Epic",
4+
"licence": {
5+
"url": "http://opendatacommons.org/licenses/pddl",
6+
"name": "Open Data Commons Public Domain",
7+
"version": "1.0",
8+
"id": "odc-pddl"
9+
},
10+
"resources": []
11+
}

0 commit comments

Comments
 (0)