Merge branch 'master' into ValueSet-display-names

This commit is contained in:
Grahame Grieve 2019-05-28 08:01:09 +10:00 committed by GitHub
commit c9a3d8efc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 190 additions and 80 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.37-SNAPSHOT</version> <version>3.7.38-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.37-SNAPSHOT</version> <version>3.7.38-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.37-SNAPSHOT</version> <version>3.7.38-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.37-SNAPSHOT</version> <version>3.7.38-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.37-SNAPSHOT</version> <version>3.7.38-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.37-SNAPSHOT</version> <version>3.7.38-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -800,8 +800,12 @@ public abstract class BaseWorkerContext implements IWorkerContext {
public Resource fetchResourceById(String type, String uri) { public Resource fetchResourceById(String type, String uri) {
synchronized (lock) { synchronized (lock) {
String[] parts = uri.split("\\/"); String[] parts = uri.split("\\/");
if (!Utilities.noString(type) && parts.length == 1) if (!Utilities.noString(type) && parts.length == 1) {
return allResourcesById.get(type).get(parts[0]); if (allResourcesById.containsKey(type))
return allResourcesById.get(type).get(parts[0]);
else
return null;
}
if (parts.length >= 2) { if (parts.length >= 2) {
if (!Utilities.noString(type)) if (!Utilities.noString(type))
if (!type.equals(parts[parts.length-2])) if (!type.equals(parts[parts.length-2]))

View File

@ -59,4 +59,5 @@ public class Constants {
public final static String BUILD_ID = "e0e3caf9ba"; public final static String BUILD_ID = "e0e3caf9ba";
public final static String DATE = "Thu Dec 13 14:07:26 AEDT 2018"; public final static String DATE = "Thu Dec 13 14:07:26 AEDT 2018";
public final static String URI_REGEX = "((http|https)://([A-Za-z0-9\\\\\\.\\:\\%\\$]*\\/)*)?(Account|ActivityDefinition|AdverseEvent|AllergyIntolerance|Appointment|AppointmentResponse|AuditEvent|Basic|Binary|BiologicallyDerivedProduct|BodyStructure|Bundle|CapabilityStatement|CarePlan|CareTeam|CatalogEntry|ChargeItem|ChargeItemDefinition|Claim|ClaimResponse|ClinicalImpression|CodeSystem|Communication|CommunicationRequest|CompartmentDefinition|Composition|ConceptMap|Condition|Consent|Contract|Coverage|CoverageEligibilityRequest|CoverageEligibilityResponse|DetectedIssue|Device|DeviceDefinition|DeviceMetric|DeviceRequest|DeviceUseStatement|DiagnosticReport|DocumentManifest|DocumentReference|EffectEvidenceSynthesis|Encounter|Endpoint|EnrollmentRequest|EnrollmentResponse|EpisodeOfCare|EventDefinition|Evidence|EvidenceVariable|ExampleScenario|ExplanationOfBenefit|FamilyMemberHistory|Flag|Goal|GraphDefinition|Group|GuidanceResponse|HealthcareService|ImagingStudy|Immunization|ImmunizationEvaluation|ImmunizationRecommendation|ImplementationGuide|InsurancePlan|Invoice|Library|Linkage|List|Location|Measure|MeasureReport|Media|Medication|MedicationAdministration|MedicationDispense|MedicationKnowledge|MedicationRequest|MedicationStatement|MedicinalProduct|MedicinalProductAuthorization|MedicinalProductContraindication|MedicinalProductIndication|MedicinalProductIngredient|MedicinalProductInteraction|MedicinalProductManufactured|MedicinalProductPackaged|MedicinalProductPharmaceutical|MedicinalProductUndesirableEffect|MessageDefinition|MessageHeader|MolecularSequence|NamingSystem|NutritionOrder|Observation|ObservationDefinition|OperationDefinition|OperationOutcome|Organization|OrganizationAffiliation|Patient|PaymentNotice|PaymentReconciliation|Person|PlanDefinition|Practitioner|PractitionerRole|Procedure|Provenance|Questionnaire|QuestionnaireResponse|RelatedPerson|RequestGroup|ResearchDefinition|ResearchElementDefinition|ResearchStudy|ResearchSubject|RiskAssessment|RiskEvidenceSynthesis|Schedule|SearchParameter|ServiceRequest|Slot|Specimen|SpecimenDefinition|StructureDefinition|StructureMap|Subscription|Substance|SubstanceNucleicAcid|SubstancePolymer|SubstanceProtein|SubstanceReferenceInformation|SubstanceSourceMaterial|SubstanceSpecification|SupplyDelivery|SupplyRequest|Task|TerminologyCapabilities|TestReport|TestScript|ValueSet|VerificationResult|VisionPrescription)\\/[A-Za-z0-9\\-\\.]{1,64}(\\/_history\\/[A-Za-z0-9\\-\\.]{1,64})?"; public final static String URI_REGEX = "((http|https)://([A-Za-z0-9\\\\\\.\\:\\%\\$]*\\/)*)?(Account|ActivityDefinition|AdverseEvent|AllergyIntolerance|Appointment|AppointmentResponse|AuditEvent|Basic|Binary|BiologicallyDerivedProduct|BodyStructure|Bundle|CapabilityStatement|CarePlan|CareTeam|CatalogEntry|ChargeItem|ChargeItemDefinition|Claim|ClaimResponse|ClinicalImpression|CodeSystem|Communication|CommunicationRequest|CompartmentDefinition|Composition|ConceptMap|Condition|Consent|Contract|Coverage|CoverageEligibilityRequest|CoverageEligibilityResponse|DetectedIssue|Device|DeviceDefinition|DeviceMetric|DeviceRequest|DeviceUseStatement|DiagnosticReport|DocumentManifest|DocumentReference|EffectEvidenceSynthesis|Encounter|Endpoint|EnrollmentRequest|EnrollmentResponse|EpisodeOfCare|EventDefinition|Evidence|EvidenceVariable|ExampleScenario|ExplanationOfBenefit|FamilyMemberHistory|Flag|Goal|GraphDefinition|Group|GuidanceResponse|HealthcareService|ImagingStudy|Immunization|ImmunizationEvaluation|ImmunizationRecommendation|ImplementationGuide|InsurancePlan|Invoice|Library|Linkage|List|Location|Measure|MeasureReport|Media|Medication|MedicationAdministration|MedicationDispense|MedicationKnowledge|MedicationRequest|MedicationStatement|MedicinalProduct|MedicinalProductAuthorization|MedicinalProductContraindication|MedicinalProductIndication|MedicinalProductIngredient|MedicinalProductInteraction|MedicinalProductManufactured|MedicinalProductPackaged|MedicinalProductPharmaceutical|MedicinalProductUndesirableEffect|MessageDefinition|MessageHeader|MolecularSequence|NamingSystem|NutritionOrder|Observation|ObservationDefinition|OperationDefinition|OperationOutcome|Organization|OrganizationAffiliation|Patient|PaymentNotice|PaymentReconciliation|Person|PlanDefinition|Practitioner|PractitionerRole|Procedure|Provenance|Questionnaire|QuestionnaireResponse|RelatedPerson|RequestGroup|ResearchDefinition|ResearchElementDefinition|ResearchStudy|ResearchSubject|RiskAssessment|RiskEvidenceSynthesis|Schedule|SearchParameter|ServiceRequest|Slot|Specimen|SpecimenDefinition|StructureDefinition|StructureMap|Subscription|Substance|SubstanceNucleicAcid|SubstancePolymer|SubstanceProtein|SubstanceReferenceInformation|SubstanceSourceMaterial|SubstanceSpecification|SupplyDelivery|SupplyRequest|Task|TerminologyCapabilities|TestReport|TestScript|ValueSet|VerificationResult|VisionPrescription)\\/[A-Za-z0-9\\-\\.]{1,64}(\\/_history\\/[A-Za-z0-9\\-\\.]{1,64})?";
public final static String LOCAL_REF_REGEX = "(Account|ActivityDefinition|AdverseEvent|AllergyIntolerance|Appointment|AppointmentResponse|AuditEvent|Basic|Binary|BiologicallyDerivedProduct|BodyStructure|Bundle|CapabilityStatement|CarePlan|CareTeam|CatalogEntry|ChargeItem|ChargeItemDefinition|Claim|ClaimResponse|ClinicalImpression|CodeSystem|Communication|CommunicationRequest|CompartmentDefinition|Composition|ConceptMap|Condition|Consent|Contract|Coverage|CoverageEligibilityRequest|CoverageEligibilityResponse|DetectedIssue|Device|DeviceDefinition|DeviceMetric|DeviceRequest|DeviceUseStatement|DiagnosticReport|DocumentManifest|DocumentReference|EffectEvidenceSynthesis|Encounter|Endpoint|EnrollmentRequest|EnrollmentResponse|EpisodeOfCare|EventDefinition|Evidence|EvidenceVariable|ExampleScenario|ExplanationOfBenefit|FamilyMemberHistory|Flag|Goal|GraphDefinition|Group|GuidanceResponse|HealthcareService|ImagingStudy|Immunization|ImmunizationEvaluation|ImmunizationRecommendation|ImplementationGuide|InsurancePlan|Invoice|Library|Linkage|List|Location|Measure|MeasureReport|Media|Medication|MedicationAdministration|MedicationDispense|MedicationKnowledge|MedicationRequest|MedicationStatement|MedicinalProduct|MedicinalProductAuthorization|MedicinalProductContraindication|MedicinalProductIndication|MedicinalProductIngredient|MedicinalProductInteraction|MedicinalProductManufactured|MedicinalProductPackaged|MedicinalProductPharmaceutical|MedicinalProductUndesirableEffect|MessageDefinition|MessageHeader|MolecularSequence|NamingSystem|NutritionOrder|Observation|ObservationDefinition|OperationDefinition|OperationOutcome|Organization|OrganizationAffiliation|Patient|PaymentNotice|PaymentReconciliation|Person|PlanDefinition|Practitioner|PractitionerRole|Procedure|Provenance|Questionnaire|QuestionnaireResponse|RelatedPerson|RequestGroup|ResearchDefinition|ResearchElementDefinition|ResearchStudy|ResearchSubject|RiskAssessment|RiskEvidenceSynthesis|Schedule|SearchParameter|ServiceRequest|Slot|Specimen|SpecimenDefinition|StructureDefinition|StructureMap|Subscription|Substance|SubstanceNucleicAcid|SubstancePolymer|SubstanceProtein|SubstanceReferenceInformation|SubstanceSourceMaterial|SubstanceSpecification|SupplyDelivery|SupplyRequest|Task|TerminologyCapabilities|TestReport|TestScript|ValueSet|VerificationResult|VisionPrescription)\\/[A-Za-z0-9\\-\\.]{1,64}";
} }

View File

@ -447,47 +447,59 @@ Modifier extensions SHALL NOT change the meaning of any elements on Resource or
// added from java-adornments.txt: // added from java-adornments.txt:
public void checkNoModifiers(String noun, String verb) throws FHIRException { public void checkNoModifiers(String noun, String verb) throws FHIRException {
if (hasModifierExtension()) { if (hasModifierExtension()) {
throw new FHIRException("Found unknown Modifier Exceptions on "+noun+" doing "+verb); throw new FHIRException("Found unknown Modifier Exceptions on "+noun+" doing "+verb);
} }
}
public void addExtension(String url, Type value) {
Extension ex = new Extension();
ex.setUrl(url);
ex.setValue(value);
getExtension().add(ex);
}
public boolean hasExtension(String url) {
for (Extension e : getExtension())
if (url.equals(e.getUrl()))
return true;
return false;
}
public Extension getExtensionByUrl(String theUrl) {
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
ArrayList<Extension> retVal = new ArrayList<Extension>();
for (Extension next : getExtension()) {
if (theUrl.equals(next.getUrl())) {
retVal.add(next);
}
}
if (retVal.size() == 0)
return null;
else {
org.apache.commons.lang3.Validate.isTrue(retVal.size() == 1, "Url "+theUrl+" must have only one match");
return retVal.get(0);
}
}
public Resource getContained(String ref) {
if (ref == null)
return null;
} if (ref.startsWith("#"))
ref = ref.substring(1);
public void addExtension(String url, Type value) { for (Resource r : getContained()) {
Extension ex = new Extension(); if (r.getId().equals(ref))
ex.setUrl(url); return r;
ex.setValue(value); }
getExtension().add(ex); return null;
} }
public boolean hasExtension(String url) {
for (Extension e : getExtension())
if (url.equals(e.getUrl()))
return true;
return false;
}
public Extension getExtensionByUrl(String theUrl) {
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
ArrayList<Extension> retVal = new ArrayList<Extension>();
for (Extension next : getExtension()) {
if (theUrl.equals(next.getUrl())) {
retVal.add(next);
}
}
if (retVal.size() == 0)
return null;
else {
org.apache.commons.lang3.Validate.isTrue(retVal.size() == 1, "Url "+theUrl+" must have only one match");
return retVal.get(0);
}
}
// end addition // end addition

View File

@ -3885,6 +3885,5 @@ public class StructureDefinition extends MetadataResource {
*/ */
public static final ca.uhn.fhir.model.api.Include INCLUDE_BASE = new ca.uhn.fhir.model.api.Include("StructureDefinition:base").toLocked(); public static final ca.uhn.fhir.model.api.Include INCLUDE_BASE = new ca.uhn.fhir.model.api.Include("StructureDefinition:base").toLocked();
} }

View File

@ -3369,7 +3369,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
return "??Lang"; return "??Lang";
} }
private boolean addDefineRowToTable(XhtmlNode t, ConceptDefinitionComponent c, int i, boolean hasHierarchy, boolean hasDisplay, boolean comment, boolean version, boolean deprecated, List<UsedConceptMap> maps, String system, CodeSystem cs, String lang) { private boolean addDefineRowToTable(XhtmlNode t, ConceptDefinitionComponent c, int i, boolean hasHierarchy, boolean hasDisplay, boolean comment, boolean version, boolean deprecated, List<UsedConceptMap> maps, String system, CodeSystem cs, String lang) throws FHIRFormatError, DefinitionException, IOException {
boolean hasExtensions = false; boolean hasExtensions = false;
XhtmlNode tr = t.tr(); XhtmlNode tr = t.tr();
XhtmlNode td = tr.td(); XhtmlNode td = tr.td();
@ -3417,7 +3417,10 @@ public class NarrativeGenerator implements INarrativeGenerator {
if (c != null && if (c != null &&
c.hasDefinitionElement()) { c.hasDefinitionElement()) {
if (lang == null) { if (lang == null) {
td.addText(c.getDefinition()); if (hasMarkdownInDefinitions(cs))
addMarkdown(td, c.getDefinition());
else
td.addText(c.getDefinition());
} else if (lang.equals("*")) { } else if (lang.equals("*")) {
boolean sl = false; boolean sl = false;
for (ConceptDefinitionDesignationComponent cd : c.getDesignation()) for (ConceptDefinitionDesignationComponent cd : c.getDesignation())
@ -3534,6 +3537,10 @@ public class NarrativeGenerator implements INarrativeGenerator {
} }
private boolean hasMarkdownInDefinitions(CodeSystem cs) {
return ToolingExtensions.readBoolExtension(cs, "http://hl7.org/fhir/StructureDefinition/codesystem-use-markdown");
}
private String makeAnchor(String codeSystem, String code) { private String makeAnchor(String codeSystem, String code) {
String s = codeSystem+'-'+code; String s = codeSystem+'-'+code;
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.37-SNAPSHOT</version> <version>3.7.38-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.37-SNAPSHOT</version> <version>3.7.38-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.37-SNAPSHOT</version> <version>3.7.38-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -2759,12 +2759,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
vs = null; vs = null;
} }
if (vs != null) { if (vs != null) {
if (rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), vs.hasCompose() && !vs.hasExpansion(), "CodeSystem "+url+" has a 'all system' value set of "+vsu+", but it is an expansion")) warning(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), vs.hasCompose() && !vs.hasExpansion(), "CodeSystem "+url+" has a 'all system' value set of "+vsu+", and contains an expansion");
if (rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), vs.getCompose().getInclude().size() == 1, "CodeSystem "+url+" has a 'all system' value set of "+vsu+", but doesn't have a single include")) if (rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), vs.getCompose().getInclude().size() == 0, "CodeSystem "+url+" has a 'all system' value set of "+vsu+", but doesn't have an include"))
if (rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), vs.getCompose().getInclude().get(0).getSystem().equals(url), "CodeSystem "+url+" has a 'all system' value set of "+vsu+", but doesn't have a matching system ("+vs.getCompose().getInclude().get(0).getSystem()+")")) { if (rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), vs.getCompose().getInclude().get(0).getSystem().equals(url), "CodeSystem "+url+" has a 'all system' value set of "+vsu+", but doesn't have a matching system ("+vs.getCompose().getInclude().get(0).getSystem()+")")) {
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), !vs.getCompose().getInclude().get(0).hasValueSet() if (rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), !vs.getCompose().getInclude().get(0).hasValueSet() && !vs.getCompose().getInclude().get(0).hasConcept(), "CodeSystem "+url+" has a 'all system' value set of "+vsu+", but the include has extra details"))
&& !vs.getCompose().getInclude().get(0).hasConcept() && !vs.getCompose().getInclude().get(0).hasFilter(), "CodeSystem "+url+" has a 'all system' value set of "+vsu+", but the include has extra details"); warning(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), !vs.getCompose().getInclude().get(0).hasFilter(), "CodeSystem "+url+" has a 'all system' value set of "+vsu+", but the include involves filters");
} }
} }
} // todo... try getting the value set the other way... } // todo... try getting the value set the other way...
} }

