Skip to content

Commit 328794c

Browse files
authored
Merge pull request #43 from FHIR-Aggregator/development
dev to main
2 parents 302f161 + 0071e5f commit 328794c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3724
-512
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
data/
2+
*.log
3+
*.json

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM python:3.12
2+
3+
WORKDIR /app
4+
5+
COPY . /app/CDA2FHIR
6+
7+
WORKDIR /app/CDA2FHIR
8+
9+
RUN apt-get update && apt-get install -y \
10+
build-essential \
11+
libpq-dev \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
RUN pip install --upgrade pip && \
15+
pip install --no-cache-dir charset_normalizer idna certifi requests pydantic pytest click \
16+
pathlib orjson tqdm uuid openpyxl pandas inflection iteration_utilities fhir.resources==7.1.0 \
17+
sqlalchemy==2.0.31 gen3-tracker>=0.0.7rc1
18+
19+
RUN pip install -e /app/CDA2FHIR
20+
21+
RUN mkdir -p /app/CDA2FHIR/data/raw
22+
RUN mkdir -p /app/CDA2FHIR/data/META
23+
24+
ENTRYPOINT ["/bin/bash"]

README.md

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,50 @@ To run the transformer, ensure that [CDA](https://cda.readthedocs.io/en/latest/)
2626
Usage: cda2fhir transform [OPTIONS]
2727
2828
Options:
29-
-s, --save Save FHIR ndjson to CDA2FHIR/data/META folder.
30-
[default: True]
29+
-s, --save Save FHIR ndjson to CDA2FHIR/data/META folder.
30+
[default: True]
3131
-v, --verbose
32-
-ns, --n_samples TEXT Number of samples to randomly select - max 100.
33-
-nd, --n_diagnosis TEXT Number of diagnosis to randomly select - max 100.
34-
-p, --path TEXT Path to save the FHIR NDJSON files. default is
35-
CDA2FHIR/data/META.
36-
--help Show this message and exit.
32+
-ns, --n_samples TEXT Number of samples to randomly select - max 100.
33+
-nd, --n_diagnosis TEXT Number of diagnosis to randomly select - max 100.
34+
-nf, --n_files TEXT Number of files to randomly select - max 100.
35+
-f, --transform_files Transform CDA files to FHIR DocumentReference and
36+
Group.
37+
-t, --transform_treatment Transform CDA treatment to all sub-hierarchy of
38+
FHIR MedicationAdministration ->
39+
SubstanceDefinitionRepresentation.
40+
-c, --transform_condition Transform CDA disease to Condition
41+
-m, --transform_mutation Transform CDA mutation to Observation
42+
-p, --path TEXT Path to save the FHIR NDJSON files. default is
43+
CDA2FHIR/data/META.
44+
--help Show this message and exit.
3745
```
3846

3947
- example
4048
```
4149
cda2fhir transform
4250
```
4351

44-
### Testing
45-
Current integration testing runs on all data and may take approximately _**2 hours**_.
52+
### FHIR data validation
4653

54+
#### Run validate
4755
```
48-
pytest -cov
56+
cda2fhir validate --path data/META
57+
{'summary': {'Specimen': 742505, 'Medication': 214, 'Observation': 832864, 'ResearchStudy': 429, 'SubstanceDefinition': 214, 'BodyStructure': 135, 'Condition': 114804, 'ResearchSubject': 184888, 'MedicationAdministration': 38267, 'Patient': 159047, 'Substance': 214}}
4958
```
50-
### FHIR data validation
51-
For FHIR data validation please run:
59+
60+
This command will validate your FHIR entities and their reference relations to each other. It will also generate a summary count of all entities in each ndjson file.
61+
62+
NOTE: This process may take _**5 minutes**_ or more, depending on your platform or compute power due to the size of the current data.
63+
64+
#### Check for a field ex. extension
65+
```bash
66+
awk '!/extension/ {exit 1}' data/META/ResearchSubject.ndjson && echo "Every line contains 'extension'" || echo "Not every line contains 'extension'"
5267
```
53-
g3t meta validate <path to data/META folder with ndjson files>
54-
>>>> resources={'summary': {'Specimen': 715864, 'Observation': 724999, 'ResearchStudy': 423, 'BodyStructure': 180, 'Condition': 95288, 'ResearchSubject': 160662, 'Patient': 137522}}
68+
69+
70+
### Testing
71+
Current integration testing runs on all data and may take approximately _**2 hours**_.
72+
5573
```
56-
NOTE: This process may take more than _**5 minutes**_ due to the size of the current data.
74+
pytest -cov
75+
```

cda2fhir/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from cda2fhir.patcher import apply_patches
2+
3+
apply_patches()
4+
5+

cda2fhir/cda2fhir.py

Lines changed: 848 additions & 267 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)