Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Jun 17, 2024
1 parent c6d6dcc commit c196da5
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 61 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
activities/.DS_Store
protocols/.DS_Store

__pycache__

.idea/

node_modules
Expand Down
89 changes: 89 additions & 0 deletions docs/how-to/validation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Validation

### Validating your schema

If you want to validate a schema you have created:

- install the reproschema python tools

```bash
pip install reproschema
```

- run its `validate` command

```bash
reproschema --log-level DEBUG validate PATH_TO_VALIDATE
```

!!! note

You can validate a single file or all the files in a folder and its subfolder.

### Automating validation

If you are hosting your schema on a github repository,
you can automate the validation with a with GitHub CI workflow.

For example if you repository is structured like this:

```text
├── protocols
│ └── protocol-1.jsonld
├── activities
│ ├── items
│ │ └── item-1.jsonld
│ └── activity-1.jsonld
└── README.md
```

create a `.github/workflows/validate.yml` file in this repository.

```text hl_lines="1-3"
├── .github # hidden github folder
│ └── workflows
│ └── validate.yml # file the actions used to validate your schema
├── protocols
│ └── protocol-1.jsonld
├── activities
│ ├── items
│ │ └── item-1.jsonld
│ └── activity-1.jsonld
└── README.md
```

Content of `validate.yml`:

```yaml
name: validation

on:
push:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install reproschema-py
- name: validate
run: |
reproschema validate protocols
reproschema validate activities
```
!!! note
Note that if you have created your schema
using the [reproschema cookie cutter](../user-guide/create-new-protocol.md)
then a validation workflow should already be included in your repository.
60 changes: 0 additions & 60 deletions docs/tutorials/tips-to-make-your-life-easier.md

This file was deleted.

3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ nav:
- Finalize the protocol: "tutorials/finalizing-the-protocol.md"
- Translate a questionnaire: "tutorials/translating-an-activity.md"
- Demographic information : "tutorials/collecting-demographics-information.md"
- Tips to make your life easier: "tutorials/tips-to-make-your-life-easier.md"
- How to guides:
- how-to/validation.md
- FAQ: "FAQ.md"
- Contributing: "CONTRIBUTING.md"

Expand Down

0 comments on commit c196da5

Please sign in to comment.