Fix AllergyIntolerance conversions & tests

This commit is contained in:
Grahame Grieve 2020-09-01 09:42:52 +10:00
parent 1a681b3b2d
commit 2867e20a42
9 changed files with 286 additions and 122 deletions

View File

@ -12,9 +12,9 @@ public class AllergyIntolerance10_30 {
VersionConvertor_10_30.copyDomainResource(src, tgt);
for (org.hl7.fhir.dstu2.model.Identifier identifier : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(identifier));
if (src.hasOnset())
tgt.setOnset(new org.hl7.fhir.dstu3.model.DateTimeType(src.getOnset()));
tgt.setOnset(VersionConvertor_10_30.convertDateTime(src.getOnsetElement()));
if (src.hasRecordedDate())
tgt.setAssertedDate(src.getRecordedDate());
tgt.setAssertedDateElement(VersionConvertor_10_30.convertDateTime(src.getRecordedDateElement()));
if (src.hasRecorder())
tgt.setRecorder(VersionConvertor_10_30.convertReference(src.getRecorder()));
if (src.hasPatient())
@ -40,7 +40,7 @@ public class AllergyIntolerance10_30 {
if (src.hasCategory())
tgt.addCategory(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.fromCode(src.getCategory().toCode()));
if (src.hasLastOccurence())
tgt.setLastOccurrence(src.getLastOccurence());
tgt.setLastOccurrenceElement(VersionConvertor_10_30.convertDateTime(src.getLastOccurenceElement()));
if (src.hasNote())
tgt.addNote(VersionConvertor_10_30.convertAnnotation(src.getNote()));
for (org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceReactionComponent reaction : src.getReaction())
@ -63,9 +63,9 @@ public class AllergyIntolerance10_30 {
));
for (org.hl7.fhir.dstu2.model.CodeableConcept concept : src.getManifestation()) tgt.addManifestation(VersionConvertor_10_30.convertCodeableConcept(concept));
if (src.hasDescription())
src.setDescription(src.getDescription());
tgt.setDescriptionElement(VersionConvertor_10_30.convertString(src.getDescriptionElement()));
if (src.hasOnset())
tgt.setOnset(src.getOnset());
tgt.setOnsetElement(VersionConvertor_10_30.convertDateTime(src.getOnsetElement()));
if (src.hasSeverity())
tgt.setSeverity(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.fromCode(src.getSeverity().toCode()));
if (src.hasExposureRoute())

View File

@ -13,7 +13,7 @@ public class AllergyIntolerance10_40 {
if (src.hasOnset())
tgt.setOnset(VersionConvertor_10_40.convertType(src.getOnsetElement()));
if (src.hasRecordedDate())
tgt.setRecordedDate(src.getRecordedDate());
tgt.setRecordedDateElement(VersionConvertor_10_40.convertDateTime(src.getRecordedDateElement()));
if (src.hasRecorder())
tgt.setRecorder(VersionConvertor_10_40.convertReference(src.getRecorder()));
if (src.hasPatient())
@ -44,8 +44,8 @@ public class AllergyIntolerance10_40 {
tgt.setType(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.fromCode(src.getType().toCode()));
if (src.hasCategory())
tgt.addCategory(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.fromCode(src.getCategory().toCode()));
if (src.hasLastOccurence())
tgt.setLastOccurrence(src.getLastOccurence());
if (src.hasLastOccurenceElement())
tgt.setLastOccurrenceElement(VersionConvertor_10_40.convertDateTime(src.getLastOccurenceElement()));
if (src.hasNote())
tgt.addNote(VersionConvertor_10_40.convertAnnotation(src.getNote()));
for (org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceReactionComponent reaction : src.getReaction())
@ -68,9 +68,9 @@ public class AllergyIntolerance10_40 {
));
for (org.hl7.fhir.dstu2.model.CodeableConcept concept : src.getManifestation()) tgt.addManifestation(VersionConvertor_10_40.convertCodeableConcept(concept));
if (src.hasDescription())
src.setDescription(src.getDescription());
tgt.setDescriptionElement(VersionConvertor_10_40.convertString(src.getDescriptionElement()));
if (src.hasOnset())
tgt.setOnset(src.getOnset());
tgt.setOnsetElement(VersionConvertor_10_40.convertDateTime(src.getOnsetElement()));
if (src.hasSeverity())
tgt.setSeverity(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.fromCode(src.getSeverity().toCode()));
if (src.hasExposureRoute())

View File

@ -36,6 +36,14 @@ public class AllergyIntolerance10_30Test {
org.hl7.fhir.dstu3.formats.JsonParser stu_parser = new org.hl7.fhir.dstu3.formats.JsonParser();
org.hl7.fhir.dstu3.model.Resource stu_expected = stu_parser.parse(stu_exepected_input);
if (!stu_expected.equalsDeep(stu_actual)) {
System.out.println("Expected");
System.out.println(stu_parser.composeString(stu_expected));
System.out.println();
System.out.println("Actual");
System.out.println(stu_parser.composeString(stu_actual));
}
Assertions.assertTrue(stu_expected.equalsDeep(stu_actual),
"Failed comparing\n" + stu_parser.composeString(stu_actual) + "\nand\n" + stu_parser.composeString(stu_expected)
);

View File

@ -36,8 +36,14 @@ public class AllergyIntolerance10_40Test {
org.hl7.fhir.r4.formats.JsonParser r4_parser = new org.hl7.fhir.r4.formats.JsonParser();
org.hl7.fhir.r4.model.Resource r4_expected = r4_parser.parse(r4_exepected_input);
Assertions.assertTrue(r4_expected.equalsDeep(r4_actual),
"Failed comparing\n" + r4_parser.composeString(r4_actual) + "\nand\n" + r4_parser.composeString(r4_expected)
if (!r4_expected.equalsDeep(r4_actual)) {
System.out.println("Expected");
System.out.println(r4_parser.composeString(r4_expected));
System.out.println();
System.out.println("Actual");
System.out.println(r4_parser.composeString(r4_actual));
}
Assertions.assertTrue(r4_expected.equalsDeep(r4_actual), "Failed comparing\n" + r4_parser.composeString(r4_actual) + "\nand\n" + r4_parser.composeString(r4_expected)
);
}
}

View File

@ -1,20 +1,42 @@
{"resourceType": "AllergyIntolerance",
"recordedDate": "2015-08-25T02:11:36",
"status": "confirmed",
"criticality": "CRITL",
"id": "TBwnNbrAqC0Qw5Ha7AFT-2AB",
"onset": "2012-11-07T00:00:00Z",
"recorder": {"display": "MOORE, NICK",
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB"},
"patient": {"display": "Jason Argonaut",
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB"},
"substance": {"text": "PENICILLIN G",
"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "7980",
"display": "PENICILLIN G"},
{"system": "http://fdasis.nlm.nih.gov",
"code": "Q42T66VG0C",
"display": "PENICILLIN G"}]},
"reaction": [{"certainty": "confirmed",
"onset": "2012-11-07T00:00:00Z",
"manifestation": [{"text": "Hives"}]}]}
{
"resourceType" : "AllergyIntolerance",
"recordedDate" : "2015-08-25T02:11:36",
"status" : "confirmed",
"criticality" : "CRITL",
"id" : "TBwnNbrAqC0Qw5Ha7AFT-2AB",
"onset" : "2012-11-07T00:00:00Z",
"recorder" : {
"display" : "MOORE, NICK",
"reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB"
},
"patient" : {
"display" : "Jason Argonaut",
"reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB"
},
"substance" : {
"text" : "PENICILLIN G",
"coding" : [
{
"system" : "http://www.nlm.nih.gov/research/umls/rxnorm",
"code" : "7980",
"display" : "PENICILLIN G"
},
{
"system" : "http://fdasis.nlm.nih.gov",
"code" : "Q42T66VG0C",
"display" : "PENICILLIN G"
}
]
},
"reaction" : [
{
"certainty" : "confirmed",
"onset" : "2012-11-07T00:00:00Z",
"manifestation" : [
{
"text" : "Hives"
}
]
}
]
}

View File

@ -1,22 +1,48 @@
{"resourceType": "AllergyIntolerance",
"id": "TBwnNbrAqC0Qw5Ha7AFT-2AB",
"clinicalStatus": "active",
"verificationStatus": "confirmed",
"criticality": "low",
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "7980",
"display": "PENICILLIN G"},
{"system": "http://fdasis.nlm.nih.gov",
"code": "Q42T66VG0C",
"display": "PENICILLIN G"}],
"text": "PENICILLIN G"},
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
"display": "Jason Argonaut"},
"onsetDateTime": "2012-11-07T00:00:00",
"assertedDate": "2015-08-25T02:11:36",
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
"display": "MOORE, NICK"},
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
"valueString": "confirmed"}],
"manifestation": [{"text": "Hives"}],
"onset": "2012-11-07T00:00:00"}]}
{
"resourceType" : "AllergyIntolerance",
"id" : "TBwnNbrAqC0Qw5Ha7AFT-2AB",
"clinicalStatus" : "active",
"verificationStatus" : "confirmed",
"criticality" : "low",
"code" : {
"coding" : [
{
"system" : "http://www.nlm.nih.gov/research/umls/rxnorm",
"code" : "7980",
"display" : "PENICILLIN G"
},
{
"system" : "http://fdasis.nlm.nih.gov",
"code" : "Q42T66VG0C",
"display" : "PENICILLIN G"
}
],
"text" : "PENICILLIN G"
},
"patient" : {
"reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
"display" : "Jason Argonaut"
},
"onsetDateTime" : "2012-11-07T00:00:00Z",
"assertedDate" : "2015-08-25T02:11:36",
"recorder" : {
"reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
"display" : "MOORE, NICK"
},
"reaction" : [
{
"extension" : [
{
"url" : "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
"valueString" : "confirmed"
}
],
"manifestation" : [
{
"text" : "Hives"
}
],
"onset" : "2012-11-07T00:00:00Z"
}
]
}

