Skip to content

Commit a9e735c

Browse files
authored
Merge pull request #98 from Veronika271/main
Created a docs version of the ReadMe file.
2 parents a8785e6 + 7aca161 commit a9e735c

File tree

12 files changed

+301
-1
lines changed

12 files changed

+301
-1
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish docs via GitHub Pages
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
build:
9+
name: Deploy docs
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout main
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.10'
21+
22+
- name: Install dependencies
23+
run: |
24+
pip install mkdocs mkdocs-material
25+
26+
- name: Deploy docs
27+
run: |
28+
mkdocs gh-deploy --force --clean
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ env:
1212
jobs:
1313
auto-release:
1414
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
issues: write
1519
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
1620
steps:
1721
- uses: actions/checkout@v3
@@ -40,4 +44,4 @@ jobs:
4044
run: |
4145
~/auto shipit -vv
4246
env:
43-
GH_TOKEN: ${{ secrets.AUTO_TOKEN }}
47+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,7 @@ dmypy.json
135135
# Pycharm
136136
.idea/
137137

138+
.serena/
139+
138140
# Internal documentation
139141
internal/

CLAUDE.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
ReproSchema Python library and CLI for working with ReproSchema format - a standardized way to represent assessments, questionnaires, and protocols used in research. The library provides validation, conversion utilities, and integrations with REDCap and FHIR.
8+
9+
## Key Commands
10+
11+
### Development Setup
12+
```bash
13+
# Install in development mode
14+
pip install -e .
15+
16+
# Install with all development dependencies
17+
pip install -e ".[dev]"
18+
19+
# Run pre-commit hooks
20+
pre-commit install
21+
pre-commit run --all-files
22+
```
23+
24+
### Testing
25+
```bash
26+
# Run tests with coverage
27+
pytest --cov=reproschema
28+
29+
# Run specific test file
30+
pytest reproschema/tests/test_validate.py
31+
32+
# Run tests in parallel
33+
pytest -n auto
34+
```
35+
36+
### Linting and Formatting
37+
```bash
38+
# Format code with black
39+
black reproschema/
40+
41+
# Run flake8 linter
42+
flake8 reproschema/
43+
44+
# Sort imports
45+
isort reproschema/
46+
47+
# Check spelling
48+
codespell
49+
```
50+
51+
## Architecture
52+
53+
### Core Modules
54+
55+
- **reproschema/cli.py**: Main CLI entry point using Click framework. Provides commands for validation, conversion, migration.
56+
- **reproschema/models/model.py**: Pydantic models auto-generated from LinkML schema. DO NOT modify directly - changes should be made in ReproNim/reproschema repository.
57+
- **reproschema/validate.py**: Schema validation using PyShacl
58+
- **reproschema/redcap2reproschema.py**: Convert REDCap CSV to ReproSchema format
59+
- **reproschema/reproschema2redcap.py**: Convert ReproSchema to REDCap CSV format
60+
- **reproschema/reproschema2fhir.py**: Convert ReproSchema to FHIR Questionnaire resources
61+
- **reproschema/output2redcap.py**: Process reproschema-ui output into REDCap CSV
62+
63+
### Conversion Workflows
64+
65+
1. **REDCap → ReproSchema**: Requires CSV data dictionary + YAML config file
66+
2. **ReproSchema → REDCap**: Takes protocol directory, outputs CSV
67+
3. **ReproSchema → FHIR**: Converts activities/items to FHIR Questionnaire
68+
4. **UI Output → REDCap**: Processes survey responses to REDCap format
69+
70+
## CLI Commands
71+
72+
- `reproschema validate <path>` - Validate ReproSchema format
73+
- `reproschema redcap2reproschema <csv> <yaml>` - Convert REDCap to ReproSchema
74+
- `reproschema reproschema2redcap <input_dir> <output_csv>` - Convert ReproSchema to REDCap
75+
- `reproschema reproschema2fhir <input_dir> <output_dir>` - Convert to FHIR
76+
- `reproschema output2redcap <input_dir> <output_dir>` - Process UI output
77+
- `reproschema migrate <path>` - Migrate to new schema version
78+
- `reproschema convert` - Convert between formats (jsonld, n-triples, turtle)
79+
80+
## Important Notes
81+
82+
- Python 3.10+ required
83+
- The Pydantic models in `reproschema/models/model.py` are auto-generated - DO NOT edit directly
84+
- All schema changes must be made in the LinkML source at ReproNim/reproschema repository
85+
- Uses pre-commit for code quality - commits may require running twice
86+
- Line length limit: 79 characters (enforced by black)

docs/cli_usage.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## CLI usage
2+
3+
This package installs `reproschema` Command Line Interface (CLI).
4+
5+
```
6+
$ reproschema --help
7+
8+
$ A client to support interactions with ReproSchema
9+
10+
To see help for a specific command, run
11+
12+
reproschema COMMAND --help e.g. reproschema validate --help
13+
14+
Options:
15+
--version
16+
-l, --log-level [DEBUG|INFO|WARNING|ERROR|CRITICAL]
17+
Log level name [default: INFO]
18+
--help Show this message and exit.
19+
20+
Commands:
21+
convert Converts a path to a different format, jsonld,...
22+
create
23+
migrate Updates to a new reproschema version
24+
redcap2reproschema Converts REDCap CSV files to Reproschema format.
25+
reproschema2redcap Converts reproschema protocol to REDCap CSV format.
26+
serve
27+
validate Validates if the path has a valid reproschema format
28+
reproschema2fhir Generates FHIR questionnaire resources from reproschema activities
29+
output2redcap Generates redcap csv given the audio and survey data from reproschema ui
30+
```

