Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,18 @@ templates/
# Ignore template files from Public folder
Public/

# ignore dev folders
dev/

# Temporary REDCap test config
*.rarelink_test_redcap_config.json

# DS Store
# macOS metadata
.DS_Store
**/.DS_Store
.DS_Store/
.DS_Store?
.DS_Store
.src/.DS_Store?
.src/rarelink/.DS_Store?
.src/rarelink/utils/.DS_Store?
Expand Down
37 changes: 19 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#### Packages & Compatibility

[![REDCap](https://img.shields.io/badge/REDCap-API-darkred.svg)](https://www.project-redcap.org/)
[![RD-CDM](https://img.shields.io/badge/RD--CDM-v2.0.2-blue.svg)](https://github.com/BIH-CEI/rd-cdm)
[![RD-CDM](https://img.shields.io/badge/RD--CDM-v2.0.3-blue.svg)](https://github.com/BIH-CEI/rd-cdm)
[![Phenopackets](https://img.shields.io/badge/Phenopackets-v2.0-purple.svg)](https://phenopacket-schema.readthedocs.io/en/latest/)
[![LinkML](https://img.shields.io/badge/LinkML-1.9.0+-green.svg)](https://linkml.io/)
[![HL7 FHIR](https://img.shields.io/badge/HL7%20FHIR-R4-orange.svg)](https://hl7.org/fhir/)
Expand Down Expand Up @@ -116,37 +116,38 @@ Documentation on [Setting Up a REDCap Project](https://rarelink.readthedocs.io/e

## Installation

RareLink can be set up using various Python project management approaches. One
common method is to use a virtual environment. Below is an example where the
virtual environment is named `rarelink-venv`, but you can name it as you prefer:

RareLink requires Python ≥3.10 and <3.13.
```bash
python3.12 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
```

> **Note**: You need Python ≥3.10 but <3.13 to be able to use RareLink!

Next, install rarelink through pypi...

### Core install
```bash
pip install rarelink
```

... or clone the RareLink repository, navigate to its root directory, and
install RareLink using:
This installs everything needed for REDCap interaction, Phenopacket export,
and the RareLink CLI. It does **not** install Docker, numpy/pandas, or
documentation/testing tools.

```bash
git clone https://github.com/BIH-CEI/rarelink.git
cd rarelink
pip install .
```
### Optional extras

If you want to install development dependencies (e.g., `pytest`), use:
| Extra | Install command | What it adds |
|-------|----------------|--------------|
| `fhir` | `pip install rarelink[fhir]` | Docker SDK for the toFHIR FHIR export pipeline |
| `data` | `pip install rarelink[data]` | numpy + pandas for tabular data processing |
| `test` | `pip install rarelink[test]` | pytest and pytest-mock |
| `docs` | `pip install rarelink[docs]` | Sphinx and documentation themes |
| `dev` | `pip install rarelink[dev]` | All of the above plus build/twine/jupyter |

For development:
```bash
pip install .[dev]
git clone https://github.com/BIH-CEI/rarelink.git
cd rarelink
pip install -e .[dev]
pytest
```

### Setting Up the `.env` File
Expand Down
Binary file removed docs/.DS_Store
Binary file not shown.
12 changes: 6 additions & 6 deletions docs/2_rarelink_framework/2_1_rarelink_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ GA4GH Phenopackets, without the need for additional coding or mapping.
As a result, RareLink allows researchers and clinicians to collect and process
RD data seamlessly within the REDCap environment.

.. figure:: ../_static/res/rarelink_overview.svg
.. figure:: ../_static/res/rarelink_overview.png

Overview of the RareLink framework integrated with a local REDCap instance.
The framework comprises the RareLink instruments based on the RD-CDM, the
RareLink API, the toFHIR & CDIS module for export and import to HL7 FHIR IPS
and Genomic Reporting Resources, and the RareLink-Phenopackets module for
The framework comprises the REDCap instruments based on the `RD-CDM <https://www.nature.com/articles/s41597-025-04558-z>`_,
the RareLink API, the toFHIR & CDIS module for export and import to HL7 FHIR
IPS and Genomic Reporting Resources, and the RareLink-Phenopackets module for
direct export to GA4GH Phenopackets. Additionally, the LinkML-based import
mapper facilitates data import from tabular databases into REDCap, while
the Manual Data Capture Guide assists with the manual data capture of
RD-CDM data in a local REDCap project. Click `here <https://github.com/BIH-CEI/rarelink/blob/develop/docs/_static/res/rarelink_overview.svg>`_
to see the figure in full size.
RD-CDM data in a local REDCap project. The framework is also configurable
for disease-specific extensions or custom data models.

.. note::
You will need your own REDCap instance to deploy the RareLink framework.
Expand Down
4 changes: 2 additions & 2 deletions docs/2_rarelink_framework/2_2_rarelink_cdm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Example Field Annotation of 6.2.6 Temporal Pattern:
- HP:0012829 | Profound
- HP:0012828 | Severe
Version(s):
- HPO Version 2025-05-06
- HPO Version 2026-02-16
Mapping:
- HL7 FHIR Expression v4.0.1: Observation.interpretation
- GA4GH Phenopacket Schema v2.0 Element: PhenotypicFeature.severity
Expand Down Expand Up @@ -315,7 +315,7 @@ ______________________________________________________________
- Cardinality: Required (1..1)
- Validation: Date format (YYYY-MM-DD)

- 2.2 Sex at Birth (``snomedct_281053000``)
- 2.2 Sex at Birth (``loinc_76689_9``)

- Cardinality: Optional
- Validation: Dropdown (choices encoded according to :ref:`1_5`)
Expand Down
55 changes: 38 additions & 17 deletions docs/3_installation/3_1_setup_rarelink_framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,57 @@ Follow these steps to set up the project locally and run tests.
source .venv/bin/activate # On macOS/Linux
.venv\Scripts\activate # On Windows

3. Install dependencies:
3. Install RareLink:

.. code-block:: bash

pip install .
pip install rarelink

This installs everything needed for REDCap interaction, Phenopacket export,
and the RareLink CLI.

For optional features, install the relevant extras:

.. code-block:: bash

pip install rarelink[fhir] # adds Docker SDK for the toFHIR pipeline
pip install rarelink[data] # adds numpy and pandas for tabular data processing

For development (includes testing, docs, and all optional extras):

.. code-block:: bash

pip install -e .[dev]

4. Configure all api keys necessary to use rarelink by running the following
command:

.. code-block:: bash

rarelink setup keys
rarelink setup keys

This command will prompt you to enter the following keys:
- BioPortal API key
- REDCap API key
- REDCap URL
- REDCap project ID

.. note::
.. note::
You can create your free BioPortal account here: `BioPortal <https://bioportal.bioontology.org/>`_

5. Run tests:
Use `pytest` to run the test suite.


.. code-block:: bash

pip install rarelink[test]
pytest

_____________________________________________________________________________________

RareLink Framework CLI config
------------------------------------

Use the following commands to update the framework and its components, view
Use the following commands to update the framework and its components, view
its status or reset the framework. See :ref:`2_3` for more information.

.. code-block:: bash
Expand Down Expand Up @@ -91,32 +107,37 @@ ________________________________________________________________________________
Phenopacket Pipeline Configuration
___________________________________

Via the RareLink CLI type:
The Phenopacket export pipeline requires a BioPortal API key and a
``CREATED_BY`` value, both configured via:

.. code-block:: bash

to be implemented
rarelink setup keys

This command guides you through setting up the Phenopacket pipeline for RareLink.
You will be prompted to enter:
- Your location where to store the Phenopackets.
Once configured, export Phenopackets with:

.. code-block:: bash

rarelink phenopackets export --help

_____________________________________________________________________________________

FHIR Pipeline Configuration
___________________________

.. note::
The FHIR pipeline requires the ``fhir`` extra: ``pip install rarelink[fhir]``

.. code-block:: bash

rarelink fhir setup

This command guides you through setting up the FHIR pipeline for RareLink.
This command guides you through setting up the FHIR pipeline for RareLink.
You will be prompted to enter:

- Your FHIR server URL.
- If required, your FHIR server username & password.

.. note::
All sensitive information will also be stored in the
hidden configuration file.

.. note::
All sensitive information will also be stored in the
hidden configuration file.
3 changes: 2 additions & 1 deletion docs/4_user_guide/4_1_manual_data_capture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ Fields:

1. Validate mutations using `ClinVar <https://www.ncbi.nlm.nih.gov/clinvar/>`_
or `Varsome <https://varsome.com/>`_.
2. Confirm the expression with the `HGVS Validator <https://lhcforms.nlm.nih.gov/fhir/hgvs-validator/>`_.
2. Confirm the expression with the `Variant Validator <https://variantvalidator.org/service/validate/>`_
or the `HGVS Validator <https://lhcforms.nlm.nih.gov/fhir/hgvs-validator/>`_.
3. If the validation fails, enter the details in the **6.1.6 Genetic Mutation String** field.
4. ``*``: **Are you sure the entered HGVS expression was validated using
the variant validator?** - this field is mandatory to ensure the
Expand Down
10 changes: 5 additions & 5 deletions docs/4_user_guide/4_2_import_mapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ The template contains the following columns:
RareLink-CDM schema, for example:

- ``rarelink_cdm:snomedct_184099003`` for 2.1 Date of birth, or
- ``rarelink_cdm:snomedct_281053000`` for 2.2 Sex at birth.
- ``rarelink_cdm:loinc_76689_9`` for 2.2 Sex at birth.

- **predicate_label**:
The title of the target element from the schema, i.e. the *name* of the element
Expand All @@ -198,7 +198,7 @@ The template contains the following columns:
The target value in the RareLink-CDM. For literal fields, such as dates,
this is the actual value (e.g., "1970-02-15"). For coded fields, such as
sex, the object_id is the standardized code from the value set
(e.g., "SNOMEDCT:248152002" for female) or the code from the code system defined
(e.g., "LOINC:76689-9" for female) or the code from the code system defined
by the data element (e.g., "HP:0001250" for a phenotype in element 6.2.1).

- **object_label**: The human-readable label for the target value either from the
Expand Down Expand Up @@ -255,7 +255,7 @@ Below you can find a **snippet of the RareLink-CDM SSSOM Template File:**
#
# === Personal Information (Singular) ===
<record_id> "<source_label>" rarelink_cdm:snomedct_184099003 "2.1 Date of birth" <dob> - lexical <mapping_date> manual
<record_id> "<source_label>" rarelink_cdm:snomedct_281053000 "2.2 Sex at birth" <SNOMEDCT_sex_code> <sex_label> lexical <mapping_date> manual
<record_id> "<source_label>" rarelink_cdm:loinc_76689_9 "2.2 Sex at birth" <SNOMEDCT_sex_code> <sex_label> lexical <mapping_date> manual
<record_id> "<source_label>" rarelink_cdm:snomedct_1296886006 "2.3 Karyotypic Sex" <karyotype_code> <karyotype_label> lexical <mapping_date> manual
<record_id> "<source_label>" rarelink_cdm:snomedct_263493000 "2.4 Gender Identity" <SNOMEDCT_gender_code> <gender_identity_label> lexical <mapping_date> manual
<record_id> "<source_label>" rarelink_cdm:snomedct_370159000 "2.5 Country of birth" <ISO3166_code> <ISO3166_code> lexical <mapping_date> manual
Expand Down Expand Up @@ -447,7 +447,7 @@ schema.
subject_id subject_label predicate_id predicate_label object_id object_label match_type mapping_date mapping_tool
ADR001 "Patient ADR001" rarelink_cdm:snomedct_422549004 "1.1 Pseudonym" ADR001 ADR001 lexical 2025-01-01 manual
ADR001 "Patient ADR001" rarelink_cdm:snomedct_184099003 "2.1 Date of birth" 1970-02-15 - lexical 2025-01-01 manual
ADR001 "Patient ADR001" rarelink_cdm:snomedct_281053000 "2.2 Sex at birth" SNOMEDCT:248152002 Female lexical 2025-01-01 manual
ADR001 "Patient ADR001" rarelink_cdm:loinc_76689_9 "2.2 Sex at birth" LOINC:76689-9 Female lexical 2025-01-01 manual
ADR001 "Patient ADR001" rarelink_cdm:snomedct_263493000 "2.4 Gender Identity" SNOMEDCT:446141000124107 Female gender identity lexical 2025-01-01 manual
ADR001 "Patient ADR001" rarelink_cdm:snomedct_278844005 "3.1 Vital Status" SNOMEDCT:438949009 Alive lexical 2025-01-01 manual
ADR001 "Patient ADR001" rarelink_cdm:snomedct_64572001_mondo "5.1 Disease [MONDO]" MONDO:0012345 Wilson Disease lexical 2025-01-01 manual
Expand Down Expand Up @@ -475,7 +475,7 @@ schema.
# Mappings for a second patient (ADR002)
ADR002 "Patient ADR002" rarelink_cdm:snomedct_422549004 "1.1 Pseudonym" ADR002 ADR002 lexical 2025-01-01 manual
ADR002 "Patient ADR002" rarelink_cdm:snomedct_184099003 "2.1 Date of birth" 1982-07-30 1982-07-30 lexical 2025-01-01 manual
ADR002 "Patient ADR002" rarelink_cdm:snomedct_281053000 "2.2 Sex at birth" SNOMEDCT:248153007 Male lexical 2025-01-01 manual
ADR002 "Patient ADR002" rarelink_cdm:loinc_76689_9 "2.2 Sex at birth" SNOMEDCT:248153007 Male lexical 2025-01-01 manual
ADR002 "Patient ADR002" rarelink_cdm:snomedct_278844005 "3.1 Vital Status" SNOMEDCT:438949009 Alive lexical 2025-01-01 manual
ADR002 "Patient ADR002" rarelink_cdm:snomedct_64572001_mondo "5.1 Disease [MONDO]" MONDO:0010526 Fabry Disease lexical 2025-01-01 manual
ADR002 "Patient ADR002" rarelink_cdm:loinc_99498_8 "5.2 Verification status" HL7FHIR:differential Differential lexical 2025-01-01 manual
Expand Down
Loading
Loading