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 ValueSet resolveBindingReference(DomainResource ctxt, Type reference, String uri) { if (reference instanceof UriType) { long t = System.nanoTime(); ValueSet fr = context.fetchResource(ValueSet.class, ((UriType) reference).getValue().toString()); txTime = txTime + (System.nanoTime() - t); return fr; } else if (reference instanceof Reference) { String s = ((Reference) reference).getReference(); if (s.startsWith("#")) { for (Resource c : ctxt.getContained()) { if (c.getId().equals(s.substring(1)) && (c instanceof ValueSet)) return (ValueSet) c; } return null; } else { long t = System.nanoTime(); String ref = ((Reference) reference).getReference(); if (!Utilities.isAbsoluteUrl(ref)) ref = resolve(uri, ref); ValueSet fr = context.fetchResource(ValueSet.class, ref); txTime = txTime + (System.nanoTime() - t); return fr; } } else return null; }
if (isNotBlank(nextResource.getSourceReference().getReference())) { IdType id = new IdType(nextResource.getSourceReference().getReference()); if (isNotBlank(id.getResourceType())) { switch (id.getResourceType()) {
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)"); validateItems(theErrors, questionnaire.getItem(), theAnswers.getItem(), pathStack, theAnswers, validateRequired); }
public org.hl7.fhir.instance.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Reference tgt = new org.hl7.fhir.instance.model.Reference(); copyElement(src, tgt); tgt.setReference(src.getReference()); tgt.setDisplay(src.getDisplay()); return tgt; }
@SuppressWarnings("unused") public void c1020() throws FHIRException { //START SNIPPET: 1020 // Create a converter NullVersionConverterAdvisor30 advisor = new NullVersionConverterAdvisor30(); VersionConvertor_10_30 converter = new VersionConvertor_10_30(advisor); // Create an input resource to convert org.hl7.fhir.instance.model.Observation input = new org.hl7.fhir.instance.model.Observation(); input.setEncounter(new org.hl7.fhir.instance.model.Reference("Encounter/123")); // Convert the resource org.hl7.fhir.dstu3.model.Observation output = converter.convertObservation(input); String context = output.getContext().getReference(); //END SNIPPET: 1020 }
public static org.hl7.fhir.dstu2016may.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Reference tgt = new org.hl7.fhir.dstu2016may.model.Reference(); copyElement(src, tgt); if (src.hasReference()) tgt.setReference(src.getReference()); if (src.hasDisplay()) tgt.setDisplay(src.getDisplay()); return tgt; }
throw new DefinitionException("Unsupported fixed value type for discriminator(" + discriminator + ") for slice " + ed.getId() + ": " + fixed.getClass().getName()); } else if (criteriaElement.hasBinding() && criteriaElement.getBinding().hasStrength() && criteriaElement.getBinding().getStrength().equals(BindingStrength.REQUIRED) && criteriaElement.getBinding().getValueSetReference()!=null) { expression = expression + " and " + discriminator + " in '" + criteriaElement.getBinding().getValueSetReference().getReference() + "'"; } else if (criteriaElement.hasMin() && criteriaElement.getMin()>0) { expression = expression + " and " + discriminator + ".exists()";
String optionsRef = theQuestion.getOptions().getReference(); if (isNotBlank(optionsRef)) { ValueSet valueSet = getValueSet(theResponse, theQuestion.getOptions());
public org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent(); copyElement(src, tgt); tgt.setRole(convertProvenanceEntityRole(src.getRole())); if (src.hasWhatReference() && src.getWhatReference().hasReference()) tgt.setReference(src.getWhatReference().getReference()); for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.setAgent(convertProvenanceAgentComponent(t)); return tgt; }
private void checkReference(Object appContext, List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, ElementDefinition container, String parentType, NodeStack stack) throws FHIRException, IOException { Reference reference = readAsReference(element); String ref = reference.getReference(); if (Utilities.noString(ref)) { if (Utilities.noString(reference.getIdentifier().getSystem()) && Utilities.noString(reference.getIdentifier().getValue())) {
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 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 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)"); validateItems(theErrors, questionnaire.getItem(), theAnswers.getItem(), pathStack, theAnswers, validateRequired); }
public org.hl7.fhir.instance.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Reference tgt = new org.hl7.fhir.instance.model.Reference(); copyElement(src, tgt); tgt.setReference(src.getReference()); tgt.setDisplay(src.getDisplay()); return tgt; }
private void addResourceData(GenericFhirAuditDataset auditDataset, T resource) { auditDataset.setResourceId(resource.getIdElement()); if (resource.getIdElement().hasResourceType()) { auditDataset.setAffectedResourceType(resource.getIdElement().getResourceType()); } patientIdExtractor.apply(resource).ifPresent(patient -> auditDataset.getPatientIds().add(patient.getResource() != null ? patient.getResource().getIdElement().toUnqualifiedVersionless().getValue() : patient.getReference())); List<? extends IBaseCoding> securityLabels = resource.getMeta().getSecurity(); if (!securityLabels.isEmpty()) { auditDataset.setSecurityLabel(securityLabels.get(0).getCode()); } } }
public static org.hl7.fhir.dstu2016may.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Reference tgt = new org.hl7.fhir.dstu2016may.model.Reference(); copyElement(src, tgt); if (src.hasReference()) tgt.setReference(src.getReference()); if (src.hasDisplay()) 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()) { if (t.hasProfile()) { if (t.getProfile().startsWith("#")) t.setProfile(url+t.getProfile()); } if (t.hasTargetProfile()) { if (t.getTargetProfile().startsWith("#")) t.setTargetProfile(url+t.getTargetProfile()); } } } return element; }
public org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent(); copyElement(src, tgt); tgt.setRole(convertProvenanceEntityRole(src.getRole())); if (src.hasWhatReference() && src.getWhatReference().hasReference()) tgt.setReference(src.getWhatReference().getReference()); for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.setAgent(convertProvenanceAgentComponent(t)); return tgt; }