Merge pull request #331 from hapifhir/gg-v517b

Prepare for new release
This commit is contained in:
Grahame Grieve 2020-09-01 10:43:41 +10:00 committed by GitHub
commit cb73cbe7c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 321 additions and 125 deletions

View File

@ -0,0 +1,14 @@
Validator:
* Better validation of bad references (and fix NPE)
* Rework output to be more informative and cleaner
* Fix bugs in validation of nested bundles
* Fix bug loading package with no specified version
* fix bugs loading discovered packages on the fly
* Validator now supports logical models in XML wkith no namespaces
Other code changes:
* Add version conversion for AllergyIntolerance (1.2 <-> 3.0 & 1.2 <-> 4.0)
* Add version conversion for MedicationRequest
* Fix rendering of documents
* fix for not rendering null values in patterns for must-support view

View File

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

View File

@ -13,7 +13,7 @@ public class AllergyIntolerance10_40 {
if (src.hasOnset()) if (src.hasOnset())
tgt.setOnset(VersionConvertor_10_40.convertType(src.getOnsetElement())); tgt.setOnset(VersionConvertor_10_40.convertType(src.getOnsetElement()));
if (src.hasRecordedDate()) if (src.hasRecordedDate())
tgt.setRecordedDate(src.getRecordedDate()); tgt.setRecordedDateElement(VersionConvertor_10_40.convertDateTime(src.getRecordedDateElement()));
if (src.hasRecorder()) if (src.hasRecorder())
tgt.setRecorder(VersionConvertor_10_40.convertReference(src.getRecorder())); tgt.setRecorder(VersionConvertor_10_40.convertReference(src.getRecorder()));
if (src.hasPatient()) if (src.hasPatient())
@ -44,8 +44,8 @@ public class AllergyIntolerance10_40 {
tgt.setType(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.fromCode(src.getType().toCode())); tgt.setType(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.fromCode(src.getType().toCode()));
if (src.hasCategory()) if (src.hasCategory())
tgt.addCategory(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.fromCode(src.getCategory().toCode())); tgt.addCategory(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.fromCode(src.getCategory().toCode()));
if (src.hasLastOccurence()) if (src.hasLastOccurenceElement())
tgt.setLastOccurrence(src.getLastOccurence()); tgt.setLastOccurrenceElement(VersionConvertor_10_40.convertDateTime(src.getLastOccurenceElement()));
if (src.hasNote()) if (src.hasNote())
tgt.addNote(VersionConvertor_10_40.convertAnnotation(src.getNote())); tgt.addNote(VersionConvertor_10_40.convertAnnotation(src.getNote()));
for (org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceReactionComponent reaction : src.getReaction()) 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)); for (org.hl7.fhir.dstu2.model.CodeableConcept concept : src.getManifestation()) tgt.addManifestation(VersionConvertor_10_40.convertCodeableConcept(concept));
if (src.hasDescription()) if (src.hasDescription())
src.setDescription(src.getDescription()); tgt.setDescriptionElement(VersionConvertor_10_40.convertString(src.getDescriptionElement()));
if (src.hasOnset()) if (src.hasOnset())
tgt.setOnset(src.getOnset()); tgt.setOnsetElement(VersionConvertor_10_40.convertDateTime(src.getOnsetElement()));
if (src.hasSeverity()) if (src.hasSeverity())
tgt.setSeverity(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.fromCode(src.getSeverity().toCode())); tgt.setSeverity(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.fromCode(src.getSeverity().toCode()));
if (src.hasExposureRoute()) 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.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); 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), Assertions.assertTrue(stu_expected.equalsDeep(stu_actual),
"Failed comparing\n" + stu_parser.composeString(stu_actual) + "\nand\n" + stu_parser.composeString(stu_expected) "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.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); org.hl7.fhir.r4.model.Resource r4_expected = r4_parser.parse(r4_exepected_input);
Assertions.assertTrue(r4_expected.equalsDeep(r4_actual), if (!r4_expected.equalsDeep(r4_actual)) {
"Failed comparing\n" + r4_parser.composeString(r4_actual) + "\nand\n" + r4_parser.composeString(r4_expected) 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", {
"resourceType" : "AllergyIntolerance",
"recordedDate" : "2015-08-25T02:11:36", "recordedDate" : "2015-08-25T02:11:36",
"status" : "confirmed", "status" : "confirmed",
"criticality" : "CRITL", "criticality" : "CRITL",
"id" : "TBwnNbrAqC0Qw5Ha7AFT-2AB", "id" : "TBwnNbrAqC0Qw5Ha7AFT-2AB",
"onset" : "2012-11-07T00:00:00Z", "onset" : "2012-11-07T00:00:00Z",
"recorder": {"display": "MOORE, NICK", "recorder" : {
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB"}, "display" : "MOORE, NICK",
"patient": {"display": "Jason Argonaut", "reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB"
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB"}, },
"substance": {"text": "PENICILLIN G", "patient" : {
"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm", "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", "code" : "7980",
"display": "PENICILLIN G"}, "display" : "PENICILLIN G"
{"system": "http://fdasis.nlm.nih.gov", },
{
"system" : "http://fdasis.nlm.nih.gov",
"code" : "Q42T66VG0C", "code" : "Q42T66VG0C",
"display": "PENICILLIN G"}]}, "display" : "PENICILLIN G"
"reaction": [{"certainty": "confirmed", }
]
},
"reaction" : [
{
"certainty" : "confirmed",
"onset" : "2012-11-07T00:00:00Z", "onset" : "2012-11-07T00:00:00Z",
"manifestation": [{"text": "Hives"}]}]} "manifestation" : [
{
"text" : "Hives"
}
]
}
]
}