View File

@ -392,11 +392,11 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
if (!ok) if (!ok)
errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.UNKNOWN, path, "Profile mismatch on type for "+profile.getProfile()+": the profile constrains "+sd.getType()+" but the element is "+element.fhirType(), IssueSeverity.ERROR)); errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.UNKNOWN, path, "Profile mismatch on type for "+profile.getProfile()+": the profile constrains "+sd.getType()+" but the element is "+element.fhirType(), IssueSeverity.ERROR));
} else } else
addProfile(errors, profile.getProfile(), profile.isError(), path, element); addProfile(errors, profile.getProfile(), profile.isError(), path, element, sd);
} }
} }
public boolean addProfile(List<ValidationMessage> errors, String profile, boolean error, String path, Element element) { public boolean addProfile(List<ValidationMessage> errors, String profile, boolean error, String path, Element element, StructureDefinition containingProfile) {
String effectiveProfile = profile; String effectiveProfile = profile;
String version = null; String version = null;
if (profile.contains("|")) { if (profile.contains("|")) {
@ -404,10 +404,22 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
version = profile.substring(profile.indexOf('|')+1); version = profile.substring(profile.indexOf('|')+1);
} }
StructureDefinition sd = null; StructureDefinition sd = null;
if (providedProfiles != null) if (profile.startsWith("#")) {
sd = providedProfiles.fetch(effectiveProfile); if (!rule(errors, IssueType.INVALID, element.line(), element.col(), path, sd != null, "StructureDefinition reference \"{0}\" is local, but there is not local context", profile)) {
if (sd == null) return false;
sd = context.fetchResource(StructureDefinition.class, effectiveProfile); }
if (containingProfile.hasUserData("container"))
containingProfile = (StructureDefinition) containingProfile.getUserData("container");
sd = (StructureDefinition) containingProfile.getContained(profile);
if (sd != null)
sd.setUserData("container", containingProfile);
} else {
if (providedProfiles != null)
sd = providedProfiles.fetch(effectiveProfile);
if (sd == null)
sd = context.fetchResource(StructureDefinition.class, effectiveProfile);
}
if (warningOrError(error, errors, IssueType.INVALID, element.line(), element.col(), path, sd != null, "StructureDefinition reference \"{0}\" could not be resolved", profile)) { if (warningOrError(error, errors, IssueType.INVALID, element.line(), element.col(), path, sd != null, "StructureDefinition reference \"{0}\" could not be resolved", profile)) {
if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, version==null || (sd.getVersion()!=null && sd.getVersion().equals(version)), if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, version==null || (sd.getVersion()!=null && sd.getVersion().equals(version)),
@ -1180,7 +1192,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
String p = stack.addToLiteralPath("meta", "profile", ":" + Integer.toString(i)); String p = stack.addToLiteralPath("meta", "profile", ":" + Integer.toString(i));
if (rule(errors, IssueType.INVALID, element.line(), element.col(), p, !Utilities.noString(ref), "StructureDefinition reference invalid")) { if (rule(errors, IssueType.INVALID, element.line(), element.col(), p, !Utilities.noString(ref), "StructureDefinition reference invalid")) {
long t = System.nanoTime(); long t = System.nanoTime();
resourceProfiles.addProfile(errors, ref, errorForUnknownProfiles, p, element); resourceProfiles.addProfile(errors, ref, errorForUnknownProfiles, p, element, null);
i++; i++;
} }
} }
@ -1859,7 +1871,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
b.append(bt); b.append(bt);
ok = bt.equals(ft); ok = bt.equals(ft);
if (ok && we!=null && pol.checkValid()) { if (ok && we!=null && pol.checkValid()) {
doResourceProfile(hostContext, we, pr, errors, stack.push(we, -1, null, null), path, element); doResourceProfile(hostContext, we, pr, errors, stack.push(we, -1, null, null), path, element, profile);
} }
} else } else
ok = true; // suppress following check ok = true; // suppress following check
@ -1909,8 +1921,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} }
} }
private void doResourceProfile(ValidatorHostContext hostContext, Element resource, String profile, List<ValidationMessage> errors, NodeStack stack, String path, Element element) throws FHIRException, IOException { private void doResourceProfile(ValidatorHostContext hostContext, Element resource, String profile, List<ValidationMessage> errors, NodeStack stack, String path, Element element, StructureDefinition containingProfile) throws FHIRException, IOException {
ResourceProfiles resourceProfiles = addResourceProfile(errors, resource, profile, path, element, stack); ResourceProfiles resourceProfiles = addResourceProfile(errors, resource, profile, path, element, stack, containingProfile);
if (resourceProfiles.isProcessed()) { if (resourceProfiles.isProcessed()) {
start(hostContext, errors, resource, resource, null, stack); start(hostContext, errors, resource, resource, null, stack);
} }
@ -1925,9 +1937,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
return resourceProfiles; return resourceProfiles;
} }
private ResourceProfiles addResourceProfile(List<ValidationMessage> errors, Element resource, String profile, String path, Element element, NodeStack stack) { private ResourceProfiles addResourceProfile(List<ValidationMessage> errors, Element resource, String profile, String path, Element element, NodeStack stack, StructureDefinition containingProfile) {
ResourceProfiles resourceProfiles = getResourceProfiles(resource, stack); ResourceProfiles resourceProfiles = getResourceProfiles(resource, stack);
resourceProfiles.addProfile(errors, profile, errorForUnknownProfiles, path, element); resourceProfiles.addProfile(errors, profile, errorForUnknownProfiles, path, element, containingProfile);
return resourceProfiles; return resourceProfiles;
} }

