Java Code Examples for org.hl7.fhir.dstu3.model.ElementDefinition#setComment()
The following examples show how to use
org.hl7.fhir.dstu3.model.ElementDefinition#setComment() .
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: ADLImporter.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private void genElements(StructureDefinition sd, String path, NodeTreeEntry item) throws Exception { ElementDefinition ed = sd.getSnapshot().addElement(); ed.setPath(path); ed.setMax(item.cardinality.max); ed.setMin(Integer.parseInt(item.cardinality.min)); ed.setShort(texts.get(item.atCode).text); ed.setDefinition(texts.get(item.atCode).description); ed.setComment(texts.get(item.atCode).comment); Element te = findTypeElement(item.typeName); if (te.hasAttribute("profile")) ed.addType().setCode(te.getAttribute("fhir")).setProfile(te.getAttribute("profile")); else ed.addType().setCode(te.getAttribute("fhir")); ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); for (NodeTreeEntry child : item.children) { genElements(sd, path+"."+child.name, child); } }
Example 2
Source File: LoincToDEConvertor.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
private void processLoincCodes() { Element row = XMLUtil.getFirstChild(xml.getDocumentElement()); int i = 0; while (row != null) { i++; if (i % 1000 == 0) System.out.print("."); String code = col(row, "LOINC_NUM"); String comp = col(row, "COMPONENT"); DataElement de = new DataElement(); de.setId("loinc-"+code); de.setMeta(new Meta().setLastUpdatedElement(InstantType.now())); bundle.getEntry().add(new BundleEntryComponent().setResource(de)); Identifier id = new Identifier(); id.setSystem("http://hl7.org/fhir/commondataelement/loinc"); id.setValue(code); de.addIdentifier(id); de.setPublisher("Regenstrief + FHIR Project Team"); if (!col(row, "STATUS").equals("ACTIVE")) de.setStatus(PublicationStatus.DRAFT); // till we get good at this else de.setStatus(PublicationStatus.RETIRED); de.setDateElement(DateTimeType.now()); de.setName(comp); ElementDefinition dee = de.addElement(); // PROPERTY ignore // TIME_ASPCT // SYSTEM // SCALE_TYP // METHOD_TYP // dee.getCategory().add(new CodeableConcept().setText(col(row, "CLASS"))); // SOURCE // DATE_LAST_CHANGED - should be in ? // CHNG_TYPE dee.setComment(col(row , "COMMENTS")); if (hasCol(row, "CONSUMER_NAME")) dee.addAlias(col(row, "CONSUMER_NAME")); // MOLAR_MASS // CLASSTYPE // FORMULA // SPECIES // EXMPL_ANSWERS // ACSSYM // BASE_NAME - ? this is a relationship // NAACCR_ID // ---------- CODE_TABLE todo // SURVEY_QUEST_TEXT // SURVEY_QUEST_SRC if (hasCol(row, "RELATEDNAMES2")) { String n = col(row, "RELATEDNAMES2"); for (String s : n.split("\\;")) { if (!Utilities.noString(s)) dee.addAlias(s); } } dee.addAlias(col(row, "SHORTNAME")); // ORDER_OBS // CDISC Code // HL7_FIELD_SUBFIELD_ID // ------------------ EXTERNAL_COPYRIGHT_NOTICE todo dee.setDefinition(col(row, "LONG_COMMON_NAME")); // HL7_V2_DATATYPE String cc = makeType(col(row, "HL7_V3_DATATYPE"), code); if (cc != null) dee.addType().setCode(cc); // todo... CURATED_RANGE_AND_UNITS // todo: DOCUMENT_SECTION // STATUS_REASON // STATUS_TEXT // CHANGE_REASON_PUBLIC // COMMON_TEST_RANK // COMMON_ORDER_RANK // COMMON_SI_TEST_RANK // HL7_ATTACHMENT_STRUCTURE // units: // UNITSREQUIRED // SUBMITTED_UNITS ToolingExtensions.setAllowableUnits(dee, makeUnits(col(row, "EXAMPLE_UNITS"), col(row, "EXAMPLE_UCUM_UNITS"))); // EXAMPLE_SI_UCUM_UNITS row = XMLUtil.getNextSibling(row); } System.out.println("done"); }
Example 3
Source File: ProfileComparer.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
/** * left and right refer to the same element. Are they compatible? * @param outcome * @param outcome * @param path * @param left * @param right * @- if there's a problem that needs fixing in this code * @throws DefinitionException * @throws IOException * @throws FHIRFormatError */ private boolean compareElements(ProfileComparison outcome, String path, DefinitionNavigator left, DefinitionNavigator right) throws DefinitionException, IOException, FHIRFormatError { // preconditions: assert(path != null); assert(left != null); assert(right != null); assert(left.path().equals(right.path())); // we ignore slicing right now - we're going to clone the root one anyway, and then think about clones // simple stuff ElementDefinition subset = new ElementDefinition(); subset.setPath(left.path()); // not allowed to be different: subset.getRepresentation().addAll(left.current().getRepresentation()); // can't be bothered even testing this one if (!outcome.ruleCompares(subset, left.current().getDefaultValue(), right.current().getDefaultValue(), path+".defaultValue[x]", BOTH_NULL)) return false; subset.setDefaultValue(left.current().getDefaultValue()); if (!outcome.ruleEqual(path, subset, left.current().getMeaningWhenMissing(), right.current().getMeaningWhenMissing(), "meaningWhenMissing Must be the same", true)) return false; subset.setMeaningWhenMissing(left.current().getMeaningWhenMissing()); if (!outcome.ruleEqual(subset, left.current().getIsModifier(), right.current().getIsModifier(), path, "isModifier")) return false; subset.setIsModifier(left.current().getIsModifier()); if (!outcome.ruleEqual(subset, left.current().getIsSummary(), right.current().getIsSummary(), path, "isSummary")) return false; subset.setIsSummary(left.current().getIsSummary()); // descriptive properties from ElementDefinition - merge them: subset.setLabel(mergeText(subset, outcome, path, "label", left.current().getLabel(), right.current().getLabel())); subset.setShort(mergeText(subset, outcome, path, "short", left.current().getShort(), right.current().getShort())); subset.setDefinition(mergeText(subset, outcome, path, "definition", left.current().getDefinition(), right.current().getDefinition())); subset.setComment(mergeText(subset, outcome, path, "comments", left.current().getComment(), right.current().getComment())); subset.setRequirements(mergeText(subset, outcome, path, "requirements", left.current().getRequirements(), right.current().getRequirements())); subset.getCode().addAll(mergeCodings(left.current().getCode(), right.current().getCode())); subset.getAlias().addAll(mergeStrings(left.current().getAlias(), right.current().getAlias())); subset.getMapping().addAll(mergeMappings(left.current().getMapping(), right.current().getMapping())); // left will win for example subset.setExample(left.current().hasExample() ? left.current().getExample() : right.current().getExample()); subset.setMustSupport(left.current().getMustSupport() || right.current().getMustSupport()); ElementDefinition superset = subset.copy(); // compare and intersect superset.setMin(unionMin(left.current().getMin(), right.current().getMin())); superset.setMax(unionMax(left.current().getMax(), right.current().getMax())); subset.setMin(intersectMin(left.current().getMin(), right.current().getMin())); subset.setMax(intersectMax(left.current().getMax(), right.current().getMax())); outcome.rule(subset, subset.getMax().equals("*") || Integer.parseInt(subset.getMax()) >= subset.getMin(), path, "Cardinality Mismatch: "+card(left)+"/"+card(right)); superset.getType().addAll(unionTypes(path, left.current().getType(), right.current().getType())); subset.getType().addAll(intersectTypes(subset, outcome, path, left.current().getType(), right.current().getType())); outcome.rule(subset, !subset.getType().isEmpty() || (!left.current().hasType() && !right.current().hasType()), path, "Type Mismatch:\r\n "+typeCode(left)+"\r\n "+typeCode(right)); // <fixed[x]><!-- ?? 0..1 * Value must be exactly this --></fixed[x]> // <pattern[x]><!-- ?? 0..1 * Value must have at least these property values --></pattern[x]> superset.setMaxLengthElement(unionMaxLength(left.current().getMaxLength(), right.current().getMaxLength())); subset.setMaxLengthElement(intersectMaxLength(left.current().getMaxLength(), right.current().getMaxLength())); if (left.current().hasBinding() || right.current().hasBinding()) { compareBindings(outcome, subset, superset, path, left.current(), right.current()); } // note these are backwards superset.getConstraint().addAll(intersectConstraints(path, left.current().getConstraint(), right.current().getConstraint())); subset.getConstraint().addAll(unionConstraints(subset, outcome, path, left.current().getConstraint(), right.current().getConstraint())); // now process the slices if (left.current().hasSlicing() || right.current().hasSlicing()) { if (isExtension(left.path())) return compareExtensions(outcome, path, superset, subset, left, right); // return true; else throw new DefinitionException("Slicing is not handled yet"); // todo: name } // add the children outcome.subset.getSnapshot().getElement().add(subset); outcome.superset.getSnapshot().getElement().add(superset); return compareChildren(subset, outcome, path, left, right); }