use of com.nedap.archie.rm.generic.PartySelf in project openEHR_SDK by ehrbase.
the class DefaultRestEhrFieldsEndpointIT method testCreateEhrWithStatus.
@Test
public void testCreateEhrWithStatus() {
EhrStatus ehrStatus = new EhrStatus();
ehrStatus.setQueryable(false);
ehrStatus.setModifiable(false);
HierObjectId subjectId = new HierObjectId(UUID.randomUUID().toString());
ehrStatus.setSubject(new PartySelf(new PartyRef(subjectId, "default", "PERSON")));
ehrStatus.setArchetypeNodeId("just-a-status");
ehrStatus.setName(new DvText("Status"));
ehr = openEhrClient.ehrEndpoint().createEhr(ehrStatus);
assertThat(ehr).isNotNull();
EhrStatus actual = openEhrClient.ehrEndpoint().getEhrStatus(ehr).get();
assertThat(actual.getSubject().getExternalRef().getId()).isEqualTo(subjectId);
}
use of com.nedap.archie.rm.generic.PartySelf in project openEHR_SDK by ehrbase.
the class TestData method buildTestVirologischerBefundComposition.
public static VirologischerBefundComposition buildTestVirologischerBefundComposition() {
// openEHR-EHR-COMPOSITION.report-result.v1
VirologischerBefundComposition virologischerBefundComposition = new VirologischerBefundComposition();
virologischerBefundComposition.setComposer(new PartyIdentified(null, "Test", null));
virologischerBefundComposition.setCategoryDefiningCode(Category.EVENT);
virologischerBefundComposition.setLanguage(Language.DE);
virologischerBefundComposition.setTerritory(Territory.DE);
virologischerBefundComposition.setStartTimeValue(OffsetDateTime.now());
virologischerBefundComposition.setSettingDefiningCode(Setting.SECONDARY_MEDICAL_CARE);
// context, other_context
FallidentifikationCluster fallidentifikationCluster = new FallidentifikationCluster();
fallidentifikationCluster.setFallKennungValue("9251377");
virologischerBefundComposition.setFallidentifikation(fallidentifikationCluster);
virologischerBefundComposition.setBerichtIdValue("15a69a62-1ea7-4111-98a5-28aeae854bcd");
virologischerBefundComposition.setStatusValue("Endbefund");
// openEHR-EHR-CLUSTER.specimen.v1
ProbeCluster probeCluster = new ProbeCluster();
probeCluster.setZeitpunktDerProbenentnahmeValue(new DvDateTime("2020-04-01T12:00:00Z").getValue());
probeCluster.setProbenartValue("Blut");
probeCluster.setZeitpunktDesProbeneingangsValue(new DvDateTime("2020-04-02T09:00:00Z").getValue());
probeCluster.setKommentarDesProbennehmersValue("Kommentar zur Probe");
probeCluster.setKommentarValue("Kommentar");
// openEHR-EHR-CLUSTER.laboratory_test_analyte.v1
ProVirusCluster proVirusCluster1 = new ProVirusCluster();
proVirusCluster1.setVirusValue("SARS-Cov-2");
proVirusCluster1.setAnalyseergebnisReihenfolgeMagnitude(Long.valueOf(32));
DvIdentifier identifier = new DvIdentifier();
identifier.setIssuer("Issuer");
identifier.setAssigner("Assigner");
identifier.setId("9a0e5173-07c8-443d-b414-24432b9d95ca");
identifier.setType("Prescription");
proVirusCluster1.setZugehorigeLaborprobe(identifier);
ProVirusCluster proVirusCluster2 = new ProVirusCluster();
proVirusCluster2.setVirusValue("SARS-Cov-2");
proVirusCluster2.setAnalyseergebnisReihenfolgeMagnitude(Long.valueOf(34));
proVirusCluster2.setZugehorigeLaborprobe(identifier);
// openEHR-EHR-CLUSTER.laboratory_test_panel.v0
KulturCluster kulturCluster = new KulturCluster();
kulturCluster.setProVirus(new ArrayList<>());
kulturCluster.getProVirus().add(proVirusCluster1);
kulturCluster.getProVirus().add(proVirusCluster2);
// openEHR-EHR-OBSERVATION.laboratory_test_result.v1
BefundObservation befundObservation = new BefundObservation();
// set clusters in observation
befundObservation.setKultur(new ArrayList<>());
befundObservation.getKultur().add(kulturCluster);
befundObservation.setProbe(new ArrayList<>());
befundObservation.getProbe().add(probeCluster);
befundObservation.setOriginValue(new DvDateTime("2020-04-02T12:00:00Z").getValue());
befundObservation.setTimeValue(new DvDateTime("2020-04-02T14:00:00Z").getValue());
befundObservation.setLabortestBezeichnungValue("Virologische Untersuchung");
befundObservation.setSubject(new PartySelf());
befundObservation.setLanguage(Language.DE);
virologischerBefundComposition.setBefund(befundObservation);
return virologischerBefundComposition;
}
use of com.nedap.archie.rm.generic.PartySelf in project openEHR_SDK by ehrbase.
the class TestData method buildTestPatientenaufenthaltComposition.
public static PatientenaufenthaltComposition buildTestPatientenaufenthaltComposition() {
PatientenaufenthaltComposition patientenaufenthaltComposition = new PatientenaufenthaltComposition();
patientenaufenthaltComposition.setComposer(new PartyIdentified(null, "Test", null));
patientenaufenthaltComposition.setCategoryDefiningCode(Category.EVENT);
patientenaufenthaltComposition.setLanguage(Language.DE);
patientenaufenthaltComposition.setTerritory(Territory.DE);
patientenaufenthaltComposition.setStartTimeValue(OffsetDateTime.now());
patientenaufenthaltComposition.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
VersorgungsortAdminEntry versorgungsortAdminEntry = new VersorgungsortAdminEntry();
StandortCluster standortCluster = new StandortCluster();
standortCluster.setStandorttypValue("Test");
standortCluster.setStandortbeschreibungValue("Beschreibung");
standortCluster.setStandortschlusselDefiningCode(StandortschlusselDefiningCode.ANGIOLOGIE.ANGIOLOGIE);
standortCluster.setBettplatzkennungValue("Platz 2");
versorgungsortAdminEntry.setStandort(standortCluster);
versorgungsortAdminEntry.setBeginnValue(new DvDateTime("2020-01-01T10:00Z").getValue());
versorgungsortAdminEntry.setEndeValue(new DvDateTime("2020-01-01T12:00Z").getValue());
versorgungsortAdminEntry.setGrundDesAufenthaltesValue("test value");
versorgungsortAdminEntry.setLanguage(Language.DE);
versorgungsortAdminEntry.setSubject(new PartySelf());
patientenaufenthaltComposition.setVersorgungsort(versorgungsortAdminEntry);
return patientenaufenthaltComposition;
}
use of com.nedap.archie.rm.generic.PartySelf in project openEHR_SDK by ehrbase.
the class EntryPostprocessor method process.
/**
* {@inheritDoc}
*/
@Override
public void process(String term, Entry rmObject, Map<FlatPathDto, String> values, Set<String> consumedPaths, Context<Map<FlatPathDto, String>> context) {
consumedPaths.add(term + PATH_DIVIDER + "encoding|code");
consumedPaths.add(term + PATH_DIVIDER + "encoding|terminology");
Map<FlatPathDto, String> subjectValues = FlatHelper.filter(values, term + "/subject", false);
if (!subjectValues.isEmpty()) {
if (rmObject.getSubject() == null) {
// If it was PartyRelated it would be set by now do to the relationship and if it was
// PartySelf subjectValues would be empty
rmObject.setSubject(new PartyIdentified());
}
callUnmarshal(term, "subject", rmObject.getSubject(), values, consumedPaths, context, context.getNodeDeque().peek().findChildById("subject").orElse(buildDummyChild("subject", context.getNodeDeque().peek())));
}
PartyProxy subject = rmObject.getSubject();
if (subject == null || (subject instanceof PartyIdentified && ((PartyIdentified) subject).getName() == null && CollectionUtils.isEmpty(((PartyIdentified) subject).getIdentifiers()) && subject.getExternalRef() == null && (!(subject instanceof PartyRelated) || ((PartyRelated) subject).getRelationship() == null || StringUtils.isEmpty(((PartyRelated) subject).getRelationship().getValue())))) {
rmObject.setSubject(new PartySelf());
}
Map<FlatPathDto, String> providerList = values.entrySet().stream().filter(e -> e.getKey().startsWith(term + PATH_DIVIDER + "_provider")).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
if (!MapUtils.isEmpty(providerList)) {
if (!(rmObject.getProvider() instanceof PartyIdentified)) {
rmObject.setProvider(new PartyIdentified());
}
PartyIdentifiedRMUnmarshaller partyIdentifiedRMUnmarshaller = new PartyIdentifiedRMUnmarshaller();
partyIdentifiedRMUnmarshaller.handle(term + PATH_DIVIDER + "_provider", (PartyIdentified) rmObject.getProvider(), providerList, null, consumedPaths);
}
Map<Integer, Map<String, String>> other = extractMultiValued(term, "_other_participation", values);
other.values().stream().map(Map::entrySet).map(s -> s.stream().collect(Collectors.toMap(e -> "ctx/" + DefaultValuePath.PARTICIPATION.getPath() + "_" + e.getKey().replace("identifiers_", "identifiers|"), e -> StringUtils.wrap(e.getValue(), '"'))).entrySet()).map(DefaultValues::buildParticipation).forEach(rmObject::addOtherParticipant);
consumeAllMatching(term + PATH_DIVIDER + "_other_participation", values, consumedPaths, false);
Map<FlatPathDto, String> workflowIdValues = filter(values, term + "/_work_flow_id", false);
if (!workflowIdValues.isEmpty()) {
ObjectRef<GenericId> ref = new ObjectRef<>();
ref.setId(new GenericId());
rmObject.setWorkflowId(ref);
setValue(term + "/_work_flow_id", "id", workflowIdValues, s -> ref.getId().setValue(s), String.class, consumedPaths);
setValue(term + "/_work_flow_id", "id_scheme", workflowIdValues, s -> ref.getId().setScheme(s), String.class, consumedPaths);
setValue(term + "/_work_flow_id", "namespace", workflowIdValues, ref::setNamespace, String.class, consumedPaths);
setValue(term + "/_work_flow_id", "type", workflowIdValues, ref::setType, String.class, consumedPaths);
}
}
use of com.nedap.archie.rm.generic.PartySelf in project fhir-bridge by ehrbase.
the class WohnungsEvaluationConverter method convertInternal.
@Override
protected WohnsituationEvaluation convertInternal(QuestionnaireResponse.QuestionnaireResponseItemComponent questionnaireResponseItemComponent) {
String housingSituation = getQuestionValueCodeToString(questionnaireResponseItemComponent);
WohnsituationEvaluation wohnsituationEvaluation = new WohnsituationEvaluation();
if (housingSituation.equals(WohnsituationDefiningCode.WOHNT_MIT_ANDEREN_ZUSAMMEN.getCode())) {
wohnsituationEvaluation.setWohnsituationDefiningCode(WohnsituationDefiningCode.WOHNT_MIT_ANDEREN_ZUSAMMEN);
} else if (housingSituation.equals(WohnsituationDefiningCode.ALLEIN_WOHNEND.getCode())) {
wohnsituationEvaluation.setWohnsituationDefiningCode(WohnsituationDefiningCode.ALLEIN_WOHNEND);
} else if (!housingSituation.equals("")) {
throw new ConversionException("The code for Wohnungsituation:" + housingSituation + " cannot be mapped, please enter a valid code e.g. Wohnt mit anderen zusammen (LOINC: LA9996-5)");
}
wohnsituationEvaluation.setLanguage(Language.DE);
wohnsituationEvaluation.setSubject(new PartySelf());
return wohnsituationEvaluation;
}
Aggregations