View File

@ -561,14 +561,21 @@
"errorCount": 16 "errorCount": 16
} }
}, },
"patient-translated-codes.xml" : { "patient-translated-codes.xml" : {
"errorCount": 0, "errorCount": 0,
"warningCount": 4, "warningCount": 4,
"profile" : { "profile" : {
"source" : "patient-translated-codes.profile.xml", "source" : "patient-translated-codes.profile.xml",
"errorCount": 0, "errorCount": 0,
"warningCount": 0 "warningCount": 0
} },
"patient-contained-org.xml" : {
"errorCount": 0,
"profile" : {
"source" : "patient-contained-org-profile.xml",
"errorCount": 1
}
}
} }
} }
} }

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="patient-contained-org-profile"/>
<contained>
<StructureDefinition>
<id value="gp"/>
<url value="http://hl7.org/fhir/patient-contained-org-org-profile"/>
<name value="PatientContainedOrgOrg"/>
<status value="draft"/>
<kind value="resource"/>
<abstract value="false"/>
<type value="Organization"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Organization"/>
<derivation value="constraint"/>
<differential>
<element id="Organization">
<path value="Organization"/>
</element>
<element id="Organization.name">
<path value="Organization.name"/>
<min value="1"/>
</element>
</differential>
</StructureDefinition>
</contained>
<url value="http://hl7.org/fhir/StructureDefinition/patient-contained-gp-profile"/>
<name value="PatientContainedOrgProfile"/>
<status value="draft"/>
<description value="Test profile to confirm that targetProfiles on references are enforced against contained resources"/>
<kind value="resource"/>
<abstract value="false"/>
<type value="Patient"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Patient"/>
<derivation value="constraint"/>
<differential>
<element id="Patient">
<path value="Patient"/>
</element>
<element id="Patient.generalPractitioner">
<path value="Patient.generalPractitioner"/>
<type>
<code value="Reference"/>
<targetProfile value="#gp"/>
<aggregation value="contained"/>
</type>
</element>
</differential>
</StructureDefinition>

