Skip to content

Commit f16e698

Browse files
authored
Merge pull request #16 from hl7au/integration-test
Integration test
2 parents 33b279c + 0c87851 commit f16e698

13 files changed

+412
-1
lines changed

.github/workflows/dotnet.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,33 @@ jobs:
5252
name: ${{ matrix.program }}-${{ matrix.os }}-${{ matrix.arch }}-binaries
5353
path: |
5454
Sparked.${{ matrix.program }}-${{ matrix.os }}-${{ matrix.arch }}Output
55+
Test-Dot-Net:
56+
needs:
57+
- Build-Dot-Net
58+
runs-on: ubuntu-latest
59+
steps:
60+
- uses: actions/checkout@v4
61+
- name: Download artifact
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: Csv2FhirMapping-linux-x64-binaries
65+
path: /tmp
66+
- name: Prepare to run
67+
run: chmod +x /tmp/Csv2Fhir
68+
- name: Run converter
69+
run: |
70+
cd Sparked.Csv2FhirMapping/test &&
71+
/tmp/Csv2Fhir Medication ./medication.csv ./output/
72+
- name: Check output
73+
id: git-diff-action
74+
run: echo "changed=$(git status --porcelain=v1 2>/dev/null | wc -l | tr -d '[:space:]')" >> "$GITHUB_OUTPUT"
75+
- if: steps.git-diff-action.outputs.changed != '0'
76+
name: Fail
77+
run: git diff | cat && exit -1
5578
Release:
5679
if: contains(github.ref, 'tags/v')
5780
needs:
58-
- Build-Dot-Net
81+
- Test-Dot-Net
5982
- Build-Python
6083
runs-on: ubuntu-latest
6184
steps:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
/*.log
1010
*/dist/*
1111
/xls-converter/xls_converter/__pycache__/
12+
Sparked.Csv2FhirMapping/test/Csv2FhirMapping-linux-arm64-binaries/*
13+
Sparked.Csv2FhirMapping/test/Csv2FhirMapping-linux-arm64.zip
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
map "http://example.org/StructureMap/CSV2Medication" = "CSV2Medication"
2+
3+
uses "http://example.org/StructureDefinition/MedicationCSV" as source
4+
uses "http://hl7.org/fhir/StructureDefinition/Medication" as target
5+
6+
group ToMedication(source src : MedicationCSV, target tgt : Medication) {
7+
8+
// id
9+
src.id as s_id where length() > 0 -> tgt.id = s_id;
10+
11+
// meta.profile
12+
src -> tgt.meta = create('Meta') as meta then {
13+
src -> meta.profile = 'http://hl7.org.au/fhir/core/StructureDefinition/au-core-medication';
14+
};
15+
16+
// code 1..1 MS
17+
src.code_coding1_code as s_coding1 where length() > 0 -> tgt.code as t_code then {
18+
s_coding1 where length() > 0 -> t_code then {
19+
src.code_coding1_system as coding1_system -> t_code.coding = c(coding1_system, s_coding1) as t_coding first then {
20+
src.code_coding1_display as s_display where length() > 0 -> t_coding.display = s_display;
21+
22+
src.code_coding1_medicationType_code as s_medicationType_code where length() > 0 -> t_coding.extension as t_medication_type first then {
23+
s_medicationType_code -> t_medication_type.url = "http://hl7.org.au/fhir/StructureDefinition/medication-type";
24+
s_medicationType_code -> t_medication_type.value = c("http://terminology.hl7.org.au/CodeSystem/medication-type", s_medicationType_code) as t_coding then {
25+
src.code_coding1_medicationType_display as s_medicationType_display where length() > 0 -> t_coding.display = s_medicationType_display;
26+
};
27+
};
28+
};
29+
30+
src.code_coding2_code as s_coding2 where length() > 0 -> t_code then {
31+
src.code_coding2_system as coding2_system -> t_code.coding = c(coding2_system, s_coding2) as t_coding first then {
32+
src.code_coding2_display as s_display where length() > 0 -> t_coding.display = s_display;
33+
};
34+
};
35+
36+
src.code_coding3_code as s_code where length() > 0 -> t_code then {
37+
src.code_coding3_system as s_system -> t_code.coding = c(s_system, s_code) as t_coding first then {
38+
src.code_coding3_display as s_display where length() > 0 -> t_coding.display = s_display;
39+
};
40+
};
41+
42+
};
43+
44+
src.code_text as s_text where length() > 0 -> t_code.text = s_text;
45+
};
46+
47+
// code coding missing
48+
src.code_coding1_code as s_coding1 where length() = 0 -> tgt.code as t_code then {
49+
// text only
50+
src.code_text as s_text where length() > 0 -> t_code.text = s_text;
51+
// code missing
52+
src.code_text as s_text where length() = 0 -> t_code.coding = c('http://terminology.hl7.org/CodeSystem/data-absent-reason', 'unknown');
53+
};
54+
55+
// form 0..1
56+
src.form_coding1_code as s_coding1 where length() > 0 -> tgt.form as t_form then {
57+
s_coding1 -> t_form then {
58+
src.form_coding1_system as coding1_system -> t_form.coding = c(coding1_system, s_coding1) as t_coding first then {
59+
src.form_coding1_display as s_display where length() > 0 -> t_coding.display = s_display;
60+
};
61+
62+
src.form_coding2_code as s_coding2 where length() > 0 -> t_form then {
63+
src.form_coding2_system as coding2_system -> t_form.coding = c(coding2_system, s_coding2) as t_coding first then {
64+
src.form_coding2_display as s_display where length() > 0 -> t_coding.display = s_display;
65+
};
66+
};
67+
68+
src.form_coding3_code as s_code where length() > 0 -> t_form then {
69+
src.form_coding3_system as s_system -> t_form.coding = c(s_system, s_code) as t_coding first then {
70+
src.form_coding3_display as s_display where length() > 0 -> t_coding.display = s_display;
71+
};
72+
};
73+
};
74+
75+
src.form_text as s_text where length() > 0 -> t_form.text = s_text;
76+
};
77+
78+
// ingredient 0..*
79+
80+
// ingredient.itemCodeableConcept 1..1
81+
src.ingredient_itemCodeableConcept_coding1_code as s_itemCoding1_code where length() > 0 -> tgt.ingredient as t_ingredient first then {
82+
83+
src.ingredient_itemCodeableConcept_coding1_system as s_itemCoding1_system -> t_ingredient then {
84+
src.ingredient_itemCodeableConcept_coding1_display as s_itemCoding1_display -> t_ingredient.item = cc(s_itemCoding1_system, s_itemCoding1_code, s_itemCoding1_display) as t_item then {
85+
src.ingredient_itemCodeableConcept_coding2_code as s_coding_code where length() > 0 -> t_item then {
86+
src.ingredient_itemCodeableConcept_coding2_system as s_coding_system -> t_item.coding = c(s_coding_system, s_coding_code) as t_coding then {
87+
src.ingredient_itemCodeableConcept_coding2_display as s_coding_display where length() > 0 -> t_coding.display = s_coding_display;
88+
};
89+
};
90+
src.ingredient_itemCodeableConcept_text as s_text where length() > 0 -> t_item.text = s_text;
91+
};
92+
};
93+
94+
// ingredient.strength 0..1 Ratio
95+
src.ingredient_strength_numerator_value as s_value where length() > 0 -> t_ingredient.strength as t_strength then {
96+
s_value -> t_strength.numerator as t_numerator then {
97+
s_value -> t_numerator.value = s_value;
98+
src.ingredient_strength_numerator_unit as s_unit where length() > 0 -> t_numerator.unit = s_unit;
99+
src.ingredient_strength_numerator_code as s_code where length() > 0 -> t_numerator.code = s_code;
100+
src.ingredient_strength_numerator_system as s_system where length() > 0 -> t_numerator.system = s_system;
101+
};
102+
103+
src.ingredient_strength_denominator_value as s_value where length() > 0 -> t_strength then {
104+
s_value -> t_strength.denominator as t_denominator then {
105+
s_value -> t_denominator.value = s_value;
106+
src.ingredient_strength_denominator_unit as s_unit where length() > 0 -> t_denominator.unit = s_unit;
107+
src.ingredient_strength_denominator_code as s_code where length() > 0 -> t_denominator.code = s_code;
108+
src.ingredient_strength_denominator_system as s_system where length() > 0 -> t_denominator.system = s_system;
109+
};
110+
};
111+
};
112+
};
113+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
id,code_coding1_medicationType_code,code_coding1_medicationType_display,code_coding1_system,code_coding1_code,code_coding1_display,code_coding2_system,code_coding2_code,code_coding2_display,code_coding3_system,code_coding3_code,code_coding3_display,code_text,form_coding1_system,form_coding1_code,form_coding1_display,form_coding2_system,form_coding2_code,form_coding2_display,form_coding3_system,form_coding3_code,form_coding3_display,ingredient_itemCodeableConcept_coding1_system,ingredient_itemCodeableConcept_coding1_code,ingredient_itemCodeableConcept_coding1_display,ingredient_itemCodeableConcept_coding2_system,ingredient_itemCodeableConcept_coding2_code,ingredient_itemCodeableConcept_coding2_display,ingredient_strength_numerator_value,ingredient_strength_numerator_unit,ingredient_strength_numerator_system,ingredient_strength_numerator_code,ingredient_strength_denominator_value,ingredient_strength_denominator_unit,ingredient_strength_denominator_system,ingredient_strength_denominator_code
2+
1active-ingredient,BPD,Branded product with no strengths or form,http://snomed.info/sct,4445011000036103,Chlorsig,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
3+
2active-ingredients,,,http://pbs.gov.au/code/item,13382H,PERINDOPRIL + AMLODIPINE,,,,,,,"perindopril arginine 10 mg + amlodipine 10 mg tablet, 30",,,,,,,,,,,,,,,,,,,,,,,
4+
simvastatin,,,http://snomed.info/sct,320000009,Simvastatin 40 mg oral tablet,,,,,,,simvastatin 40 MG Disintegrating Oral Tablet,http://snomed.info/sct,263011000036100,orally disintegrating tablet,,,,,,,http://snomed.info/sct,2588011000036103,simvastatin,,,,40,mg,http://unitsofmeasure.org,mg,1,tablet,http://unitsofmeasure.org,{tbl}
5+
metformin-mp,,,http://snomed.info/sct,21614011000036102,metformin,,,,,,,,http://snomed.info/sct,154011000036109,tablet,,,,,,,,,,,,,,,,,,,,
6+
metformin-mpp,,,http://snomed.info/sct,28037011000036102,"Metformin hydrochloride 500 mg tablet, 100",,,,,,,,http://snomed.info/sct,154011000036109,tablet,,,,,,,,,,,,,,,,,,,,
7+
metformin-tpp,,,http://snomed.info/sct,929529011000036109,"Metformin (Apo) 500 mg tablet, 100",,,,,,,,http://snomed.info/sct,154011000036109,tablet,,,,,,,,,,,,,,,,,,,,
8+
perindopril-amlodipine-mpp,,,http://snomed.info/sct,86430011000036105,"Perindopril arginine 10 mg + amlodipine 10 mg tablet, 30",,,,,,,,http://snomed.info/sct,154011000036109,tablet,,,,,,,,,,,,,,,,,,,,
9+
reaptan-tpp,,,http://snomed.info/sct,926214011000036103,"Reaptan 10 mg/10 mg (perindopril arginine/amlodipine) tablet, 30",,,,,,,,http://snomed.info/sct,154011000036109,tablet,,,,,,,,,,,,,,,,,,,,
10+
reaptan-missing-code,,,,,,,,,,,,,http://snomed.info/sct,154011000036109,tablet,,,,,,,,,,,,,,,,,,,,
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"resourceType": "Medication",
3+
"id": "1active-ingredient",
4+
"meta": {
5+
"profile": [
6+
"http://hl7.org.au/fhir/core/StructureDefinition/au-core-medication"
7+
]
8+
},
9+
"code": {
10+
"coding": [
11+
{
12+
"extension": [
13+
{
14+
"url": "http://hl7.org.au/fhir/StructureDefinition/medication-type",
15+
"valueCoding": {
16+
"system": "http://terminology.hl7.org.au/CodeSystem/medication-type",
17+
"code": "BPD",
18+
"display": "Branded product with no strengths or form"
19+
}
20+
}
21+
],
22+
"system": "http://snomed.info/sct",
23+
"code": "4445011000036103",
24+
"display": "Chlorsig"
25+
}
26+
]
27+
}
28+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"resourceType": "Medication",
3+
"id": "2active-ingredients",
4+
"meta": {
5+
"profile": [
6+
"http://hl7.org.au/fhir/core/StructureDefinition/au-core-medication"
7+
]
8+
},
9+
"code": {
10+
"coding": [
11+
{
12+
"system": "http://pbs.gov.au/code/item",
13+
"code": "13382H",
14+
"display": "PERINDOPRIL + AMLODIPINE"
15+
}
16+
],
17+
"text": "perindopril arginine 10 mg + amlodipine 10 mg tablet, 30"
18+
}
19+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"resourceType": "Medication",
3+
"id": "metformin-mp",
4+
"meta": {
5+
"profile": [
6+
"http://hl7.org.au/fhir/core/StructureDefinition/au-core-medication"
7+
]
8+
},
9+
"code": {
10+
"coding": [
11+
{
12+
"system": "http://snomed.info/sct",
13+
"code": "21614011000036102",
14+
"display": "metformin"
15+
}
16+
]
17+
},
18+
"form": {
19+
"coding": [
20+
{
21+
"system": "http://snomed.info/sct",
22+
"code": "154011000036109",
23+
"display": "tablet"
24+
}
25+
]
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"resourceType": "Medication",
3+
"id": "metformin-mpp",
4+
"meta": {
5+
"profile": [
6+
"http://hl7.org.au/fhir/core/StructureDefinition/au-core-medication"
7+
]
8+
},
9+
"code": {
10+
"coding": [
11+
{
12+
"system": "http://snomed.info/sct",
13+
"code": "28037011000036102",
14+
"display": "Metformin hydrochloride 500 mg tablet, 100"
15+
}
16+
]
17+
},
18+
"form": {
19+
"coding": [
20+
{
21+
"system": "http://snomed.info/sct",
22+
"code": "154011000036109",
23+
"display": "tablet"
24+
}
25+
]
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"resourceType": "Medication",
3+
"id": "metformin-tpp",
4+
"meta": {
5+
"profile": [
6+
"http://hl7.org.au/fhir/core/StructureDefinition/au-core-medication"
7+
]
8+
},
9+
"code": {
10+
"coding": [
11+
{
12+
"system": "http://snomed.info/sct",
13+
"code": "929529011000036109",
14+
"display": "Metformin (Apo) 500 mg tablet, 100"
15+
}
16+
]
17+
},
18+
"form": {
19+
"coding": [
20+
{
21+
"system": "http://snomed.info/sct",
22+
"code": "154011000036109",
23+
"display": "tablet"
24+
}
25+
]
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"resourceType": "Medication",
3+
"id": "perindopril-amlodipine-mpp",
4+
"meta": {
5+
"profile": [
6+
"http://hl7.org.au/fhir/core/StructureDefinition/au-core-medication"
7+
]
8+
},
9+
"code": {
10+
"coding": [
11+
{
12+
"system": "http://snomed.info/sct",
13+
"code": "86430011000036105",
14+
"display": "Perindopril arginine 10 mg + amlodipine 10 mg tablet, 30"
15+
}
16+
]
17+
},
18+
"form": {
19+
"coding": [
20+
{
21+
"system": "http://snomed.info/sct",
22+
"code": "154011000036109",
23+
"display": "tablet"
24+
}
25+
]
26+
}
27+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"resourceType": "Medication",
3+
"id": "reaptan-missing-code",
4+
"meta": {
5+
"profile": [
6+
"http://hl7.org.au/fhir/core/StructureDefinition/au-core-medication"
7+
]
8+
},
9+
"code": {
10+
"coding": [
11+
{
12+
"system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
13+
"code": "unknown"
14+
}
15+
]
16+
},
17+
"form": {
18+
"coding": [
19+
{
20+
"system": "http://snomed.info/sct",
21+
"code": "154011000036109",
22+
"display": "tablet"
23+
}
24+
]
25+
}
26+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"resourceType": "Medication",
3+
"id": "reaptan-tpp",
4+
"meta": {
5+
"profile": [
6+
"http://hl7.org.au/fhir/core/StructureDefinition/au-core-medication"
7+
]
8+
},
9+
"code": {
10+
"coding": [
11+
{
12+
"system": "http://snomed.info/sct",
13+
"code": "926214011000036103",
14+
"display": "Reaptan 10 mg/10 mg (perindopril arginine/amlodipine) tablet, 30"
15+
}
16+
]
17+
},
18+
"form": {
19+
"coding": [
20+
{
21+
"system": "http://snomed.info/sct",
22+
"code": "154011000036109",
23+
"display": "tablet"
24+
}
25+
]
26+
}
27+
}

0 commit comments

Comments
 (0)