docs/index.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Welcome to Reproschema-py
2+
3+
For full documentation visit [Reproschema-py](https://github.com/ReproNim/reproschema-py).
4+
reproschema requires Python 3.10+
5+
6+
## Project layout
7+
mkdocs.yml # The configuration file.
8+
docs/
9+
index.md # The documentation homepage.
10+
installation.md #A tutorial for installation.
11+
cli_usage.md #Notes on CLI usage
12+
reproschema2redcap.md #How to convert from reproschema to redcap
13+
redcap2reproschema.md #How to convert from redcap to reproschema
14+
output2redcap.md #How to convert the output into redcap
15+
reproschema2fhir.md #How to convert the reproschema into an FHIR Questionnaire Resource

docs/installation.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Installation
2+
3+
Use the following command to install reproschema:
4+
5+
```
6+
pip install reproschema
7+
```
8+
9+
### Developer installation
10+
11+
Fork this repo to your own GitHub account, then clone and install your forked repo in the developer mode:
12+
13+
```
14+
git clone https://github.com/<your github>/reproschema-py.git
15+
cd reproschema-py
16+
pip install -e .
17+
```
18+
#### Style
19+
This repo uses pre-commit to check styling.
20+
- Install pre-commit with pip: `pip install pre-commit`
21+
- In order to use it with the repository, you have to run `pre-commit install` in the root directory the first time you use it.
22+
23+
When pre-commit is used, you may have to run git commit twice,
24+
since pre-commit may make additional changes to your code for styling and will
25+
not commit these changes by default.

docs/output2redcap.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## `output2redcap`
2+
The `output2redcap` function is designed to process the output from reproschema-ui into a REDCap CSV file as seen [here](reproschema/example/redcap).
3+
4+
5+
### CLI Usage
6+
7+
The `output2redcap` function has been integrated into a CLI tool, use the following command:
8+
```bash
9+
reproschema output2redcap ./path/to/your_reproschema-ui_files ./path/to/directory_you_want_to_save_output
10+
```

docs/redcap2reproschema.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## `redcap2reproschema`
2+
The `redcap2reproschema` function is designed to process a given REDCap CSV file and YAML configuration to generate the output in the reproschema format.
3+
4+
### Prerequisites
5+
Before the conversion, ensure you have the following:
6+
7+
**YAML Configuration File**:
8+
- Download [templates/redcap2rs.yaml](templates/redcap2rs.yaml) and fill it out with your protocol details.
9+
10+
### YAML File Configuration
11+
In the `templates/redcap2rs.yaml` file, provide the following information:
12+
13+
- **protocol_name**: A unique identifier for your protocol. Use underscores for spaces and avoid special characters.
14+
- **protocol_display_name**: Name that will appear in the application.
15+
- **protocol_description**: A brief description of your protocol.
16+
- **redcap_version**: Version of your redcap file (you can customize it).
17+
18+
Example:
19+
```yaml
20+
protocol_name: "My_Protocol"
21+
protocol_display_name: "Assessment Protocol"
22+
protocol_description: "This protocol is for assessing cognitive skills."
23+
redcap_version: "X.XX.X"
24+
```
25+
### CLI Usage
26+
27+
The `redcap2reproschema` function has been integrated into a CLI tool, use the following command:
28+
```bash
29+
reproschema redcap2reproschema path/to/your_redcap_data_dic.csv path/to/your_redcap2rs.yaml
30+
```
31+
32+
Optionally you can provide a path to the output directory (default is the current directory) by adding the option: `--output-path PATH`
33+
### Python Function Usage
34+
35+
You can also use the `redcap2reproschema` function from the `reproschema-py` package in your Python code.
36+
37+
```python
38+
from reproschema import redcap2reproschema
39+
40+
csv_path = "path-to/your_redcap_data_dic.csv"
41+
yaml_path = "path-to/your_redcap2rs.yaml"
42+
output_path = "path-to/directory_you_want_to_save_output"
43+
44+
redcap2reproschema(csv_path, yaml_path, output_path)
45+
```

docs/reproschema2fhir.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## `reproschema2fhir`
2+
The `reproschema2fhir` function is designed to convert reproschema activities and items into a FHIR Questionnaire resource as seen [here](reproschema/example/fhir).
3+
4+
### CLI Usage
5+
6+
The `reproschema2fhir` function has been integrated into a CLI tool, use the following command:
7+
```bash
8+
reproschema reproschema2fhir ./path/to/your_reproschema_activities ./path/to/directory_you_want_to_save_output
9+
```
10+
### Notes
11+
1. The script requires an active internet connection to access the GitHub repository.

0 commit comments

Comments
 (0)