View File

@ -1,23 +1,61 @@
{"resourceType": "AllergyIntolerance",
"clinicalStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
"code": "confirmed"}]},
"verificationStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
"code": "confirmed"}]},
"criticality": "low",
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "7980",
"display": "PENICILLIN G"},
{"system": "http://fdasis.nlm.nih.gov",
"code": "Q42T66VG0C",
"display": "PENICILLIN G"}],
"text": "PENICILLIN G"},
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
"display": "Jason Argonaut"},
"onsetDateTime": "2012-11-07T00:00:00Z",
"recordedDate": "2015-08-25T02:11:36",
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
"display": "MOORE, NICK"},
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
"valueString": "confirmed"}],
"manifestation": [{"text": "Hives"}],
"onset": "2012-11-07T00:00:00"}]}
{
"resourceType" : "AllergyIntolerance",
"clinicalStatus" : {
"coding" : [
{
"system" : "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
"code" : "confirmed"
}
]
},
"verificationStatus" : {
"coding" : [
{
"system" : "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
"code" : "confirmed"
}
]
},
"criticality" : "low",
"code" : {
"coding" : [
{
"system" : "http://www.nlm.nih.gov/research/umls/rxnorm",
"code" : "7980",
"display" : "PENICILLIN G"
},
{
"system" : "http://fdasis.nlm.nih.gov",
"code" : "Q42T66VG0C",
"display" : "PENICILLIN G"
}
],
"text" : "PENICILLIN G"
},
"patient" : {
"reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
"display" : "Jason Argonaut"
},
"onsetDateTime" : "2012-11-07T00:00:00Z",
"recordedDate" : "2015-08-25T02:11:36",
"recorder" : {
"reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
"display" : "MOORE, NICK"
},
"reaction" : [
{
"extension" : [
{
"url" : "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
"valueString" : "confirmed"
}
],
"manifestation" : [
{
"text" : "Hives"
}
],
"onset" : "2012-11-07T00:00:00Z"
}
]
}

