Skip to content

Commit ed9c279

Browse files
authored
Merge pull request #56 from djarecka/readme
a very quick update to Readme
2 parents fe38114 + d130243 commit ed9c279

File tree

2 files changed

+37
-31
lines changed

2 files changed

+37
-31
lines changed

README.md

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,39 @@
44

55
## Installation
66

7-
reproschema requires Python 3.7+.
7+
reproschema requires Python 3.10+.
88

99
```
1010
pip install reproschema
1111
```
1212

1313
### Developer installation
1414

15-
Install repo in developer mode:
15+
After you create a fork, you can clone and install repo in developer mode:
1616

1717
```
18-
git clone https://github.com/ReproNim/reproschema-py.git
18+
git clone https://github.com/<your github>/reproschema-py.git
1919
cd reproschema-py
2020
pip install -e .[dev]
2121
```
22+
#### Style
23+
This repo uses pre-commit to check styling.
24+
- Install pre-commit with pip: `pip install pre-commit`
25+
- In order to use it with the repository, you have to run `run pre-commit install` in the root directory the first time you use it.
2226

23-
It is also useful to install pre-commit, which takes care of styling when
24-
committing code. When pre-commit is used you may have to run git commit twice,
27+
When pre-commit is used you may have to run git commit twice,
2528
since pre-commit may make additional changes to your code for styling and will
26-
not commit these changes by default:
29+
not commit these changes by default.
30+
2731

28-
```
29-
pre-commit install
30-
```
3132
## CLI usage
3233

33-
This package installs `reproschema` a CLI.
34+
This package installs `reproschema` Command Line Interface (CLI).
3435

3536
```
36-
$ reproschema
37-
Usage: reproschema [OPTIONS] COMMAND [ARGS]...
37+
$ reproschema --help
3838
39-
A client to support interactions with ReproSchema
39+
$ A client to support interactions with ReproSchema
4040
4141
To see help for a specific command, run
4242
@@ -49,17 +49,18 @@ Options:
4949
--help Show this message and exit.
5050
5151
Commands:
52-
convert
52+
convert Converts a path to a different format, jsonld,...
5353
create
54-
redcap2reproschema Convert REDCap CSV files to Reproschema format.
55-
reproschema2redcap Convert reproschema protocol to REDCap CSV format.
54+
migrate Updates to a new reproschema version
55+
redcap2reproschema Converts REDCap CSV files to Reproschema format.
56+
reproschema2redcap Converts reproschema protocol to REDCap CSV format.
5657
serve
57-
validate
58+
validate Validates if the path has a valid reproschema format
5859
```
5960

60-
## `reproschema2redcap` Usage
61+
## `reproschema2redcap`
6162

62-
### Command-Line Usage
63+
### CLI Usage
6364

6465
You can use this feature directly from the command line. To convert ReproSchema protocol to REDCap CSV format, use the following command
6566

@@ -73,7 +74,7 @@ reproschema reproschema2redcap <input_dir_path> <output_csv_filename>
7374
cd reproschema-demo-protocol
7475
pwd
7576
```
76-
In this case, the output from `pwd` (which shows your current directory path)should be your `<input_dir_path>`.
77+
In this case, the output from `pwd` (which shows your current directory path) should be your `<input_dir_path>`.
7778
- `<output_csv_filename>`: The name of the output CSV file where the converted data will be saved.
7879

7980
### Python Function Usage
@@ -89,7 +90,7 @@ output_csv_filename = "output.csv"
8990
reproschema2redcap(input_dir_path, output_csv_filename)
9091
```
9192

92-
## `redcap2reproschema` Usage
93+
## `redcap2reproschema`
9394
The `redcap2reproschema` function is designed to process a given REDCap CSV file and YAML configuration to generate the output in the reproschema format.
9495

9596
### Prerequisites
@@ -111,13 +112,14 @@ protocol_name: "My_Protocol"
111112
protocol_display_name: "Assessment Protocol"
112113
protocol_description: "This protocol is for assessing cognitive skills."
113114
```
114-
### Command-Line Usage
115+
### CLI Usage
115116
116117
The `redcap2reproschema`` function has been integrated into a CLI tool, use the following command:
117118
```bash
118119
reproschema redcap2reproschema path/to/your_redcap_data_dic.csv path/to/your_redcap2rs.yaml
119120
```
120121

122+
Optionally you can provide a path to the output directory (defaults is the current directory) by adding option: `--output-path PATH`
121123
### Python Function Usage
122124

123125
You can also use the `redcap2reproschema` function from the `reproschema-py` package in your Python code.
@@ -127,15 +129,10 @@ from reproschema import redcap2reproschema
127129
128130
csv_path = "path-to/your_redcap_data_dic.csv"
129131
yaml_path = "path-to/your_redcap2rs.yaml"
132+
output_path = "path-to/directory_you_want_to_save_output"
130133
131-
reproschema2redcap(input_dir_path, output_csv_filename)
134+
reproschema2redcap(csv_file, yaml_file, output_path)
132135
```
133136

134-
After configuring the YAML file:
135-
136-
1. Run the Python script with the paths to your CSV file and the YAML file as arguments.
137-
2. Command Format: `python script_name.py path/to/your_redcap_data_dic.csv path/to/your_redcap2rs.yaml`
138-
139137
### Notes
140138
1. The script requires an active internet connection to access the GitHub repository.
141-
2. Make sure you use `git add`, `git commit`, `git push` properly afterwards to maintain a good version control for your converted data.

reproschema/cli.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def main(log_level):
4949
@main.command()
5050
@click.argument("path", nargs=1, type=str)
5151
def validate(path):
52+
"""
53+
Validates if the path has a valid reproschema format
54+
"""
5255
if not (path.startswith("http") or os.path.exists(path)):
5356
raise ValueError(
5457
f"{path} must be a URL or an existing file or directory"
@@ -69,6 +72,9 @@ def validate(path):
6972
help="Path to the fixed file/directory, if not provide suffix 'after_migration' is used",
7073
)
7174
def migrate(path, inplace, fixed_path):
75+
"""
76+
Updates to a new reproschema version
77+
"""
7278
if not (path.startswith("http") or os.path.exists(path)):
7379
raise ValueError(
7480
f"{path} must be a URL or an existing file or directory"
@@ -96,6 +102,9 @@ def migrate(path, inplace, fixed_path):
96102
)
97103
@click.argument("path", nargs=1, type=str)
98104
def convert(path, format, prefixfile, contextfile):
105+
"""
106+
Converts a path to a different format, jsonld, n-triples or turtle
107+
"""
99108
if not (path.startswith("http") or os.path.exists(path)):
100109
raise ValueError(
101110
f"{path} must be a URL or an existing file or directory"
@@ -148,7 +157,7 @@ def serve(port):
148157
)
149158
def redcap2reproschema(csv_path, yaml_path, output_path):
150159
"""
151-
Convert REDCap CSV files to Reproschema format.
160+
Converts REDCap CSV files to Reproschema format.
152161
"""
153162
try:
154163
redcap2rs(csv_path, yaml_path, output_path)
@@ -162,7 +171,7 @@ def redcap2reproschema(csv_path, yaml_path, output_path):
162171
@click.argument("output_csv_path", type=click.Path(writable=True))
163172
def reproschema2redcap(input_path, output_csv_path):
164173
"""
165-
Convert reproschema protocol to REDCap CSV format.
174+
Converts reproschema protocol to REDCap CSV format.
166175
"""
167176
# Convert input_path to a Path object
168177
input_path_obj = Path(input_path)

0 commit comments

Comments
 (0)