public boolean is(String system, String code) { return hasSystem() && hasCode() && this.getSystem().equals(system) && this.getCode().equals(code); }
protected void decorateCoding(Complex t, Coding element) { if (!element.hasSystem()) return; if ("http://snomed.info/sct".equals(element.getSystem())) { t.prefix("sct", "http://snomed.info/sct/"); t.predicate("a", "sct:"+element.getCode()); } else if ("http://snomed.info/sct".equals(element.getSystem())) { t.prefix("loinc", "http://loinc.org/rdf#"); t.predicate("a", "loinc:"+element.getCode()); } }
private void buildCodeableConceptExpression(ElementDefinition ed, StringBuilder expression, String discriminator, CodeableConcept cc) throws DefinitionException { if (cc.hasText()) throw new DefinitionException("Unsupported CodeableConcept pattern - using text - for discriminator(" + discriminator + ") for slice " + ed.getId()); if (!cc.hasCoding() || cc.getCoding().size() > 1) throw new DefinitionException("Unsupported CodeableConcept pattern - must be just one coding - for discriminator(" + discriminator + ") for slice " + ed.getId()); Coding c = cc.getCodingFirstRep(); if (c.hasExtension() || cc.hasExtension()) throw new DefinitionException("Unsupported CodeableConcept pattern - extensions are not allowed - for discriminator(" + discriminator + ") for slice " + ed.getId()); expression.append(" and " + discriminator + ".coding.where("); boolean first = true; if (c.hasSystem()) { first = false; expression.append("system = '"+c.getSystem()+"'"); } if (c.hasVersion()) { if (first) first = false; else expression.append(" and "); expression.append("version = '"+c.getVersion()+"'"); } if (c.hasCode()) { if (first) first = false; else expression.append(" and "); expression.append("code = '"+c.getCode()+"'"); } if (c.hasDisplay()) { if (first) first = false; else expression.append(" and "); expression.append("display = '"+c.getDisplay()+"'"); } expression.append(").exists()"); }
public CacheToken generateValidationToken(Coding code, ValueSet vs) { CacheToken ct = new CacheToken(); if (code.hasSystem()) ct.name = getNameForSystem(code.getSystem()); else ct.name = NAME_FOR_NO_SYSTEM; JsonParser json = new JsonParser(); json.setOutputStyle(OutputStyle.PRETTY); ValueSet vsc = getVSEssense(vs); try { ct.request = "{\"code\" : "+json.composeString(code, "code")+", \"valueSet\" :"+(vsc == null ? "null" : json.composeString(vsc))+"}"; } catch (IOException e) { throw new Error(e); } ct.key = String.valueOf(hashNWS(ct.request)); return ct; }
if (coding.hasSystem()) { predicates.add(criteriaBuilder.equal(groupJoin.get("mySource"), coding.getSystem()));
if (coding.hasSystem()) { predicates.add(criteriaBuilder.equal(groupJoin.get("myTarget"), coding.getSystem())); targetCodeSystem = coding.getSystem();
List<String> warnings = new ArrayList<String>(); for (Coding c : code.getCoding()) { if (!c.hasSystem()) warnings.add("Coding has no system"); CodeSystem cs = context.fetchCodeSystem(c.getSystem());
public CacheToken generateValidationToken(CodeableConcept code, ValueSet vs) { CacheToken ct = new CacheToken(); for (Coding c : code.getCoding()) { if (c.hasSystem()) ct.setName(getNameForSystem(c.getSystem())); } JsonParser json = new JsonParser(); json.setOutputStyle(OutputStyle.PRETTY); ValueSet vsc = getVSEssense(vs); try { ct.request = "{\"code\" : "+json.composeString(code, "codeableConcept")+", \"valueSet\" :"+json.composeString(vsc)+"}"; } catch (IOException e) { throw new Error(e); } ct.key = String.valueOf(hashNWS(ct.request)); return ct; }
for (ConceptMapGroupComponent g : cmap.getGroup()) { for (SourceElementComponent e : g.getElement()) { if (!src.hasSystem() && src.getCode().equals(e.getCode())) list.add(new SourceElementComponentWrapper(g, e)); else if (src.hasSystem() && src.getSystem().equals(g.getSource()) && src.getCode().equals(e.getCode())) list.add(new SourceElementComponentWrapper(g, e));
private boolean compareSystems(Coding expectedCoding, Coding value) { if (expectedCoding.hasSystem() && !value.hasSystem()) { return false; } if (expectedCoding.hasSystem()) { return expectedCoding.getSystem().equals(value.getSystem()); } return true; } private List<Element> findSubItems(Element item) {
public ValidationResult validateCode(Coding code) throws FHIRException { // first, we validate the concept itself String system = code.hasSystem() ? code.getSystem() : getValueSetSystem(); if (system == null && !code.hasDisplay()) { // dealing with just a plain code (enum) system = systemForCodeInValueSet(code.getCode()); } CodeSystem cs = context.fetchCodeSystem(system); if (cs == null) throw new FHIRException("Unable to resolve system "+system+" - system is not specified or implicit"); if (cs.getContent() != CodeSystemContentMode.COMPLETE) throw new FHIRException("Unable to resolve system "+system+" - system is not complete"); ValidationResult res = validateCode(code, cs); // then, if we have a value set, we check it's in the value set if (res.isOk() && valueset != null && !codeInValueSet(system, code.getCode())) res.setMessage("Not in value set "+valueset.getUrl()).setSeverity(IssueSeverity.ERROR); return res; }
public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); copyElement(src, tgt); if (src.hasSystem()) tgt.setSystem(src.getSystem()); if (src.hasVersion()) tgt.setVersion(src.getVersion()); if (src.hasCode()) tgt.setCode(src.getCode()); if (src.hasDisplay()) tgt.setDisplay(src.getDisplay()); if (src.hasUserSelected()) tgt.setUserSelected(src.getUserSelected()); return tgt; }
public boolean is(String system, String code) { return hasSystem() && hasCode() && this.getSystem().equals(system) && this.getCode().equals(code); }
protected void decorateCoding(Complex t, Coding element) { if (!element.hasSystem()) return; if ("http://snomed.info/sct".equals(element.getSystem())) { t.prefix("sct", "http://snomed.info/sct/"); t.predicate("a", "sct:"+element.getCode()); } else if ("http://snomed.info/sct".equals(element.getSystem())) { t.prefix("loinc", "http://loinc.org/rdf#"); t.predicate("a", "loinc:"+element.getCode()); } }
private void buildCodeableConceptExpression(ElementDefinition ed, StringBuilder expression, String discriminator, CodeableConcept cc) throws DefinitionException { if (cc.hasText()) throw new DefinitionException("Unsupported CodeableConcept pattern - using text - for discriminator(" + discriminator + ") for slice " + ed.getId()); if (!cc.hasCoding() || cc.getCoding().size() > 1) throw new DefinitionException("Unsupported CodeableConcept pattern - must be just one coding - for discriminator(" + discriminator + ") for slice " + ed.getId()); Coding c = cc.getCodingFirstRep(); if (c.hasExtension() || cc.hasExtension()) throw new DefinitionException("Unsupported CodeableConcept pattern - extensions are not allowed - for discriminator(" + discriminator + ") for slice " + ed.getId()); expression.append(" and " + discriminator + ".coding.where("); boolean first = true; if (c.hasSystem()) { first = false; expression.append("system = '"+c.getSystem()+"'"); } if (c.hasVersion()) { if (first) first = false; else expression.append(" and "); expression.append("version = '"+c.getVersion()+"'"); } if (c.hasCode()) { if (first) first = false; else expression.append(" and "); expression.append("code = '"+c.getCode()+"'"); } if (c.hasDisplay()) { if (first) first = false; else expression.append(" and "); expression.append("display = '"+c.getDisplay()+"'"); } expression.append(").exists()"); }
public CacheToken generateValidationToken(Coding code, ValueSet vs) { CacheToken ct = new CacheToken(); if (code.hasSystem()) ct.name = getNameForSystem(code.getSystem()); else ct.name = NAME_FOR_NO_SYSTEM; JsonParser json = new JsonParser(); json.setOutputStyle(OutputStyle.PRETTY); ValueSet vsc = getVSEssense(vs); try { ct.request = "{\"code\" : "+json.composeString(code, "code")+", \"valueSet\" :"+(vsc == null ? "null" : json.composeString(vsc))+"}"; } catch (IOException e) { throw new Error(e); } ct.key = String.valueOf(hashNWS(ct.request)); return ct; }
List<String> warnings = new ArrayList<String>(); for (Coding c : code.getCoding()) { if (!c.hasSystem()) warnings.add("Coding has no system"); CodeSystem cs = context.fetchCodeSystem(c.getSystem());
public CacheToken generateValidationToken(CodeableConcept code, ValueSet vs) { CacheToken ct = new CacheToken(); for (Coding c : code.getCoding()) { if (c.hasSystem()) ct.setName(getNameForSystem(c.getSystem())); } JsonParser json = new JsonParser(); json.setOutputStyle(OutputStyle.PRETTY); ValueSet vsc = getVSEssense(vs); try { ct.request = "{\"code\" : "+json.composeString(code, "codeableConcept")+", \"valueSet\" :"+json.composeString(vsc)+"}"; } catch (IOException e) { throw new Error(e); } ct.key = String.valueOf(hashNWS(ct.request)); return ct; }
public ValidationResult validateCode(Coding code) throws FHIRException { // first, we validate the concept itself String system = code.hasSystem() ? code.getSystem() : getValueSetSystem(); if (system == null && !code.hasDisplay()) { // dealing with just a plain code (enum) system = systemForCodeInValueSet(code.getCode()); } CodeSystem cs = context.fetchCodeSystem(system); if (cs == null) throw new FHIRException("Unable to resolve system "+system+" - system is not specified or implicit"); if (cs.getContent() != CodeSystemContentMode.COMPLETE) throw new FHIRException("Unable to resolve system "+system+" - system is not complete"); ValidationResult res = validateCode(code, cs); // then, if we have a value set, we check it's in the value set if (res.isOk() && valueset != null && !codeInValueSet(system, code.getCode())) res.setMessage("Not in value set "+valueset.getUrl()).setSeverity(IssueSeverity.ERROR); return res; }
public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); copyElement(src, tgt); if (src.hasSystem()) tgt.setSystem(src.getSystem()); if (src.hasVersion()) tgt.setVersion(src.getVersion()); if (src.hasCode()) tgt.setCode(src.getCode()); if (src.hasDisplay()) tgt.setDisplay(src.getDisplay()); if (src.hasUserSelected()) tgt.setUserSelected(src.getUserSelected()); return tgt; }