public static CodeableConcept readAsCodeableConcept(Element element) { CodeableConcept cc = new CodeableConcept(); List<Element> list = new ArrayList<Element>(); element.getNamedChildren("coding", list); for (Element item : list) cc.addCoding(readAsCoding(item)); cc.setText(element.getNamedChildValue("text")); return cc; }
private void checkCodeableConcept(List<ValidationMessage> errors, String path, Element focus, CodeableConcept fixed) { checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text", focus); List<Element> codings = new ArrayList<Element>(); focus.getNamedChildren("coding", codings); if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, codings.size() == fixed.getCoding().size(), "Expected " + Integer.toString(fixed.getCoding().size()) + " but found " + Integer.toString(codings.size()) + " coding elements")) { for (int i = 0; i < codings.size(); i++) checkFixedValue(errors, path + ".coding", codings.get(i), fixed.getCoding().get(i), "coding", focus); } }
public static void merge(CodeableConcept dst, CodeableConcept src) { if (dst.getTextElement() == null && src.getTextElement() != null) dst.setTextElement(src.getTextElement()); }
@Override public Base setProperty(int hash, String name, Base value) throws FHIRException { switch (hash) { case -1355086998: // coding this.getCoding().add(castToCoding(value)); // Coding return value; case 3556653: // text this.text = castToString(value); // StringType return value; default: return super.setProperty(hash, name, value); } }
private CodeableConcept makeUnits(String text, String ucum) { if (Utilities.noString(text) && Utilities.noString(ucum)) return null; CodeableConcept cc = new CodeableConcept(); cc.setText(text); cc.getCoding().add(new Coding().setCode(ucum).setSystem("http://unitsofmeasure.org")); return cc; } public Bundle getBundle() {
private static org.hl7.fhir.r4.model.CodeableConcept convertConditionClinicalStatus(String src) throws FHIRException { if (src == null) return null; org.hl7.fhir.r4.model.CodeableConcept cc = new org.hl7.fhir.r4.model.CodeableConcept(); cc.addCoding().setSystem("http://hl7.org/fhir/condition-clinical").setCode(src); return cc; }
public CodeableConcept addJurisdiction() { //3 CodeableConcept t = new CodeableConcept(); if (this.jurisdiction == null) this.jurisdiction = new ArrayList<CodeableConcept>(); this.jurisdiction.add(t); return t; }
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 static boolean matches(CodeableConcept c1, CodeableConcept c2, MatchProfile profile) throws FHIRException { if (profile != null) throw new NotImplementedException("Not Implemented Yet"); if (c1.getCoding().isEmpty() && c2.getCoding().isEmpty()) { return matches(c1.getText(), c2.getText(), null); } else { // in the absence of specific guidance, we just require that all codes match boolean ok = true; for (Coding c : c1.getCoding()) { ok = ok && inList(c2.getCoding(), c, null); } for (Coding c : c2.getCoding()) { ok = ok && inList(c1.getCoding(), c, null); } return ok; } }
public org.hl7.fhir.instance.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.CodeableConcept tgt = new org.hl7.fhir.instance.model.CodeableConcept(); copyElement(src, tgt); for (org.hl7.fhir.r4.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); tgt.setText(src.getText()); return tgt; }
private void extractTokensFromCodeableConcept(List<String> theSystems, List<String> theCodes, CodeableConcept theCodeableConcept, ResourceTable theEntity, Set<BaseResourceIndexedSearchParam> theListToPopulate, RuntimeSearchParam theParameterDef) { for (Coding nextCoding : theCodeableConcept.getCoding()) { extractTokensFromCoding(theSystems, theCodes, theEntity, theListToPopulate, theParameterDef, nextCoding); } }
public static CodeableConcept newCodeableConcept(String code, String system, String display) { CodeableConcept cc = new CodeableConcept(); Coding c = new Coding(); c.setCode(code); c.setSystem(system); c.setDisplay(display); cc.getCoding().add(c); return cc; }
public boolean hasReasonCode() { if (this.reasonCode == null) return false; for (CodeableConcept item : this.reasonCode) if (!item.isEmpty()) return true; return false; }
private boolean hasDescription(Type fixed) { if (fixed instanceof Coding) { return ((Coding) fixed).hasDisplay(); } else if (fixed instanceof CodeableConcept) { CodeableConcept cc = (CodeableConcept) fixed; if (cc.hasText()) return true; for (Coding c : cc.getCoding()) if (c.hasDisplay()) return true; } // (fixed instanceof CodeType) || (fixed instanceof Quantity); return false; }
public static OperationOutcomeIssueComponent convertToIssue(ValidationMessage message, OperationOutcome op) { OperationOutcomeIssueComponent issue = new OperationOutcome.OperationOutcomeIssueComponent(); issue.setCode(convert(message.getType())); if (message.getLocation() != null) { StringType s = new StringType(); s.setValue(message.getLocation()+(message.getLine()>= 0 && message.getCol() >= 0 ? " (line "+Integer.toString(message.getLine())+", col"+Integer.toString(message.getCol())+")" : "") ); issue.getLocation().add(s); } issue.setSeverity(convert(message.getLevel())); CodeableConcept c = new CodeableConcept(); c.setText(message.getMessage()); issue.setDetails(c); if (message.getSource() != null) { issue.getExtension().add(ToolingExtensions.makeIssueSource(message.getSource())); } return issue; }
&& theSourceCoding.hasCode(); boolean haveSourceCodeableConcept= theSourceCodeableConcept != null && theSourceCodeableConcept.hasCoding() && theSourceCodeableConcept.getCodingFirstRep().hasCode(); boolean haveTargetValueSet = theTargetValueSet != null && theTargetValueSet.hasValue(); translationRequest.getCodeableConcept().addCoding().setCodeElement(theSourceCode); translationRequest.getCodeableConcept().getCodingFirstRep().setSystemElement(theSourceCodeSystem); translationRequest.getCodeableConcept().getCodingFirstRep().setVersionElement(theSourceCodeSystemVersion); translationRequest.getCodeableConcept().addCoding(theSourceCoding); } else { translationRequest.setCodeableConcept(theSourceCodeableConcept);
try { CodeableConcept cc = ObjectConverter.readAsCodeableConcept(element); if (!cc.hasCoding()) { if (binding.getStrength() == BindingStrength.REQUIRED) rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code is required from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); if (binding.getStrength() != BindingStrength.EXAMPLE) { boolean atLeastOneSystemIsSupported = false; for (Coding nextCoding : cc.getCoding()) { String nextSystem = nextCoding.getSystem(); if (isNotBlank(nextSystem) && context.supportsSystem(nextSystem)) { for (Coding nextCoding : cc.getCoding()) { String nextCode = nextCoding.getCode(); String nextSystem = nextCoding.getSystem();
@Override public Base makeProperty(int hash, String name) throws FHIRException { switch (hash) { case -1355086998: return addCoding(); case 3556653: return getTextElement(); default: return super.makeProperty(hash, name); } }