use of org.hl7.fhir.r4b.model.DomainResource in project org.hl7.fhir.core by hapifhir.
the class NarrativeRemover method execute.
private static void execute(File folder) {
for (File f : folder.listFiles()) {
if (f.isDirectory())
execute(f);
else {
System.out.println(f.getAbsolutePath());
try {
Resource r = new JsonParser().parse(new FileInputStream(f));
if (r instanceof DomainResource) {
DomainResource d = (DomainResource) r;
d.setText(null);
new JsonParser().compose(new FileOutputStream(f), d);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
use of org.hl7.fhir.r4b.model.DomainResource in project org.hl7.fhir.core by hapifhir.
the class XmlParserBase method parseDomainResourceContained.
protected DomainResource parseDomainResourceContained(XmlPullParser xpp) throws IOException, FHIRFormatError, XmlPullParserException {
next(xpp);
int eventType = nextNoWhitespace(xpp);
if (eventType == XmlPullParser.START_TAG) {
DomainResource dr = (DomainResource) parseResource(xpp);
nextNoWhitespace(xpp);
next(xpp);
return dr;
} else {
unknownContent(xpp);
return null;
}
}
use of org.hl7.fhir.r4b.model.DomainResource in project org.hl7.fhir.core by hapifhir.
the class ResourceRenderer method render.
/**
* given a resource, update it's narrative with the best rendering available
*
* @param r - the domain resource in question
*
* @throws IOException
* @throws EOperationOutcome
* @throws FHIRException
*/
public void render(DomainResource r) throws IOException, FHIRException, EOperationOutcome {
XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
boolean ofr = forResource;
boolean hasExtensions;
try {
forResource = true;
hasExtensions = render(x, r);
} finally {
forResource = ofr;
}
inject(r, x, hasExtensions ? NarrativeStatus.EXTENSIONS : NarrativeStatus.GENERATED);
}
use of org.hl7.fhir.r4b.model.DomainResource in project odm2fhir by num-codex.
the class Subject method map.
public Stream<DomainResource> map(SubjectData subjectData) {
var value = getIdentifierAssigner();
if (!ENVIRONMENT.containsProperty("debug")) {
value = sha256Hex(value);
}
var organizationIdentifier = new Identifier().setSystem(getIdentifierSystem(ORGANIZATION)).setValue(value);
var organization = (Organization) new Organization().setName(getIdentifierAssigner()).addIdentifier(organizationIdentifier).setId(sha256Hex(organizationIdentifier.getSystem() + organizationIdentifier.getValue()));
organizationReference = new Reference(format("%s/%s", ORGANIZATION.toCode(), organization.getId()));
value = subjectData.getSubjectKey();
if (!ENVIRONMENT.containsProperty("debug")) {
value = sha256Hex(value);
}
var patientIdentifier = new Identifier().setSystem(getIdentifierSystem(PATIENT)).setValue(value).setType(new CodeableConcept(new Coding().setSystem(IDENTIFIER_TYPE_CODES.getUrl()).setCode(MR.toCode()))).setAssigner(organizationReference);
patient = (Patient) new Patient().addIdentifier(patientIdentifier).setId(sha256Hex(patientIdentifier.getSystem() + patientIdentifier.getValue())).setMeta(new Meta().addProfile(NUMStructureDefinition.PATIENT.getUrl()));
patientReference = new Reference(format("%s/%s", PATIENT.toCode(), patient.getId()));
return Stream.concat(Stream.of(patient, organization), subjectData.getMergedStudyEventData().stream().flatMap(studyEventData -> new StudyEvent().map(this, studyEventData)).peek(this::setId).peek(this::setPatientSubject));
}
use of org.hl7.fhir.r4b.model.DomainResource in project odm2fhir by num-codex.
the class ImagingProcedures method map.
protected Stream<DomainResource> map(FormData formData) {
var techniqueGroup = formData.getItemGroupData("bildgebung.bildgebende_verfahren_ct");
var befundGroup = formData.getItemGroupData("bildgebung.befund_bildgebender_verfahren_ct");
var generalCoding = formData.getItemData("bildgebende_verfahren");
if (!"1".equals(generalCoding.getValue())) {
return Stream.empty();
}
var itemDatas = Stream.of(techniqueGroup.getItemData(), befundGroup.getItemData()).flatMap(List::stream).collect(toMap(ItemData::getItemOID, identity()));
return Stream.of("ct", "roentgen", "us").filter(type -> contains(itemDatas.get("bildgebende_verfahren_" + type).getValue(), "410605003")).filter(type -> !(itemDatas.get("befund_bildgebender_verfahren_" + type).isEmpty())).flatMap(type -> {
var diagnosticReport = createDiagnosticReport(itemDatas.get("befund_bildgebender_verfahren_" + type));
var procedure = createProcedure(itemDatas.get("bildgebende_verfahren_" + type)).addReport(new Reference(format("%s/%s", DIAGNOSTICREPORT.toCode(), diagnosticReport.getId())));
return Stream.of(diagnosticReport, procedure);
});
}
Aggregations