View File

@ -1,22 +1,48 @@
{"resourceType": "AllergyIntolerance", {
"resourceType" : "AllergyIntolerance",
"id" : "TBwnNbrAqC0Qw5Ha7AFT-2AB", "id" : "TBwnNbrAqC0Qw5Ha7AFT-2AB",
"clinicalStatus" : "active", "clinicalStatus" : "active",
"verificationStatus" : "confirmed", "verificationStatus" : "confirmed",
"criticality" : "low", "criticality" : "low",
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code" : {
"coding" : [
{
"system" : "http://www.nlm.nih.gov/research/umls/rxnorm",
"code" : "7980", "code" : "7980",
"display": "PENICILLIN G"}, "display" : "PENICILLIN G"
{"system": "http://fdasis.nlm.nih.gov", },
{
"system" : "http://fdasis.nlm.nih.gov",
"code" : "Q42T66VG0C", "code" : "Q42T66VG0C",
"display": "PENICILLIN G"}], "display" : "PENICILLIN G"
"text": "PENICILLIN G"}, }
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB", ],
"display": "Jason Argonaut"}, "text" : "PENICILLIN G"
"onsetDateTime": "2012-11-07T00:00:00", },
"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", "assertedDate" : "2015-08-25T02:11:36",
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB", "recorder" : {
"display": "MOORE, NICK"}, "reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty", "display" : "MOORE, NICK"
"valueString": "confirmed"}], },
"manifestation": [{"text": "Hives"}], "reaction" : [
"onset": "2012-11-07T00:00:00"}]} {
"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", "resourceType" : "AllergyIntolerance",
"code": "confirmed"}]}, "clinicalStatus" : {
"verificationStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "coding" : [
"code": "confirmed"}]}, {
"system" : "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
"code" : "confirmed"
}
]
},
"verificationStatus" : {
"coding" : [
{
"system" : "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
"code" : "confirmed"
}
]
},
"criticality" : "low", "criticality" : "low",
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code" : {
"coding" : [
{
"system" : "http://www.nlm.nih.gov/research/umls/rxnorm",
"code" : "7980", "code" : "7980",
"display": "PENICILLIN G"}, "display" : "PENICILLIN G"
{"system": "http://fdasis.nlm.nih.gov", },
{
"system" : "http://fdasis.nlm.nih.gov",
"code" : "Q42T66VG0C", "code" : "Q42T66VG0C",
"display": "PENICILLIN G"}], "display" : "PENICILLIN G"
"text": "PENICILLIN G"}, }
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB", ],
"display": "Jason Argonaut"}, "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", "onsetDateTime" : "2012-11-07T00:00:00Z",
"recordedDate" : "2015-08-25T02:11:36", "recordedDate" : "2015-08-25T02:11:36",
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB", "recorder" : {
"display": "MOORE, NICK"}, "reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty", "display" : "MOORE, NICK"
"valueString": "confirmed"}], },
"manifestation": [{"text": "Hives"}], "reaction" : [
"onset": "2012-11-07T00:00:00"}]} {
"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", {
"resourceType" : "AllergyIntolerance",
"id" : "TKebKfLXzu6Sp.LY-IpvpmQB", "id" : "TKebKfLXzu6Sp.LY-IpvpmQB",
"clinicalStatus" : "active", "clinicalStatus" : "active",
"verificationStatus" : "confirmed", "verificationStatus" : "confirmed",
"criticality" : "high", "criticality" : "high",
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code" : {
"coding" : [
{
"system" : "http://www.nlm.nih.gov/research/umls/rxnorm",
"code" : "892484", "code" : "892484",
"display": "STRAWBERRY"}, "display" : "STRAWBERRY"
{"system": "http://fdasis.nlm.nih.gov", },
{
"system" : "http://fdasis.nlm.nih.gov",
"code" : "4J2TY8Y81V", "code" : "4J2TY8Y81V",
"display": "STRAWBERRY"}], "display" : "STRAWBERRY"
"text": "STRAWBERRY"}, }
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB", ],
"display": "Jason Argonaut"}, "text" : "STRAWBERRY"
"onsetDateTime": "2014-03-07T00:00:00", },
"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", "assertedDate" : "2015-11-07T22:56:34",
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB", "recorder" : {
"display": "MOORE, NICK"}, "reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty", "display" : "MOORE, NICK"
"valueString": "confirmed"}], },
"manifestation": [{"text": "Anaphylaxis"}], "reaction" : [
"onset": "2014-03-07T00:00:00"}]} {
"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", "resourceType" : "AllergyIntolerance",
"code": "confirmed"}]}, "clinicalStatus" : {
"verificationStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "coding" : [
"code": "confirmed"}]}, {
"system" : "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
"code" : "confirmed"
}
]
},
"verificationStatus" : {
"coding" : [
{
"system" : "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
"code" : "confirmed"
}
]
},
"criticality" : "high", "criticality" : "high",
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code" : {
"coding" : [
{
"system" : "http://www.nlm.nih.gov/research/umls/rxnorm",
"code" : "892484", "code" : "892484",
"display": "STRAWBERRY"}, "display" : "STRAWBERRY"
{"system": "http://fdasis.nlm.nih.gov", },
{
"system" : "http://fdasis.nlm.nih.gov",
"code" : "4J2TY8Y81V", "code" : "4J2TY8Y81V",
"display": "STRAWBERRY"}], "display" : "STRAWBERRY"
"text": "STRAWBERRY"}, }
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB", ],
"display": "Jason Argonaut"}, "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", "onsetDateTime" : "2014-03-07T00:00:00Z",
"recordedDate" : "2015-11-07T22:56:34", "recordedDate" : "2015-11-07T22:56:34",
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB", "recorder" : {
"display": "MOORE, NICK"}, "reference" : "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty", "display" : "MOORE, NICK"
"valueString": "confirmed"}], },
"manifestation": [{"text": "Anaphylaxis"}], "reaction" : [
"onset": "2014-03-07T00:00:00"}]} {
"extension" : [
{
"url" : "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
"valueString" : "confirmed"
}
],
"manifestation" : [
{
"text" : "Anaphylaxis"
}
],
"onset" : "2014-03-07T00:00:00Z"
}
]
}

