Search in sources :

Example 11 with PartyIdentified

use of com.nedap.archie.rm.generic.PartyIdentified in project openEHR_SDK by ehrbase.

the class TestData method buildEhrbaseBloodPressureSimpleDeV0WithEmptyFields.

public static EhrbaseBloodPressureSimpleDeV0Composition buildEhrbaseBloodPressureSimpleDeV0WithEmptyFields() {
    EhrbaseBloodPressureSimpleDeV0Composition bloodPressureSimpleDeV0 = new EhrbaseBloodPressureSimpleDeV0Composition();
    bloodPressureSimpleDeV0.setStartTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
    bloodPressureSimpleDeV0.setBloodPressureTrainingSample(new ArrayList<>());
    bloodPressureSimpleDeV0.setLanguage(Language.DE);
    bloodPressureSimpleDeV0.setTerritory(Territory.DE);
    bloodPressureSimpleDeV0.setCategoryDefiningCode(Category.EVENT);
    bloodPressureSimpleDeV0.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
    bloodPressureSimpleDeV0.setComposer(new PartyIdentified(null, "Test", null));
    bloodPressureSimpleDeV0.setParticipations(new ArrayList<>());
    bloodPressureSimpleDeV0.getBloodPressureTrainingSample().add(buildBloodPressureTrainingSampleObservation());
    return bloodPressureSimpleDeV0;
}
Also used : PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition)

Example 12 with PartyIdentified

use of com.nedap.archie.rm.generic.PartyIdentified in project openEHR_SDK by ehrbase.

the class TestData method buildEhrbaseMultiOccurrenceDeV1.

public static EhrbaseMultiOccurrenceDeV1Composition buildEhrbaseMultiOccurrenceDeV1() {
    EhrbaseMultiOccurrenceDeV1Composition dto = new EhrbaseMultiOccurrenceDeV1Composition();
    dto.setStartTimeValue(OffsetDateTime.now());
    dto.setEndTimeValue(OffsetDateTime.now());
    dto.setLanguage(Language.DE);
    dto.setTerritory(Territory.DE);
    dto.setSettingDefiningCode(Setting.DENTAL_CARE);
    dto.setCategoryDefiningCode(Category.EVENT);
    dto.setComposer(new PartyIdentified(null, "Test", null));
    dto.setBodyTemperature(new ArrayList<>());
    dto.getBodyTemperature().add(buildBodyTemperature1());
    dto.getBodyTemperature().add(buildBodyTemperature2());
    return dto;
}
Also used : EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified)

Example 13 with PartyIdentified

use of com.nedap.archie.rm.generic.PartyIdentified in project openEHR_SDK by ehrbase.

the class TestData method buildEhrbaseBloodPressureSimpleDeV0.

public static EhrbaseBloodPressureSimpleDeV0Composition buildEhrbaseBloodPressureSimpleDeV0() {
    EhrbaseBloodPressureSimpleDeV0Composition bloodPressureSimpleDeV0 = new EhrbaseBloodPressureSimpleDeV0Composition();
    bloodPressureSimpleDeV0.setStartTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
    bloodPressureSimpleDeV0.setEndTimeValue(OffsetDateTime.now());
    bloodPressureSimpleDeV0.setBloodPressureTrainingSample(new ArrayList<>());
    bloodPressureSimpleDeV0.setLanguage(Language.DE);
    bloodPressureSimpleDeV0.setTerritory(Territory.DE);
    bloodPressureSimpleDeV0.setCategoryDefiningCode(Category.EVENT);
    bloodPressureSimpleDeV0.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
    bloodPressureSimpleDeV0.setComposer(new PartyIdentified(null, "Test", null));
    bloodPressureSimpleDeV0.setParticipations(new ArrayList<>());
    bloodPressureSimpleDeV0.getParticipations().add(new Participation(new PartyIdentified(null, "Test", null), new DvText("Pos1"), null, null));
    bloodPressureSimpleDeV0.getParticipations().add(new Participation(new PartyIdentified(null, "Test2", null), new DvText("Pos2"), null, null));
    bloodPressureSimpleDeV0.getBloodPressureTrainingSample().add(buildBloodPressureTrainingSampleObservation());
    return bloodPressureSimpleDeV0;
}
Also used : Participation(com.nedap.archie.rm.generic.Participation) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) BodyTemperatureLocationOfMeasurementDvText(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementDvText) DvText(com.nedap.archie.rm.datavalues.DvText)

