Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 26, 2023
1 parent 73da571 commit 4906d76
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions reproschema/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ def serve(port):

start_server(port=port)


@main.command()
@click.argument('csv_path', type=click.Path(exists=True, dir_okay=False))
@click.argument('yaml_path', type=click.Path(exists=True, dir_okay=False))
@click.argument("csv_path", type=click.Path(exists=True, dir_okay=False))
@click.argument("yaml_path", type=click.Path(exists=True, dir_okay=False))
def redcap2reproschema(csv_path, yaml_path):
"""
Convert REDCap CSV files to Reproschema format.
Expand Down
10 changes: 8 additions & 2 deletions reproschema/redcap2reproschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import yaml
from bs4 import BeautifulSoup


def normalize_condition(condition_str):
re_parentheses = re.compile(r"\(([0-9]*)\)")
re_non_gt_lt_equal = re.compile(r"([^>|<])=")
Expand Down Expand Up @@ -451,9 +452,13 @@ def redcap2reproschema(csv_path, yaml_path, schema_context_url=None):
protocol_visibility_obj,
)


def main():
import argparse
parser = argparse.ArgumentParser(description="Convert REDCap data dictionary to Reproschema format.")

parser = argparse.ArgumentParser(
description="Convert REDCap data dictionary to Reproschema format."
)
parser.add_argument("csv_file", help="Path to the REDCap data dictionary CSV file.")
parser.add_argument("yaml_file", help="Path to the Reproschema protocol YAML file.")
args = parser.parse_args()
Expand All @@ -475,5 +480,6 @@ def main():
# Call the main conversion function
redcap2reproschema(args.csv_file, args.yaml_file)


if __name__ == "__main__":
main()
main()

0 comments on commit 4906d76

Please sign in to comment.