{"id":23442308,"url":"https://github.com/repronim/reproschema-py","last_synced_at":"2025-04-13T11:11:12.471Z","repository":{"id":37958307,"uuid":"273970441","full_name":"ReproNim/reproschema-py","owner":"ReproNim","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-20T04:08:15.000Z","size":395,"stargazers_count":2,"open_issues_count":17,"forks_count":9,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-03-27T02:21:28.111Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ReproNim.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-21T19:28:29.000Z","updated_at":"2025-03-20T04:07:44.000Z","dependencies_parsed_at":"2024-06-24T09:11:03.959Z","dependency_job_id":"7eb88125-1e18-46f3-8cf1-02e3a79b6322","html_url":"https://github.com/ReproNim/reproschema-py","commit_stats":{"total_commits":54,"total_committers":6,"mean_commits":9.0,"dds":"0.35185185185185186","last_synced_commit":"31094edf51d3d5d15b453f478436fff005a7d06d"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReproNim%2Freproschema-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReproNim%2Freproschema-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReproNim%2Freproschema-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReproNim%2Freproschema-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ReproNim","download_url":"https://codeload.github.com/ReproNim/reproschema-py/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248703198,"owners_count":21148118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-23T17:29:21.340Z","updated_at":"2025-04-13T11:11:12.454Z","avatar_url":"https://github.com/ReproNim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Python package](https://github.com/ReproNim/reproschema-py/actions/workflows/package.yml/badge.svg)\n\n# Reproschema Python library and Command Line Interface (CLI)\n\n## Installation\n\nreproschema requires Python 3.10+.\n\n```\npip install reproschema\n```\n\n### Developer installation\n\nFork this repo to your own GitHub account, then clone and install your forked repo in the developer mode:\n\n```\ngit clone https://github.com/\u003cyour github\u003e/reproschema-py.git\ncd reproschema-py\npip install -e .\n```\n#### Style\nThis repo uses pre-commit to check styling.\n- Install pre-commit with pip: `pip install pre-commit`\n- 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.\n\nWhen pre-commit is used, you may have to run git commit twice,\nsince pre-commit may make additional changes to your code for styling and will\nnot commit these changes by default.\n\n\n## CLI usage\n\nThis package installs `reproschema` Command Line Interface (CLI).\n\n```\n$ reproschema --help\n\n$  A client to support interactions with ReproSchema\n\n  To see help for a specific command, run\n\n  reproschema COMMAND --help     e.g. reproschema validate --help\n\nOptions:\n  --version\n  -l, --log-level [DEBUG|INFO|WARNING|ERROR|CRITICAL]\n                                  Log level name  [default: INFO]\n  --help                          Show this message and exit.\n\nCommands:\n  convert             Converts a path to a different format, jsonld,...\n  create\n  migrate             Updates to a new reproschema version\n  redcap2reproschema  Converts REDCap CSV files to Reproschema format.\n  reproschema2redcap  Converts reproschema protocol to REDCap CSV format.\n  serve\n  validate            Validates if the path has a valid reproschema format\n  reproschema2fhir       Generates FHIR questionnaire resources from reproschema activities\n  output2redcap  Generates redcap csv given the audio and survey data from reproschema ui\n```\n\n## `reproschema2redcap`\n\n### CLI Usage\n\nYou can use this feature directly from the command line. To convert ReproSchema protocol to REDCap CSV format, use the following command\n\n```\nreproschema reproschema2redcap \u003cinput_dir_path\u003e \u003coutput_csv_filename\u003e\n```\n\n- `\u003cinput_dir_path\u003e`: The path to the root folder of a protocol. For example, to convert the reproschema-demo-protocol provided by ReproNim, you can use the following commands:\n  ```bash\n  git clone https://github.com/ReproNim/reproschema-demo-protocol.git\n  cd reproschema-demo-protocol\n  pwd\n  ```\n  In this case,  the output from `pwd` (which shows your current directory path) should be your `\u003cinput_dir_path\u003e`.\n- `\u003coutput_csv_filename\u003e`: The name of the output CSV file where the converted data will be saved.\n\n### Python Function Usage\n\nYou can also use the `reproschema2redcap` function from the `reproschema-py` package in your Python code.\n\n```python\nfrom reproschema import reproschema2redcap\n\ninput_dir_path = \"path-to/reproschema-demo-protocol\"\noutput_csv_filename = \"output.csv\"\n\nreproschema2redcap(input_dir_path, output_csv_filename)\n```\n\n## `redcap2reproschema`\nThe `redcap2reproschema` function is designed to process a given REDCap CSV file and YAML configuration to generate the output in the reproschema format.\n\n### Prerequisites\nBefore the conversion, ensure you have the following:\n\n**YAML Configuration File**:\n   - Download [templates/redcap2rs.yaml](templates/redcap2rs.yaml) and fill it out with your protocol details.\n\n### YAML File Configuration\nIn the `templates/redcap2rs.yaml` file, provide the following information:\n\n- **protocol_name**: A unique identifier for your protocol. Use underscores for spaces and avoid special characters.\n- **protocol_display_name**: Name that will appear in the application.\n- **protocol_description**: A brief description of your protocol.\n- **redcap_version**: Version of your redcap file (you can customize it).\n\nExample:\n```yaml\nprotocol_name: \"My_Protocol\"\nprotocol_display_name: \"Assessment Protocol\"\nprotocol_description: \"This protocol is for assessing cognitive skills.\"\nredcap_version: \"X.XX.X\"\n```\n### CLI Usage\n\nThe `redcap2reproschema` function has been integrated into a CLI tool, use the following command:\n```bash\nreproschema redcap2reproschema path/to/your_redcap_data_dic.csv path/to/your_redcap2rs.yaml\n```\n\nOptionally you can provide a path to the output directory (default is the current directory) by adding the option: `--output-path PATH`\n### Python Function Usage\n\nYou can also use the `redcap2reproschema` function from the `reproschema-py` package in your Python code.\n\n```python\nfrom reproschema import redcap2reproschema\n\ncsv_path = \"path-to/your_redcap_data_dic.csv\"\nyaml_path = \"path-to/your_redcap2rs.yaml\"\noutput_path = \"path-to/directory_you_want_to_save_output\"\n\nredcap2reproschema(csv_file, yaml_file, output_path)\n```\n\n## `output2redcap`\nThe `output2redcap` function is designed to process the output from reproschema-ui into a REDCap CSV file as seen [here](reproschema/example/redcap).\n\n\n### CLI Usage\n\nThe `output2redcap` function has been integrated into a CLI tool, use the following command:\n```bash\nreproschema output2redcap ./path/to/your_reproschema-ui_files ./path/to/directory_you_want_to_save_output\n```\n\n## `reproschema2fhir`\nThe `reproschema2fhir` function is designed to convert reproschema activities and items into a FHIR Questionnaire resource as seen [here](reproschema/example/fhir).\n\n### CLI Usage\n\nThe `reproschema2fhir` function has been integrated into a CLI tool, use the following command:\n```bash\nreproschema reproschema2fhir ./path/to/your_reproschema_activities ./path/to/directory_you_want_to_save_output\n```\n### Notes\n1. The script requires an active internet connection to access the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepronim%2Freproschema-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frepronim%2Freproschema-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepronim%2Freproschema-py/lists"}