View File

@ -1,22 +1,48 @@
{"resourceType": "AllergyIntolerance",
"id": "TKebKfLXzu6Sp.LY-IpvpmQB",
"clinicalStatus": "active",
"verificationStatus": "confirmed",
"criticality": "high",
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "892484",
"display": "STRAWBERRY"},
{"system": "http://fdasis.nlm.nih.gov",
"code": "4J2TY8Y81V",
"display": "STRAWBERRY"}],
"text": "STRAWBERRY"},
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
"display": "Jason Argonaut"},
"onsetDateTime": "2014-03-07T00:00:00",
"assertedDate": "2015-11-07T22:56:34",
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
"display": "MOORE, NICK"},
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
"valueString": "confirmed"}],
"manifestation": [{"text": "Anaphylaxis"}],
"onset": "2014-03-07T00:00:00"}]}
{
"resourceType" : "AllergyIntolerance",
"id" : "TKebKfLXzu6Sp.LY-IpvpmQB",
"clinicalStatus" : "active",
"verificationStatus" : "confirmed",
"criticality" : "high",
"code" : {
"coding" : [
{
"system" : "http://www.nlm.nih.gov/research/umls/rxnorm",
"code" : "892484",
"display" : "STRAWBERRY"
},
{
"system" : "http://fdasis.nlm.nih.gov",
"code" : "4J2TY8Y81V",
"display" : "STRAWBERRY"
}
],
"text" : "STRAWBERRY"
},
"patient" : {
"reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
"display" : "Jason Argonaut"
},
"onsetDateTime" : "2014-03-07T00:00:00Z",
"assertedDate" : "2015-11-07T22:56:34",
"recorder" : {
"reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
"display" : "MOORE, NICK"
},
"reaction" : [
{
"extension" : [
{
"url" : "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
"valueString" : "confirmed"
}
],
"manifestation" : [
{
"text" : "Anaphylaxis"
}
],
"onset" : "2014-03-07T00:00:00Z"
}
]
}