View File

@ -331,6 +331,7 @@ public class I18nConstants {
public static final String REFERENCE_REF_NOTFOUND_BUNDLE = "Reference_REF_NotFound_Bundle"; public static final String REFERENCE_REF_NOTFOUND_BUNDLE = "Reference_REF_NotFound_Bundle";
public static final String REFERENCE_REF_NOTYPE = "Reference_REF_NoType"; public static final String REFERENCE_REF_NOTYPE = "Reference_REF_NoType";
public static final String REFERENCE_REF_RESOURCETYPE = "Reference_REF_ResourceType"; public static final String REFERENCE_REF_RESOURCETYPE = "Reference_REF_ResourceType";
public static final String REFERENCE_REF_SUSPICIOUS = "REFERENCE_REF_SUSPICIOUS";
public static final String REFERENCE_REF_WRONGTARGET = "Reference_REF_WrongTarget"; public static final String REFERENCE_REF_WRONGTARGET = "Reference_REF_WrongTarget";
public static final String REFERENCE_TO__CANNOT_BE_RESOLVED = "reference_to__cannot_be_resolved"; public static final String REFERENCE_TO__CANNOT_BE_RESOLVED = "reference_to__cannot_be_resolved";
public static final String REFERENCE__REFERS_TO_A__NOT_A_VALUESET = "Reference__refers_to_a__not_a_ValueSet"; public static final String REFERENCE__REFERS_TO_A__NOT_A_VALUESET = "Reference__refers_to_a__not_a_ValueSet";

View File

@ -604,3 +604,4 @@ FHIRPATH_BAD_DATE = Unable to parse Date {0}
FHIRPATH_NUMERICAL_ONLY = Error evaluating FHIRPath expression: The function {0} can only be used on integer, decimal or Quantity but found {1} FHIRPATH_NUMERICAL_ONLY = Error evaluating FHIRPath expression: The function {0} can only be used on integer, decimal or Quantity but found {1}
FHIRPATH_DECIMAL_ONLY = Error evaluating FHIRPath expression: The function {0} can only be used on a decimal but found {1} FHIRPATH_DECIMAL_ONLY = Error evaluating FHIRPath expression: The function {0} can only be used on a decimal but found {1}
FHIRPATH_FOCUS_PLURAL = Error evaluating FHIRPath expression: focus for {0} has more than one value FHIRPATH_FOCUS_PLURAL = Error evaluating FHIRPath expression: focus for {0} has more than one value
REFERENCE_REF_SUSPICIOUS = The syntax of the reference ''{0}'' looks incorrect, and it should be checked

View File

@ -2398,6 +2398,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
// special known URLs that can't be validated but are known to be valid // special known URLs that can't be validated but are known to be valid
return; return;
} }
warning(errors, IssueType.STRUCTURE, element.line(), element.col(), path, !isSuspiciousReference(ref), I18nConstants.REFERENCE_REF_SUSPICIOUS, ref);
ResolvedReference we = localResolve(ref, stack, errors, path, (Element) hostContext.getAppContext(), element); ResolvedReference we = localResolve(ref, stack, errors, path, (Element) hostContext.getAppContext(), element);
String refType; String refType;
@ -2439,10 +2440,11 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} }
String ft; String ft;
if (we != null) if (we != null) {
ft = we.getType(); ft = we.getType();
else } else {
ft = tryParse(ref); ft = tryParse(ref);
}
if (reference.hasType()) { // R4 onwards... if (reference.hasType()) { // R4 onwards...
// the type has to match the specified // the type has to match the specified
@ -2596,6 +2598,20 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} }
} }
private boolean isSuspiciousReference(String url) {
if (!assumeValidRestReferences || url == null || Utilities.isAbsoluteUrl(url)) {
return false;
}
String[] parts = url.split("\\/");
if (parts.length == 2 && context.getResourceNames().contains(parts[0]) && Utilities.isValidId(parts[1])) {
return false;
}
if (parts.length == 4 && context.getResourceNames().contains(parts[0]) && Utilities.isValidId(parts[1]) && "_history".equals(parts[2]) && Utilities.isValidId(parts[3])) {
return false;
}
return true;
}
private String asListByUrl(Collection<StructureDefinition> list) { private String asListByUrl(Collection<StructureDefinition> list) {
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
for (StructureDefinition sd : list) { for (StructureDefinition sd : list) {
@ -4842,7 +4858,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
case 2: case 2:
return checkResourceType(parts[0]); return checkResourceType(parts[0]);
default: default:
if (parts[parts.length - 2].equals("_history")) if (parts[parts.length - 2].equals("_history") && parts.length >= 4)
return checkResourceType(parts[parts.length - 4]); return checkResourceType(parts[parts.length - 4]);
else else
return checkResourceType(parts[parts.length - 2]); return checkResourceType(parts[parts.length - 2]);