Example 14 with PartyIdentified

use of com.nedap.archie.rm.generic.PartyIdentified 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;
}
Also used : PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) PatientenaufenthaltComposition(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.PatientenaufenthaltComposition) VersorgungsortAdminEntry(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.VersorgungsortAdminEntry) StandortCluster(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.StandortCluster) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) PartySelf(com.nedap.archie.rm.generic.PartySelf)

Example 15 with PartyIdentified

use of com.nedap.archie.rm.generic.PartyIdentified 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);
    }
}
Also used : Entry(com.nedap.archie.rm.composition.Entry) PartyProxy(com.nedap.archie.rm.generic.PartyProxy) PartySelf(com.nedap.archie.rm.generic.PartySelf) MapUtils(org.apache.commons.collections4.MapUtils) ObjectRef(com.nedap.archie.rm.support.identification.ObjectRef) Context(org.ehrbase.serialisation.walker.Context) FlatHelper(org.ehrbase.serialisation.walker.FlatHelper) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) DefaultValuePath(org.ehrbase.serialisation.walker.defaultvalues.DefaultValuePath) FlatPathDto(org.ehrbase.webtemplate.path.flat.FlatPathDto) Set(java.util.Set) DefaultValues(org.ehrbase.serialisation.walker.defaultvalues.DefaultValues) StringUtils(org.apache.commons.lang3.StringUtils) Collectors(java.util.stream.Collectors) CollectionUtils(org.apache.commons.collections4.CollectionUtils) PartyIdentifiedRMUnmarshaller(org.ehrbase.serialisation.flatencoding.std.umarshal.rmunmarshaller.PartyIdentifiedRMUnmarshaller) PATH_DIVIDER(org.ehrbase.webtemplate.parser.OPTParser.PATH_DIVIDER) GenericId(com.nedap.archie.rm.support.identification.GenericId) Map(java.util.Map) PartyRelated(com.nedap.archie.rm.generic.PartyRelated) GenericId(com.nedap.archie.rm.support.identification.GenericId) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) FlatPathDto(org.ehrbase.webtemplate.path.flat.FlatPathDto) PartyRelated(com.nedap.archie.rm.generic.PartyRelated) PartySelf(com.nedap.archie.rm.generic.PartySelf) PartyIdentifiedRMUnmarshaller(org.ehrbase.serialisation.flatencoding.std.umarshal.rmunmarshaller.PartyIdentifiedRMUnmarshaller) PartyProxy(com.nedap.archie.rm.generic.PartyProxy) ObjectRef(com.nedap.archie.rm.support.identification.ObjectRef) Map(java.util.Map)

Aggregations

PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)41 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)12 PartySelf (com.nedap.archie.rm.generic.PartySelf)12 Participation (com.nedap.archie.rm.generic.Participation)11 GenericId (com.nedap.archie.rm.support.identification.GenericId)11 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)10 Test (org.junit.Test)10 Composition (com.nedap.archie.rm.composition.Composition)9 DvText (com.nedap.archie.rm.datavalues.DvText)9 EhrbaseBloodPressureSimpleDeV0Composition (org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition)9 PartyProxy (com.nedap.archie.rm.generic.PartyProxy)8 IOException (java.io.IOException)8 StandardCharsets (java.nio.charset.StandardCharsets)8 IOUtils (org.apache.commons.io.IOUtils)8 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)8 Tuple (org.assertj.core.groups.Tuple)8 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)7 PartyRef (com.nedap.archie.rm.support.identification.PartyRef)6 Optional (java.util.Optional)6 TestData (org.ehrbase.client.TestData)6