use of org.hl7.fhir.r5.model.Property in project Gravity-SDOH-Exchange-RI by FHIR.
the class OrganizationToDtoConverter method convert.
@Override
public OrganizationDto convert(Organization org) {
String orgId = org.getIdElement().getIdPart();
OrganizationDto orgDto = new OrganizationDto(orgId);
orgDto.setName(org.getName());
// We are interested only in CBO/CP types. Other are ignored.
Coding coding = FhirUtil.findCoding(org.getType(), OrganizationTypeCode.SYSTEM);
if (coding == null) {
orgDto.getErrors().add(String.format("Organization with id '%s' has no coding with system '%s' within a 'type' property. Such organizations " + "are " + "not expected in this context.", orgId, OrganizationTypeCode.SYSTEM));
} else {
try {
orgDto.setType(OrganizationTypeCode.fromCode(coding.getCode()));
} catch (FHIRException exc) {
orgDto.getErrors().add(String.format("OrganizationTypeCode code '%s' cannot be resolved for Organization with id '%s'.", coding.getCode(), orgId));
}
}
return orgDto;
}
use of org.hl7.fhir.r5.model.Property in project Gravity-SDOH-Exchange-RI by FHIR.
the class ProblemBundleToDtoConverter method conditionInfoToDto.
@Override
protected ProblemDto conditionInfoToDto(ConditionInfoBundleExtractor.ConditionInfoHolder conditionInfo) {
// TODO refactor this. Avoid manual casting. Refactor the design of a base class instead.
Assert.isInstanceOf(ProblemInfoBundleExtractor.ProblemInfoHolder.class, conditionInfo, "conditionInfo must be a ProblemInfoHolder.");
ProblemInfoBundleExtractor.ProblemInfoHolder probleminfo = (ProblemInfoBundleExtractor.ProblemInfoHolder) conditionInfo;
Condition condition = probleminfo.getCondition();
ProblemDto problemDto = super.conditionInfoToDto(probleminfo);
// Onset must be available for the problem list items.
if (condition.getOnset() != null) {
problemDto.setStartDate(FhirUtil.toLocalDateTime((DateTimeType) condition.getOnset()));
} else {
problemDto.getErrors().add("Condition is a problem-list-item but an onset property is missing or not of a DateTimeType " + "type.");
}
problemDto.getTasks().addAll(probleminfo.getTasks().stream().map(t -> new TaskInfoDto(t.getId(), t.getName(), t.getStatus())).collect(Collectors.toList()));
problemDto.getGoals().addAll(probleminfo.getGoals().stream().map(t -> new GoalInfoDto(t.getId(), t.getName(), t.getStatus())).collect(Collectors.toList()));
return problemDto;
}
use of org.hl7.fhir.r5.model.Property in project org.hl7.fhir.core by hapifhir.
the class ISO21090Importer method produceProperties.
private void produceProperties(List<ElementDefinition> elements, String name, List<Property> properties, boolean attrMode, boolean snapshot) throws FHIRFormatError {
for (Property p : properties) {
if (p.isIsattr() == attrMode) {
ElementDefinition ed = new ElementDefinition();
elements.add(ed);
ed.setPath(name + "." + p.getName());
if (p.getType().startsWith("xsd:"))
ToolingExtensions.addStringExtension(ed.addType(), ToolingExtensions.EXT_XML_TYPE, p.getType());
else
ed.addType().setCode(p.getType());
ed.setMin(p.getMin());
ed.setMax(p.getMax() == Integer.MAX_VALUE ? "*" : Integer.toString(p.getMax()));
ed.setDefinition(p.getDoco());
if (p.isIsattr())
ed.addRepresentation(PropertyRepresentation.XMLATTR);
if (p.getBinding() != null)
ed.getBinding().setStrength(BindingStrength.REQUIRED).setValueSet(new UriType("http://hl7.org/fhir/iso21090/ValueSet/" + p.getBinding()));
if (snapshot)
ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax());
}
}
}
use of org.hl7.fhir.r5.model.Property in project org.hl7.fhir.core by hapifhir.
the class LoincToDEConvertor method processLoincCodes.
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"))
// till we get good at this
de.setStatus(ConformanceResourceStatus.DRAFT);
else
de.setStatus(ConformanceResourceStatus.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.setComments(col(row, "COMMENTS"));
if (hasCol(row, "CONSUMER_NAME"))
dee.addAlias(col(row, "CONSUMER_NAME"));
// 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");
}
use of org.hl7.fhir.r5.model.Property in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCodeSystemPropertyComponent.
protected void composeCodeSystemPropertyComponent(Complex parent, String parentType, String name, CodeSystem.PropertyComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "property", name, element, index);
if (element.hasCodeElement())
composeCode(t, "CodeSystem", "code", element.getCodeElement(), -1);
if (element.hasUriElement())
composeUri(t, "CodeSystem", "uri", element.getUriElement(), -1);
if (element.hasDescriptionElement())
composeString(t, "CodeSystem", "description", element.getDescriptionElement(), -1);
if (element.hasTypeElement())
composeEnum(t, "CodeSystem", "type", element.getTypeElement(), -1);
}
Aggregations