Skip to content

Commit

Permalink
Merge pull request #466 from Remi-Gau/codespell
Browse files Browse the repository at this point in the history
[MAINT]  update pre-commit
  • Loading branch information
yibeichan authored Apr 21, 2024
2 parents 60874e4 + 82ee64c commit b4a77ac
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[codespell]
skip = env,venv,*.svg
ignore-words-list = HSI
builtin = clear,rare
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# Documentation
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
15 changes: 15 additions & 0 deletions .github/workflows/run_precommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
53 changes: 53 additions & 0 deletions .github/workflows/update_precommit_hooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: Update precommit hooks


on:

# Uses the cron schedule for github actions
#
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events
#
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
schedule:
- cron: 0 0 * 1,7 * # january and july

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
update_precommit_hooks:

# only run on upstream repo
if: github.repository_owner == 'SIMEXP'

runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
allow-prereleases: false
- name: Install pre-commit
run: pip install pre-commit
- name: Update pre-commit hooks
run: pre-commit autoupdate
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: pre-commit hooks auto-update
base: main
token: ${{ secrets.GITHUB_TOKEN }}
delete-branch: true
title: '[BOT] update pre-commit hooks'
body: done via this [GitHub Action](https://github.com/${{ github.repository_owner }}/reproschema /blob/main/.github/workflows/update_precommit_hooks.yml)
10 changes: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-ast
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 19.3b0
rev: 24.3.0
hooks:
- id: black
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
4 changes: 2 additions & 2 deletions docs/01_introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ these questionnaires. However, these resources are often used to make data
consistent and reusable after, rather than during data collection. However,
harmonizing data after acquisition is resource intensive and this approach can
create a mismatch between collected and submitted data due to human error during
the harmonization process. To faciliate tedious harmonization efforts, several
the harmonization process. To facilitate tedious harmonization efforts, several
projects, over the last two decades, have developed technologies to automatically
or interactively align and harmonize data elements (e.g., BIRN mediator, OpenRefine).

Expand Down Expand Up @@ -126,7 +126,7 @@ displayed to the user and under which conditions,
should be computed

The ReproSchema also allows for internationalization and multiple languages support
by making it very easy to keep everything the same
by making it very easy to keep everything the same
except the language displayed by the user interface.

Finally ReproSchema allows tracking of variations and version of different assessments
Expand Down
4 changes: 2 additions & 2 deletions docs/30_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include:
We have used schema.org classes and properties where it maps on to the needs of
the model and extended the model with NIDM elements to harmonize across ReproNim
projects.
1. Allowing for structued nested elements in a schema
1. Allowing for structured nested elements in a schema
`Protocol > Activity > [Activity | Field > ResponseOption]`. This nested
structure provides a flexible schema to represent nested activities, which are
common in biomedical and other domains.
Expand Down Expand Up @@ -38,7 +38,7 @@ used.
participant.
1. Allowing for user interface (UI) elements that allow interaction between the schema
and any implementation that allows collecting data using the schema. By providing
some additional UI elements the provider can guide an implementor to allow for
some additional UI elements the provider can guide an implementer to allow for
more complex data collection behavior.

The [ReproSchema-UI](https://repronim.org/reproschema-ui) is a prototype implementation of an UI that leverages these
Expand Down
2 changes: 1 addition & 1 deletion docs/41_create_new_protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Ready for your first ReproSchema project?! We are going to use the [Reproschema

1. Prerequisite: Ensure you have Git and Cookiecutter installed on your system. If not, please refer to the installation guides for Git and Cookiecutter.
2. Generate Your Repository: Use the Reproschema Protocol Cookiecutter to create a new repository for your research protocol. Run the following command in your terminal:

```bash
cookiecutter gh:ReproNim/reproschema-protocol-cookiecutter
```
Expand Down
10 changes: 5 additions & 5 deletions docs/42_adopt_assessments.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Adopting Assessments from the reproschema-library
# Adopting Assessments from the reproschema-library

This part focuses on how to select and integrate assessments from the reproschema-library into your research protocol, an essential step in crafting a comprehensive study. The chosen assessments are to be placed in the `activities` folder within your repository. This folder serves as the central hub for various assessments or activities that collectively form your research protocol.

Each activity or assessment within this `activities` folder is typically structured around a file named with a suffix `_schema`. This file defines the overall framework of the assessment. Accompanying this, if an assessment comprises specific questions, these are organized in a subfolder titled `items` within the respective activity's directory. It's important to note that if an assessment is directly taken from the ReproSchema-library without any customization, the creation of an `items` subfolder is not necessary, as the itemized questions are predefined in the library.

To illustrate this process, we will use two specific types of assessments from [reproschema-library](https://github.com/ReproNim/reproschema-library): `demographics` and `psychological questions`. The latter represents a composite assessment created from multiple pre-existing assessments within the library. This example demonstrates how to combine different elements from the library to construct a bespoke assessment tailored to the unique demands of your research protocol.

## Step 1: Understand the structure of a *_schema file throught this [exemplar file](https://github.com/ReproNim/reproschema-protocol-cookiecutter/blob/main/%7B%7Bcookiecutter.protocol_name%7D%7D/activities/Activity1/activity1_schema)
## Step 1: Understand the structure of a *_schema file through this [exemplar file](https://github.com/ReproNim/reproschema-protocol-cookiecutter/blob/main/%7B%7Bcookiecutter.protocol_name%7D%7D/activities/Activity1/activity1_schema)

1. **Context (@context)**: This field provides references to the context definitions. In this schema, it links to the generic context of ReproSchema and the specific context for the items in the repository, defined by the URL with the "rl" key. This context helps to interpret the terms used within the schema.
2. **Type (@type)**: Defined as "reproschema:Activity," this indicates the nature of the document, specifying that it is an activity within the ReproSchema framework.
Expand Down Expand Up @@ -34,7 +34,7 @@ This step involves precise modifications, particularly in the `@context` and `ad
Labeling this link as "demo" directs the schema to the location in the ReproSchema-library where items for demographics and background information are defined. We use the link with a specific commit ID to ensure the consistency of the assessment version. This contextual link allows the schema to access the detailed structures and definitions needed for each demographic item.
2. **Customizing "addProperties" for Demographic Variables**:
2. **Customizing "addProperties" for Demographic Variables**:
In the "addProperties" section, we define each variable that corresponds to a demographic question. For example:
Expand Down Expand Up @@ -141,8 +141,8 @@ Different from `demograpgics`, `psychological_questionnaire_schema` combines ass
"isAbout": "demo:clinical_history_psychiatry"
}
```
- The `order` array specifies the sequence in which these assessments will appear in the questionnaire, ensuring a logical flow for participants.
- The `shuffle` setting is `false`, maintaining the defined order, and allow includes functionalities like auto-advance between assessments and data export.
See the outcome [here](https://github.com/ReproNim/reproschema-demo-protocol/blob/main/activities/2_psychological/psychological_questionnaire_schema)
See the outcome [here](https://github.com/ReproNim/reproschema-demo-protocol/blob/main/activities/2_psychological/psychological_questionnaire_schema)
6 changes: 3 additions & 3 deletions docs/46_tools.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Toolkit

In the world of research data management, flexibility and compatibility are key. Understanding this, we provide specialized tools designed to create, validata schemas, and convert data between ReproSchema format and REDCap CSV format. Whether you're transitioning from REDCap to ReproSchema or vice versa, these tools ensure a smooth and efficient conversion process, preserving the integrity and structure of your data.
In the world of research data management, flexibility and compatibility are key. Understanding this, we provide specialized tools designed to create, validate schemas, and convert data between ReproSchema format and REDCap CSV format. Whether you're transitioning from REDCap to ReproSchema or vice versa, these tools ensure a smooth and efficient conversion process, preserving the integrity and structure of your data.

## Install reproschema-py

Expand Down Expand Up @@ -52,7 +52,7 @@ reproschema reproschema2redcap <input_dir_path> <output_csv_filename>
cd reproschema-demo-protocol
pwd
```

In this case, the output from `pwd` (which shows your current directory path)should be your `<input_dir_path>`.
- `<output_csv_filename>`: The name of the output CSV file where the converted data will be saved.

Expand Down Expand Up @@ -90,4 +90,4 @@ The `redcap2reproschema` function has been integrated into a CLI tool, use the f
reproschema redcap2reproschema path/to/your_redcap_data_dic.csv path/to/your_redcap2rs.yaml
```

Those tools can also be used as Python functions. For detailed instructions, please visit [reproschema-py](https://github.com/ReproNim/reproschema-py).
Those tools can also be used as Python functions. For detailed instructions, please visit [reproschema-py](https://github.com/ReproNim/reproschema-py).
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ nav:
- Project structure: "20_project_structure.md"
- Schema: "30_schema.md"
- User Guide:
- Create a research protocol: "41_create_new_protocol.md"
- Adopt assessments from the library: "42_adopt_assessments.md"
- Create a research protocol: "41_create_new_protocol.md"
- Adopt assessments from the library: "42_adopt_assessments.md"
- Create new assessments for a protocol: "43_create_new_assess.md"
- Add a feedback section: "44_setup_feedback.md"
- Finalize the protocol: "45_finalize_protocol.md"
Expand Down
1 change: 0 additions & 1 deletion terms/Field
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,3 @@
}
]
}

2 changes: 1 addition & 1 deletion terms/unitOptions
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"@id": "reproschema:UnitOption"
}
]
}
}

0 comments on commit b4a77ac

Please sign in to comment.