View File

@ -1,23 +1,61 @@
{"resourceType": "AllergyIntolerance",
"clinicalStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
"code": "confirmed"}]},
"verificationStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
"code": "confirmed"}]},
"criticality": "high",
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "892484",
"display": "STRAWBERRY"},
{"system": "http://fdasis.nlm.nih.gov",
"code": "4J2TY8Y81V",
"display": "STRAWBERRY"}],
"text": "STRAWBERRY"},
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
"display": "Jason Argonaut"},
"onsetDateTime": "2014-03-07T00:00:00Z",
"recordedDate": "2015-11-07T22:56:34",
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
"display": "MOORE, NICK"},
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
"valueString": "confirmed"}],
"manifestation": [{"text": "Anaphylaxis"}],
"onset": "2014-03-07T00:00:00"}]}
{
"resourceType" : "AllergyIntolerance",
"clinicalStatus" : {
"coding" : [
{
"system" : "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
"code" : "confirmed"
}
]
},
"verificationStatus" : {
"coding" : [
{
"system" : "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
"code" : "confirmed"
}
]
},
"criticality" : "high",
"code" : {
"coding" : [
{
"system" : "http://www.nlm.nih.gov/research/umls/rxnorm",
"code" : "892484",
"display" : "STRAWBERRY"
},
{
"system" : "http://fdasis.nlm.nih.gov",
"code" : "4J2TY8Y81V",
"display" : "STRAWBERRY"
}
],
"text" : "STRAWBERRY"
},
"patient" : {
"reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
"display" : "Jason Argonaut"
},
"onsetDateTime" : "2014-03-07T00:00:00Z",
"recordedDate" : "2015-11-07T22:56:34",
"recorder" : {
"reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
"display" : "MOORE, NICK"
},
"reaction" : [
{
"extension" : [
{
"url" : "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
"valueString" : "confirmed"
}
],
"manifestation" : [
{
"text" : "Anaphylaxis"
}
],
"onset" : "2014-03-07T00:00:00Z"
}
]
}