View File

@ -0,0 +1,20 @@
<Patient xmlns="http://hl7.org/fhir">
<id value="patient-error-gender"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
Check that profile validation checks contained resources - should fail because Organization is missing 'name' which is required by profile
</div>
</text>
<contained>
<Organization>
<id value="gp"/>
<identifier>
<value value="123"/>
</identifier>
</Organization>
</contained>
<generalPractitioner>
<reference value="#gp"/>
</generalPractitioner>
</Patient>

View File

@ -13,7 +13,7 @@
each other. It is fine to bump the point version of this POM without affecting each other. It is fine to bump the point version of this POM without affecting
HAPI FHIR. HAPI FHIR.
--> -->
<version>3.7.37-SNAPSHOT</version> <version>3.7.38-SNAPSHOT</version>
<properties> <properties>
<hapi_fhir_version>3.7.0-SNAPSHOT</hapi_fhir_version> <hapi_fhir_version>3.7.0-SNAPSHOT</hapi_fhir_version>

View File

@ -4,25 +4,25 @@ REM make sure you are committed
@echo off @echo off
echo .. echo ..
echo ===================================================================== echo =====================================================================
echo upgrade and release fhir.core from 3.7.36-SNAPSHOT to 3.7.37-SNAPSHOT echo upgrade and release fhir.core from 3.7.37-SNAPSHOT to 3.7.38-SNAPSHOT
echo ===================================================================== echo =====================================================================
echo .. echo ..
echo check versions and make sure committed... echo check versions and make sure committed...
pause pause
call mvn versions:set -DnewVersion=3.7.37-SNAPSHOT call mvn versions:set -DnewVersion=3.7.38-SNAPSHOT
call git commit -a -m "Release new version" call git commit -a -m "Release new version"
call git push origin master call git push origin master
call "C:\tools\fnr.exe" --cl --dir "C:\work\org.hl7.fhir\build" --fileMask "*.java" --includeSubDirectories --find "3.7.36-SNAPSHOT" --replace "3.7.37-SNAPSHOT" call "C:\tools\fnr.exe" --cl --dir "C:\work\org.hl7.fhir\build" --fileMask "*.java" --includeSubDirectories --find "3.7.37-SNAPSHOT" --replace "3.7.38-SNAPSHOT"
call "C:\tools\fnr.exe" --cl --dir "C:\work\org.hl7.fhir\fhir-ig-publisher" --fileMask "*.xml" --includeSubDirectories --find "3.7.36-SNAPSHOT" --replace "3.7.37-SNAPSHOT" call "C:\tools\fnr.exe" --cl --dir "C:\work\org.hl7.fhir\fhir-ig-publisher" --fileMask "*.xml" --includeSubDirectories --find "3.7.37-SNAPSHOT" --replace "3.7.38-SNAPSHOT"
call "C:\tools\fnr.exe" --cl --dir "C:\work\org.hl7.fhir\build" --fileMask "*.xml" --find "3.7.36-SNAPSHOT" --replace "3.7.37-SNAPSHOT" call "C:\tools\fnr.exe" --cl --dir "C:\work\org.hl7.fhir\build" --fileMask "*.xml" --find "3.7.37-SNAPSHOT" --replace "3.7.38-SNAPSHOT"
call mvn deploy call mvn deploy
copy org.hl7.fhir.validation.cli\target\org.hl7.fhir.validation.cli-3.7.37-SNAPSHOT.jar ..\latest-ig-publisher\org.hl7.fhir.validator.jar copy org.hl7.fhir.validation.cli\target\org.hl7.fhir.validation.cli-3.7.38-SNAPSHOT.jar ..\latest-ig-publisher\org.hl7.fhir.validator.jar
cd ..\latest-ig-publisher cd ..\latest-ig-publisher
call git commit -a -m "Release new version 3.7.37-SNAPSHOT" call git commit -a -m "Release new version 3.7.38-SNAPSHOT"
call git push origin master call git push origin master
cd ..\org.hl7.fhir.core cd ..\org.hl7.fhir.core
call python c:\tools\zulip-api\zulip\zulip\send.py --stream committers/notification --subject "java core" -m "New Java Core v3.7.37-SNAPSHOT released. New Validator at https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.validation.cli&v=3.7.37-SNAPSHOT&e=jar, and also deployed at https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.validator.jar" --config-file zuliprc call python c:\tools\zulip-api\zulip\zulip\send.py --stream committers/notification --subject "java core" -m "New Java Core v3.7.38-SNAPSHOT released. New Validator at https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.validation.cli&v=3.7.38-SNAPSHOT&e=jar, and also deployed at https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.validator.jar" --config-file zuliprc
echo =============================================================== echo ===============================================================
echo all done echo all done