org.hl7.fhir.dstu3.model.Coding Java Examples
The following examples show how to use
org.hl7.fhir.dstu3.model.Coding.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FHIRToolingClient.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public ConceptMap updateClosure(String name, Coding coding) { Parameters params = new Parameters(); params.addParameter().setName("name").setValue(new StringType(name)); params.addParameter().setName("concept").setValue(coding); List<Header> headers = null; ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()), utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers); result.addErrorStatus(410);//gone result.addErrorStatus(404);//unknown result.addErrorStatus(405); result.addErrorStatus(422);//Unprocessable Entity result.addSuccessStatus(200); result.addSuccessStatus(201); if(result.isUnsuccessfulRequest()) { throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload()); } return (ConceptMap) result.getPayload(); }
Example #2
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
@Override public ValidationResult validateCode(String system, String code, String display, ValueSet vs) { try { if (system == null && display == null) { return verifyCodeInternal(vs, code); } if ((codeSystems.containsKey(system) && codeSystems.get(system) != null) || vs .hasExpansion()) { return verifyCodeInternal(vs, system, code, display); } else { return verifyCodeExternal(vs, new Coding().setSystem(system).setCode(code).setDisplay(display), true); } } catch (Exception e) { return new ValidationResult(IssueSeverity.FATAL, "Error validating code \"" + code + "\" in system \"" + system + "\": " + e.getMessage(), TerminologyServiceErrorClass.SERVER_ERROR); } }
Example #3
Source File: FindingsFormatUtilTest.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Test public void convertCondition20() throws IOException { // condition format of HAPI FHIR 2.0 String oldContent = AllTests.getResourceAsString("/rsc/json/ConditionFormat20.json"); assertFalse(FindingsFormatUtil.isCurrentFindingsFormat(oldContent)); Optional<String> newContent = FindingsFormatUtil.convertToCurrentFindingsFormat(oldContent); assertTrue(newContent.isPresent()); IBaseResource resource = AllTests.getJsonParser().parseResource(newContent.get()); assertTrue(resource instanceof Condition); Condition condition = (Condition) resource; // category changed from diagnosis to problem-list-item List<CodeableConcept> category = condition.getCategory(); assertFalse(category.isEmpty()); CodeableConcept code = category.get(0); List<Coding> coding = code.getCoding(); assertFalse(coding.isEmpty()); assertTrue(coding.get(0).getCode().equals(ConditionCategory.PROBLEMLISTITEM.getCode())); // dateRecorded changed to assertedDate Date assertedDate = condition.getAssertedDate(); assertNotNull(assertedDate); }
Example #4
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
@SuppressWarnings("rawtypes") private String describeValidationParameters(Parameters pin) { CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); for (ParametersParameterComponent p : pin.getParameter()) { if (p.hasValue() && p.getValue() instanceof PrimitiveType) { b.append(p.getName() + "=" + ((PrimitiveType) p.getValue()).asStringValue()); } else if (p.hasValue() && p.getValue() instanceof Coding) { b.append("system=" + ((Coding) p.getValue()).getSystem()); b.append("code=" + ((Coding) p.getValue()).getCode()); b.append("display=" + ((Coding) p.getValue()).getDisplay()); } else if (p.hasValue() && p.getValue() instanceof CodeableConcept) { if (((CodeableConcept) p.getValue()).hasCoding()) { Coding c = ((CodeableConcept) p.getValue()).getCodingFirstRep(); b.append("system=" + c.getSystem()); b.append("code=" + c.getCode()); b.append("display=" + c.getDisplay()); } else if (((CodeableConcept) p.getValue()).hasText()) { b.append("text=" + ((CodeableConcept) p.getValue()).getText()); } } else if (p.hasResource() && (p.getResource() instanceof ValueSet)) { b.append("valueset=" + getVSSummary((ValueSet) p.getResource())); } } return b.toString(); }
Example #5
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private ValidationResult verifyCodeExternal(ValueSet vs, Coding coding, boolean tryCache) throws Exception { ValidationResult res = vs == null ? null : handleByCache(vs, coding, tryCache); if (res != null) { return res; } Parameters pin = new Parameters(); pin.addParameter().setName("coding").setValue(coding); if (vs != null) { pin.addParameter().setName("valueSet").setResource(vs); } res = serverValidateCode(pin, vs == null); if (vs != null) { Map<String, ValidationResult> cache = validationCache.get(vs.getUrl()); cache.put(cacheId(coding), res); } return res; }
Example #6
Source File: StructureMapUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
@SuppressWarnings("rawtypes") private String describeTransformCCorC(StructureMapGroupRuleTargetComponent tgt) throws FHIRException { if (tgt.getParameter().size() < 2) return null; Type p1 = tgt.getParameter().get(0).getValue(); Type p2 = tgt.getParameter().get(1).getValue(); if (p1 instanceof IdType || p2 instanceof IdType) return null; if (!(p1 instanceof PrimitiveType) || !(p2 instanceof PrimitiveType)) return null; String uri = ((PrimitiveType) p1).asStringValue(); String code = ((PrimitiveType) p2).asStringValue(); if (Utilities.noString(uri)) throw new FHIRException("Describe Transform, but the uri is blank"); if (Utilities.noString(code)) throw new FHIRException("Describe Transform, but the code is blank"); Coding c = buildCoding(uri, code); return NarrativeGenerator.describeSystem(c.getSystem())+"#"+c.getCode()+(c.hasDisplay() ? "("+c.getDisplay()+")" : ""); }
Example #7
Source File: Convert.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public Coding makeCodingFromCV(Element cd) throws Exception { if (cd == null || Utilities.noString(cd.getAttribute("code"))) return null; Coding c = new Coding(); c.setCode(cd.getAttribute("code")); c.setDisplay(cd.getAttribute("displayName")); String r = cd.getAttribute("codeSystem"); String uri = getUriForOID(r); if (uri != null) c.setSystem(uri); else if (isGuid(r)) c.setSystem("urn:uuid:"+r); else if (UriForOid(r) != null) c.setSystem(UriForOid(r)); else c.setSystem("urn:oid:"+r); return c; }
Example #8
Source File: ObservationAccessor.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
public void setCategory(DomainResource resource, ObservationCategory category){ org.hl7.fhir.dstu3.model.Observation fhirObservation = (org.hl7.fhir.dstu3.model.Observation) resource; CodeableConcept categoryCode = new CodeableConcept(); if (category.name().startsWith("SOAP_")) { // elexis soap categories categoryCode.setCoding( Collections.singletonList(new Coding(IdentifierSystem.ELEXIS_SOAP.getSystem(), category.getCode(), category.getLocalized()))); } else { org.hl7.fhir.dstu3.model.codesystems.ObservationCategory fhirCategoryCode = (org.hl7.fhir.dstu3.model.codesystems.ObservationCategory) categoryMapping .getFhirEnumValueByEnum(category); if (fhirCategoryCode != null) { // lookup matching fhir category categoryCode .setCoding(Collections.singletonList(new Coding(fhirCategoryCode.getSystem(), fhirCategoryCode.toCode(), fhirCategoryCode.getDisplay()))); } else { throw new IllegalStateException("Unknown observation category " + category); } } if (!categoryCode.getCoding().isEmpty()) { fhirObservation.setCategory(Collections.singletonList(categoryCode)); } }
Example #9
Source File: ArgonautConverter.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private void processSocialHistorySection(CDAUtilities cda, Convert convert, Element section, Context context) throws Exception { scanSection("Social History", section); int i = 0; for (Element c : cda.getChildren(section, "entry")) { Element o = cda.getChild(c, "observation"); Observation obs = new Observation(); obs.setId(context.baseId+"-smoking-"+(i == 0 ? "" : Integer.toString(i))); obs.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/observation-daf-smokingstatus-dafsmokingstatus"); i++; obs.setSubject(context.subjectRef); obs.setContext(new Reference().setReference("Encounter/"+context.encounter.getId())); obs.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(o, "code")), new Coding().setSystem("http://loinc.org").setCode("72166-2"))); boolean found = false; for (Element e : cda.getChildren(o, "id")) { Identifier id = convert.makeIdentifierFromII(e); obs.getIdentifier().add(convert.makeIdentifierFromII(e)); } if (!found) { obs.setStatus(ObservationStatus.FINAL); obs.setEffective(convert.makeDateTimeFromTS(cda.getChild(o, "effectiveTime"))); obs.setValue(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(o, "value")), null)); saveResource(obs, "-sh"); } } }
Example #10
Source File: ArgonautConverter.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private CodeableConcept inspectCode(CodeableConcept cc, Coding def) { if (cc != null) { for (Coding c : cc.getCoding()) { if ("http://snomed.info/sct".equals(c.getSystem())) { if ("ASSERTION".equals(c.getCode())) c.setSystem("http://hl7.org/fhir/v3/ActCode"); } if ("http://hl7.org/fhir/v3/ActCode".equals(c.getSystem()) && "ASSERTION".equals(c.getCode())) { if (def == null) throw new Error("need a default code"); c.setSystem(def.getSystem()); c.setVersion(def.getVersion()); c.setCode(def.getCode()); c.setDisplay(def.getDisplay()); } } } return cc; }
Example #11
Source File: ConceptDao.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Override public ConceptEntity findAddCode(Quantity quantity) { Coding code = new Coding().setCode(quantity.getCode()).setSystem(quantity.getSystem()); ConceptEntity conceptEntity = findCode(code); // 12/Jan/2018 KGM to cope with LOINC codes and depreciated SNOMED codes. if (conceptEntity == null) { CodeSystemEntity system = codeSystemRepository.findBySystem(quantity.getSystem()); if (system !=null) { conceptEntity = new ConceptEntity(); conceptEntity.setCode(quantity.getCode()); conceptEntity.setDescription(quantity.getUnit()); conceptEntity.setDisplay(quantity.getUnit()); conceptEntity.setCodeSystem(system); em.persist(conceptEntity); } else { throw new IllegalArgumentException("Unsupported system "+quantity.getSystem()); } } return conceptEntity; }
Example #12
Source File: FhirStu3.java From synthea with Apache License 2.0 | 6 votes |
/** * Helper function to convert a Code into a CodeableConcept. Takes an optional system, which * replaces the Code.system in the resulting CodeableConcept if not null. * * @param from The Code to create a CodeableConcept from. * @param system The system identifier, such as a URI. Optional; may be null. * @return The converted CodeableConcept */ private static CodeableConcept mapCodeToCodeableConcept(Code from, String system) { CodeableConcept to = new CodeableConcept(); system = system == null ? null : ExportHelper.getSystemURI(system); from.system = ExportHelper.getSystemURI(from.system); if (from.display != null) { to.setText(from.display); } Coding coding = new Coding(); coding.setCode(from.code); coding.setDisplay(from.display); if (from.system == null) { coding.setSystem(system); } else { coding.setSystem(from.system); } to.addCoding(coding); return to; }
Example #13
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private ValidationResult verifyCodeInternal(ValueSet vs, String system, String code, String display) throws Exception { if (vs.hasExpansion()) { return verifyCodeInExpansion(vs, system, code, display); } else { ValueSetExpansionOutcome vse = expansionCache.getExpander().expand(vs, null); if (vse.getValueset() != null) { return verifyCodeExternal(vs, new Coding().setSystem(system).setCode(code).setDisplay(display), false); } else { return verifyCodeInExpansion(vse.getValueset(), system, code, display); } } }
Example #14
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
@Override public ValidationResult validateCode(String system, String code, String display, ConceptSetComponent vsi) { try { ValueSet vs = new ValueSet(); vs.setUrl(Utilities.makeUuidUrn()); vs.getCompose().addInclude(vsi); return verifyCodeExternal(vs, new Coding().setSystem(system).setCode(code).setDisplay(display), true); } catch (Exception e) { return new ValidationResult(IssueSeverity.FATAL, "Error validating code \"" + code + "\" in system \"" + system + "\": " + e.getMessage()); } }
Example #15
Source File: ICPC2Importer.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private void processClass(Element cls, Map<String, ConceptDefinitionComponent> concepts, CodeSystem define) throws FHIRFormatError { ConceptDefinitionComponent concept = new ConceptDefinitionComponent(); concept.setCode(cls.getAttribute("code")); concept.setDefinition(getRubric(cls, "preferred")); String s = getRubric(cls, "shortTitle"); if (s != null && !s.equals(concept.getDefinition())) concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("shortTitle")).setValue(s); s = getRubric(cls, "inclusion"); if (s != null) concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("inclusion")).setValue(s); s = getRubric(cls, "exclusion"); if (s != null) concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("exclusion")).setValue(s); s = getRubric(cls, "criteria"); if (s != null) concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("criteria")).setValue(s); s = getRubric(cls, "consider"); if (s != null) concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("consider")).setValue(s); s = getRubric(cls, "note"); if (s != null) concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("note")).setValue(s); concepts.put(concept.getCode(), concept); List<Element> children = new ArrayList<Element>(); XMLUtil.getNamedChildren(cls, "SubClass", children); if (children.size() > 0) CodeSystemUtilities.setNotSelectable(define, concept); Element parent = XMLUtil.getNamedChild(cls, "SuperClass"); if (parent == null) { define.addConcept(concept); } else { ConceptDefinitionComponent p = concepts.get(parent.getAttribute("code")); p.getConcept().add(concept); } }
Example #16
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private ValidationResult verifyCodeInternal(ValueSet vs, CodeableConcept code) throws Exception { for (Coding c : code.getCoding()) { ValidationResult res = verifyCodeInternal(vs, c.getSystem(), c.getCode(), c.getDisplay()); if (res.isOk()) { return res; } } if (code.getCoding().isEmpty()) { return new ValidationResult(IssueSeverity.ERROR, "None code provided"); } else { return new ValidationResult(IssueSeverity.ERROR, "None of the codes are in the specified value set"); } }
Example #17
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private ValidationResult verifyCodeInCodeSystem(CodeSystem cs, String system, String code, String display) throws Exception { ConceptDefinitionComponent cc = findCodeInConcept(cs.getConcept(), code); if (cc == null) { if (cs.getContent().equals(CodeSystem.CodeSystemContentMode.COMPLETE)) { return new ValidationResult(IssueSeverity.ERROR, "Unknown Code " + code + " in " + cs.getUrl()); } else if (!cs.getContent().equals(CodeSystem.CodeSystemContentMode.NOTPRESENT)) { return new ValidationResult(IssueSeverity.WARNING, "Unknown Code " + code + " in partial code list of " + cs.getUrl()); } else { return verifyCodeExternal(null, new Coding().setSystem(system).setCode(code).setDisplay(display), false); } } // // return new ValidationResult(IssueSeverity.WARNING, "A definition was found for "+cs.getUrl()+", but it has no codes in the definition"); // return new ValidationResult(IssueSeverity.ERROR, "Unknown Code "+code+" in "+cs.getUrl()); if (display == null) { return new ValidationResult(cc); } CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); if (cc.hasDisplay()) { b.append(cc.getDisplay()); if (display.equalsIgnoreCase(cc.getDisplay())) { return new ValidationResult(cc); } } for (ConceptDefinitionDesignationComponent ds : cc.getDesignation()) { b.append(ds.getValue()); if (display.equalsIgnoreCase(ds.getValue())) { return new ValidationResult(cc); } } return new ValidationResult(IssueSeverity.WARNING, "Display Name for " + code + " must be one of '" + b.toString() + "'", cc); }
Example #18
Source File: TranslationRequests.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
public List<TranslationQueries> getTranslationQueries() { List<TranslationQueries> retVal = new ArrayList<>(); TranslationQueries translationQueries; for (Coding coding : getCodeableConcept().getCoding()) { translationQueries = new TranslationQueries(); translationQueries.setCoding(coding); System.out.println("translation queries " + this.getCodeableConcept().getId() + " ,target system :" + this.getTargetSystem()); if (this.hasResourceId()) { translationQueries.setResourceId(this.getResourceId()); } if (this.hasSource()) { translationQueries.setSource(this.getSource()); } if (this.hasTarget()) { translationQueries.setTarget(this.getTarget()); } if (this.hasTargetSystem()) { translationQueries.setTargetSystem(this.getTargetSystem()); } retVal.add(translationQueries); } return retVal; }
Example #19
Source File: ConceptDao.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
@Override public ConceptEntity findCode(Coding coding) { ConceptEntity conceptEntity = null; CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery<ConceptEntity> criteria = builder.createQuery(ConceptEntity.class); Root<ConceptEntity> root = criteria.from(ConceptEntity.class); List<Predicate> predList = new LinkedList<Predicate>(); List<ConceptEntity> results = new ArrayList<ConceptEntity>(); Join<ConceptEntity,CodeSystemRepository> join = root.join("codeSystemEntity"); log.debug("Looking for code ="+coding.getCode()+" in "+coding.getSystem()); Predicate pcode = builder.equal(root.get("code"), coding.getCode()); predList.add(pcode); Predicate psystem = builder.equal(join.get("codeSystemUri"), coding.getSystem()); predList.add(psystem); Predicate[] predArray = new Predicate[predList.size()]; predList.toArray(predArray); criteria.select(root).where(predArray); TypedQuery<ConceptEntity> qry = em.createQuery(criteria); qry.setHint("javax.persistence.cache.storeMode", "REFRESH"); List<ConceptEntity> qryResults = qry.getResultList(); for (ConceptEntity concept : qryResults) { conceptEntity = concept; log.debug("Found for code="+coding.getCode()+" ConceptEntity.Id="+conceptEntity.getId()); break; } return conceptEntity; }
Example #20
Source File: ConceptDao.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
@Override public ConceptEntity findCode(Duration duration) { Coding code = new Coding().setCode(duration.getCode()).setSystem(duration.getSystem()); ConceptEntity conceptEntity = findCode(code); return conceptEntity; }
Example #21
Source File: ConceptDao.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
@Override public ConceptEntity findAddCode(Coding coding) { ConceptEntity conceptEntity = findCode(coding); // 12/Jan/2018 KGM to cope with LOINC codes and depreciated SNOMED codes. if (conceptEntity == null) { CodeSystemEntity system = codeSystemRepository.findBySystem(coding.getSystem()); if (system !=null) { conceptEntity = new ConceptEntity(); conceptEntity.setCode(coding.getCode()); conceptEntity.setDescription(coding.getDisplay()); conceptEntity.setDisplay(coding.getDisplay()); conceptEntity.setCodeSystem(system); em.persist(conceptEntity); } else { throw new IllegalArgumentException("Unsupported System "+coding.getSystem()); } } else { // TODO look at disabling this in the future // Pick up descriptions from incoming resources - should correct LOINC issues if (coding.getDisplay() != null && !coding.getDisplay().isEmpty() && (conceptEntity.getDisplay() == null || conceptEntity.getDisplay().isEmpty())) { conceptEntity.setDisplay(coding.getDisplay()); conceptEntity.setDescription(coding.getDisplay()); em.persist(conceptEntity); } } return conceptEntity; }
Example #22
Source File: Helper.java From cqf-ruler with Apache License 2.0 | 5 votes |
public static OperationOutcome createErrorOutcome(String display) { Coding code = new Coding().setDisplay(display); return new OperationOutcome().addIssue( new OperationOutcome.OperationOutcomeIssueComponent() .setSeverity(OperationOutcome.IssueSeverity.ERROR) .setCode(OperationOutcome.IssueType.PROCESSING) .setDetails(new CodeableConcept().addCoding(code)) ); }
Example #23
Source File: TranslationRequests.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
/** * This is just a convenience method that creates a codeableconcept if one * doesn't already exist, and adds a coding to it */ public TranslationRequests addCode(String theSystem, String theCode) { Validate.notBlank(theSystem, "theSystem must not be null"); Validate.notBlank(theCode, "theCode must not be null"); if (getCodeableConcept() == null) { setCodeableConcept(new CodeableConcept()); } getCodeableConcept().addCoding(new Coding().setSystem(theSystem).setCode(theCode)); return this; }
Example #24
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private String gen(Extension extension) throws DefinitionException { if (extension.getValue() instanceof CodeType) return ((CodeType) extension.getValue()).getValue(); if (extension.getValue() instanceof Coding) return gen((Coding) extension.getValue()); throw new DefinitionException("Unhandled type "+extension.getValue().getClass().getName()); }
Example #25
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
@Override public ValidationResult validateCode(String system, String code, String display) { try { if (codeSystems.containsKey(system) && codeSystems.get(system) != null) { return verifyCodeInCodeSystem(codeSystems.get(system), system, code, display); } else { return verifyCodeExternal(null, new Coding().setSystem(system).setCode(code).setDisplay(display), false); } } catch (Exception e) { return new ValidationResult(IssueSeverity.FATAL, "Error validating code \"" + code + "\" in system \"" + system + "\": " + e.getMessage()); } }
Example #26
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private String cacheId(CodeableConcept cc) { StringBuilder b = new StringBuilder(); for (Coding c : cc.getCoding()) { b.append("#"); b.append(cacheId(c)); } return b.toString(); }
Example #27
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private ValidationResult handleByCache(ValueSet vs, Coding coding, boolean tryCache) { String cacheId = cacheId(coding); Map<String, ValidationResult> cache = validationCache.get(vs.getUrl()); if (cache == null) { cache = new HashMap<String, IWorkerContext.ValidationResult>(); validationCache.put(vs.getUrl(), cache); } if (cache.containsKey(cacheId)) { return cache.get(cacheId); } if (!tryCache) { return null; } if (!cacheValidation) { return null; } if (failed.contains(vs.getUrl())) { return null; } ValueSetExpansionOutcome vse = expandVS(vs, true, false); if (vse.getValueset() == null || notcomplete(vse.getValueset())) { failed.add(vs.getUrl()); return null; } ValidationResult res = validateCode(coding, vse.getValueset()); cache.put(cacheId, res); return res; }
Example #28
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private String getCodingReference(Coding cc, String system) { if (cc.getSystem().equals(system)) return "#"+cc.getCode(); if (cc.getSystem().equals("http://snomed.info/sct")) return "http://snomed.info/sct/"+cc.getCode(); if (cc.getSystem().equals("http://loinc.org")) return "http://s.details.loinc.org/LOINC/"+cc.getCode()+".html"; return null; }
Example #29
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public String gen(Coding code) { if (code == null) return null; if (code.hasDisplayElement()) return code.getDisplay(); if (code.hasCodeElement()) return code.getCode(); return null; }
Example #30
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public String genType(Type type) throws DefinitionException { if (type instanceof Coding) return gen((Coding) type); if (type instanceof CodeableConcept) return displayCodeableConcept((CodeableConcept) type); if (type instanceof Quantity) return displayQuantity((Quantity) type); if (type instanceof Range) return displayRange((Range) type); return null; }