private String describeReference(Type reference) { if (reference == null) return "null"; if (reference instanceof UriType) return ((UriType) reference).getValue(); if (reference instanceof Reference) return ((Reference) reference).getReference(); return "??"; }
private CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { CanonicalType dst = new CanonicalType(src.getReference()); copyElement(src, dst); return dst; }
private ValueSet resolveBindingReference(Type reference) { if (reference instanceof UriType) return context.fetchResource(ValueSet.class, ((UriType) reference).getValue().toString()); else if (reference instanceof Reference) return context.fetchResource(ValueSet.class, ((Reference) reference).getReference()); else return null; }
public void validate(List<ValidationMessage> theErrors, QuestionnaireResponse theAnswers) { LinkedList<String> pathStack = new LinkedList<String>(); pathStack.add("QuestionnaireResponse"); pathStack.add(QuestionnaireResponse.SP_QUESTIONNAIRE); if (!fail(theErrors, IssueType.INVALID, pathStack, theAnswers.hasQuestionnaire(), "QuestionnaireResponse does not specity which questionnaire it is providing answers to")) { return; } Reference questionnaireRef = theAnswers.getQuestionnaire(); Questionnaire questionnaire = getQuestionnaire(theAnswers, questionnaireRef); if (!fail(theErrors, IssueType.INVALID, pathStack, questionnaire != null, "Questionnaire {0} is not found in the WorkerContext", theAnswers.getQuestionnaire().getReference())) { return; } QuestionnaireResponseStatus status = theAnswers.getStatus(); boolean validateRequired = false; if (status == QuestionnaireResponseStatus.COMPLETED || status == QuestionnaireResponseStatus.AMENDED) { validateRequired = true; } pathStack.removeLast(); pathStack.add("group(0)"); validateGroup(theErrors, questionnaire.getGroup(), theAnswers.getGroup(), pathStack, theAnswers, validateRequired); }
public org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.instance.model.Reference src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference(); copyElement(src, tgt); tgt.setReference(src.getReference()); tgt.setDisplay(src.getDisplay()); return tgt; }
public org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.instance.model.Reference src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); copyElement(src, tgt); tgt.setReference(src.getReference()); tgt.setDisplay(src.getDisplay()); return tgt; }
/** * Finds internal references in an Element's Binding and StructureDefinition references (in TypeRef) and bases them on the given url * @param url - the base url to use to turn internal references into absolute references * @param element - the Element to update * @return - the updated Element */ private ElementDefinition updateURLs(String url, ElementDefinition element) { if (element != null) { ElementDefinition defn = element; if (defn.hasBinding() && defn.getBinding().getValueSet() instanceof Reference && ((Reference)defn.getBinding().getValueSet()).getReference().startsWith("#")) ((Reference)defn.getBinding().getValueSet()).setReference(url+((Reference)defn.getBinding().getValueSet()).getReference()); for (TypeRefComponent t : defn.getType()) { for (UriType tp : t.getProfile()) { if (tp.getValue().startsWith("#")) tp.setValue(url+t.getProfile()); } } } return element; }
String optionsRef = theQuestion.getOptions().getReference(); if (isNotBlank(optionsRef)) { ValueSet valueSet = getValueSet(theAnswers, theQuestion.getOptions());
private String describeReference(Type reference) { if (reference == null) return "null"; if (reference instanceof UriType) return ((UriType) reference).getValue(); if (reference instanceof Reference) return ((Reference) reference).getReference(); return "??"; }
public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent(); copyElement(src, tgt); tgt.setName(src.getName()); tgt.setUse(convertOperationParameterUse(src.getUse())); tgt.setMin(src.getMin()); tgt.setMax(src.getMax()); tgt.setDocumentation(src.getDocumentation()); tgt.setType(src.getType()); tgt.addTargetProfile(src.getProfile().getReference()); tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); return tgt; }
private CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { CanonicalType dst = new CanonicalType(src.getReference()); copyElement(src, dst); return dst; }
private ValueSet resolveBindingReference(Type reference) { if (reference instanceof UriType) return context.fetchResource(ValueSet.class, ((UriType) reference).getValue().toString()); else if (reference instanceof Reference) return context.fetchResource(ValueSet.class, ((Reference) reference).getReference()); else return null; }
ValueSetExpansionOutcome expBase = context.expandVS(context.fetchResource(ValueSet.class, base.getBinding().getValueSetReference().getReference()), true); ValueSetExpansionOutcome expDerived = context.expandVS(context.fetchResource(ValueSet.class, derived.getBinding().getValueSetReference().getReference()), true); if (expBase.getValueset() == null) messages.add(new ValidationMessage(Source.ProfileValidator, IssueType.BUSINESSRULE, pn+"."+base.getPath(), "Binding "+base.getBinding().getValueSetReference().getReference()+" could not be expanded", IssueSeverity.WARNING)); else if (expDerived.getValueset() == null) messages.add(new ValidationMessage(Source.ProfileValidator, IssueType.BUSINESSRULE, pn+"."+derived.getPath(), "Binding "+derived.getBinding().getValueSetReference().getReference()+" could not be expanded", IssueSeverity.WARNING)); else if (!isSubset(expBase.getValueset(), expDerived.getValueset())) messages.add(new ValidationMessage(Source.ProfileValidator, IssueType.BUSINESSRULE, pn+"."+derived.getPath(), "Binding "+derived.getBinding().getValueSetReference().getReference()+" is not a subset of binding "+base.getBinding().getValueSetReference().getReference(), IssueSeverity.ERROR));
public void enrichDatasetFromDocumentManifest(DocumentManifest documentManifest) { getPatientIds().add(documentManifest.getSubject().getReference()); // If available, use the documentManifest identifier as documentManifestUuid if (!documentManifest.getIdentifier().isEmpty()) { this.documentManifestUuid = documentManifest.getIdentifier().get(0).getValue(); } } }
private String getSubjectReference(Resource resource, Function<Resource, Reference> f) { Reference reference = f.apply(resource); if (reference == null) { throw FhirUtils.unprocessableEntity( OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, ErrorCode.UNKNOWN_PATIENT_ID.getOpcode(), null, "Empty Patient reference in resource %s", resource ); } // Could be contained resources if (reference.getResource() != null) { Patient patient = (Patient) reference.getResource(); return patient.getIdentifier().get(0).getValue(); } return reference.getReference(); }
public void enrichDatasetFromDocumentManifest(DocumentManifest documentManifest) { Reference reference = documentManifest.getSubject(); getPatientIds().add(reference.getResource() != null ? reference.getResource().getIdElement().getValue() : reference.getReference()); // If available, use the documentManifest identifier as documentManifestUuid if (!documentManifest.getIdentifier().isEmpty()) { this.documentManifestUuid = documentManifest.getIdentifier().get(0).getValue(); } } }
private String getSubjectReference(Resource resource, Function<Resource, Reference> f) { Reference reference = f.apply(resource); if (reference == null) { throw FhirUtils.unprocessableEntity( OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, ErrorCode.UNKNOWN_PATIENT_ID.getOpcode(), null, "Empty Patient reference in resource %s", resource ); } // Could be contained resources if (reference.getResource() != null) { Patient patient = (Patient) reference.getResource(); return patient.getIdentifier().get(0).getValue(); } return reference.getReference(); }
public org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.instance.model.Reference src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference(); copyElement(src, tgt); tgt.setReference(src.getReference()); tgt.setDisplay(src.getDisplay()); return tgt; }
public org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.instance.model.Reference src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); copyElement(src, tgt); tgt.setReference(src.getReference()); tgt.setDisplay(src.getDisplay()); return tgt; }
public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent(); copyElement(src, tgt); tgt.setName(src.getName()); tgt.setUse(convertOperationParameterUse(src.getUse())); tgt.setMin(src.getMin()); tgt.setMax(src.getMax()); tgt.setDocumentation(src.getDocumentation()); tgt.setType(src.getType()); tgt.addTargetProfile(src.getProfile().getReference()); tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); return tgt; }