Skip to content
Snippets Groups Projects
Commit 0036561e authored by mjbonifa's avatar mjbonifa
Browse files

Merge branch 'dev' into 57-fix-convertion-of-meldb-sail-phenotypes-to-acmc-0-1-12

parents 8fe19073 7ce48fbd
No related branches found
No related tags found
No related merge requests found
......@@ -1406,6 +1406,10 @@ def diff(phen_dir: str, version: str, old_phen_dir: str, old_version: str):
f"Old phenotype directory does not exist: {str(old_phen_path.resolve())}"
)
t_path = old_phen_path / "config.yml"
with t_path.open("r") as file:
c = yaml.safe_load(file)
try:
# Create the directory
temp_dir.mkdir(parents=True, exist_ok=True)
......
......@@ -760,7 +760,7 @@
<section id="SUPPORTED_CODE_TYPES">
<div class="attr variable">
<span class="name">SUPPORTED_CODE_TYPES</span> =
<span class="default_value">{&#39;icd10&#39;, &#39;read2&#39;, &#39;snomed&#39;, &#39;atc&#39;, &#39;opcs4&#39;, &#39;read3&#39;}</span>
<span class="default_value">{&#39;opcs4&#39;, &#39;icd10&#39;, &#39;atc&#39;, &#39;snomed&#39;, &#39;read2&#39;, &#39;read3&#39;}</span>
</div>
......
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
# Tutorial 1 Basic local phenotype
TODO
This examples sets up a phenotype workspace environment, installs dependencies, configures necessary files, and validates and maps phenotypes to read2.
1. **Clone the Git Repository:**
```sh
git clone <repository_url>
```
This copies the remote repository to your local machine.
2. **Navigate to the Project Directory:**
```sh
cd concepts-processing
```
Moves into the cloned repository's directory.
3. **Create a Virtual Environment:**
```sh
py -m venv venv
```
This sets up an Virtual Python environment named `venv`.
4. **Upgrade `pip`:**
```sh
python -m pip install --upgrade pip
```
Ensures you have the latest version of `pip`, which helps manage dependencies.
5. **Install the Required Package (`acmc`):**
```sh
pip install acmc
```
Installs `acmc`, which is likely a package required for processing concepts.
6. **Initialize a Phenotype Project:**
```sh
acmc phen init
```
Sets up the workspace file strucutre for working with phenotype concepts. An example phenotype project is created within the `phen` sub-folder.
7. **Download TRUD Data:**
Downloads necessary TRUD (Terminology Reference Data) files, for concept verification and translation.
1. **Register at TRUD**
Registry your account with TRUD at [NHS TRUD](https://isd.digital.nhs.uk/trud/user/guest/group/0/account/form).
2. **Subscribe and Accept Licenses**: Subscribe to the following data files:
- [NHS Read Browser](https://isd.digital.nhs.uk/trud/users/guest/filters/2/categories/9/items/8/releases)
- [NHS Data Migration](https://isd.digital.nhs.uk/trud/users/guest/filters/0/categories/8/items/9/releases)
- [ICD10 Edition 5 XML](https://isd.digital.nhs.uk/trud/users/guest/filters/0/categories/28/items/259/releases)
- [OPCS-4.10 Data Files](https://isd.digital.nhs.uk/trud/users/guest/filters/0/categories/10/items/119/releases)
After subscribing, you'll receive an API key once your request is approved (usually within a few hours).
3. **Get TRUD API KEY**
Copy your API key from [NHS TRUD Account Management](https://isd.digital.nhs.uk/trud/users/authenticated/filters/0/account/manage) and store it securely.
4. **Add TRUD API KEY to as an environment variable**
To set the environment variable temporarily (for the current session), run:
On macOS/Linux:
```bash
export ACMC_TRUD_API_KEY="your_api_key_here"
```
On Windows (Command Prompt or PowerShell):
```bash
setx ACMC_TRUD_API_KEY "your_api_key_here"
```
5. **Install TRUD within ACMC**
```sh
acmc trud install
```
8. **Create Phenotype Configuration:**
Modify the `config.yml` file as needed for your project settings.
For more information on see the [configuration file documentation](https://acmc.readthedocs.io/en/latest/#configuration-file).
9. **Validate the Phenotype Configuration:**
Use the followijng `acmc` command to validate the phenotype configuration to ensure it's correct:
```sh
acmc phen validate -d workspace\phen
```
Checks that the phenotype definitions are correctly structured and valid.
Expected Output:
```bash
[INFO] - Validating phenotype: <path>/concepts-processing/workspace/phen
[INFO] - Phenotype validated successfully
```
10. **Map Phenotype Data:**
Maps the phenotype data using the `read2` vocabulary.
```sh
acmc phen map -d workspace\phen -t read2
```
11. **Publish phenotype at an initial version**
Use the following `acmc` command to publish the phenotype at an initial version:
```bash
acmc phen publish
```
12. **Compare the previous version `0.0.1` with the latest version**
Use the following `acmc` command to compare the previous version `0.0.1` with the latest version in the workspace phen directory:
```bash
acmc phen diff -ov 0.0.1
```
13. **Publish the phenotype at a major version**
Use the following `acmc` command to publish the phenotype at a major version:
```bash
acmc phen publish -i major
```
## Support
If you need help please open an [issue in the repository](https://git.soton.ac.uk/meldb/concepts-processing/-/issues)
......@@ -12,4 +12,9 @@ phenotype:
files:
- path: clinical-codes-org/Symptom code lists/Abdominal pain/res176-abdominal-pain.csv
columns:
<<<<<<< HEAD
read2: code
=======
read2: "code"
>>>>>>> dev
......@@ -12,9 +12,16 @@ phenotype:
files:
- path: "clinical-codes-org/Cardiovascular events (ICD10)/res52-cardiovascular-events-icd10.csv"
columns:
<<<<<<< HEAD
icd10: "code"
- name: "DID_NOT_ATTEND"
files:
- path: "clinical-codes-org/Non-attendance codes/res201-did-not-attend-appointment.csv"
=======
icd10: "code"
- name: "DID_NOT_ATTEND"
file:
path: "clinical-codes-org/Non-attendance codes/res201-did-not-attend-appointment.csv"
>>>>>>> dev
columns:
read2: "code"
\ No newline at end of file
......@@ -10,6 +10,7 @@ phenotype:
- "snomed"
concept_sets:
- name: "CVD_EVENTS"
<<<<<<< HEAD
files:
- path: "clinical-codes-org/Cardiovascular events (ICD10)/res52-cardiovascular-events-icd10.csv"
columns:
......@@ -35,4 +36,31 @@ phenotype:
category: "3"
actions:
divide_col: "MMCode"
=======
file:
path: "clinical-codes-org/Cardiovascular events (ICD10)/res52-cardiovascular-events-icd10.csv"
columns:
icd10: "code"
- name: "DID_NOT_ATTEND"
file:
path: "clinical-codes-org/Non-attendance codes/res201-did-not-attend-appointment.csv"
columns:
read2: "code"
- name: "HYPERTENSION"
file:
path: "hanlon/Read_codes_for_diagnoses.csv"
columns:
read2: "Read Code"
category: "2"
actions:
divide_col: "MMCode"
- name: "DEPRESSION"
file:
path: "hanlon/Read_codes_for_diagnoses.csv"
columns:
read2: "Read Code"
category: "3"
actions:
divide_col: "MMCode"
>>>>>>> dev
import pytest
import argparse
import sys
import time
import shutil
import logging
from pathlib import Path
......@@ -220,26 +221,6 @@ def test_diff(tmp_dir, monkeypatch, caplog):
main.main()
assert "Phenotype published successfully" in caplog.text
# copy phenotype'
with caplog.at_level(logging.DEBUG):
monkeypatch.setattr(
sys,
"argv",
[
"main.py",
"phen",
"copy",
"-d",
str(phen_path.resolve()),
"-td",
str(tmp_dir.resolve()),
"-v",
"0.0.1",
],
)
main.main()
assert "Phenotype copied successfully" in caplog.text
# map phenotype example 2
shutil.copy(phen_path / "config2.yml", phen_path / "config.yml")
for code_type in ["read2", "read3"]:
......@@ -262,7 +243,6 @@ def test_diff(tmp_dir, monkeypatch, caplog):
# diff phenotype with 0.0.1
with caplog.at_level(logging.DEBUG):
old_path = tmp_dir / "0.0.1"
monkeypatch.setattr(
sys,
"argv",
......@@ -284,7 +264,7 @@ def test_diff(tmp_dir, monkeypatch, caplog):
content = file.read()
assert "Removed concepts ['ABDO_PAIN']" in content
assert "Added concepts ['DID_NOT_ATTEND']" in content
#assert "Added outputs: ['read3.csv']" in content
assert "Added outputs: ['read3.csv']" in content
# map phenotype with example 3
shutil.copy(phen_path / "config3.yml", phen_path / "config.yml")
......@@ -329,7 +309,7 @@ def test_diff(tmp_dir, monkeypatch, caplog):
content = file.read()
assert "Removed concepts ['ABDO_PAIN']" in content
assert "Added concepts ['DEPRESSION', 'DID_NOT_ATTEND', 'HYPERTENSION']" in content
#assert "Added outputs: ['read3.csv', 'snomed.csv']" in content
assert "Added outputs: ['read3.csv', 'snomed.csv']" in content
# TEST REPO NEEDS TO BE AUTOMATED
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment