Search in sources :

Example 11 with Observation

use of com.nedap.archie.rm.composition.Observation in project ehrbase by ehrbase.

the class EntryAccess method setCompositionFields.

/**
 * set the EntryRecord with fields from composition:<br>
 * <ul>
 * <li>category</li>
 * <li>item type</li>
 * <li>archetype node Id</li>
 * <li>entry content (json)</li>
 * </ul>
 *
 * @param record      Target {@link EntryRecord}
 * @param composition input data in {@link Composition} representation
 */
private void setCompositionFields(EntryRecord record, Composition composition) {
    record.setCategory(record.getCategory());
    if (composition.getContent() != null && !composition.getContent().isEmpty()) {
        Object node = composition.getContent().get(0);
        if (node instanceof Section) {
            record.setItemType(EntryType.valueOf("section"));
        } else if (node instanceof Evaluation || node instanceof Observation || node instanceof Instruction || node instanceof Action) {
            record.setItemType(EntryType.valueOf("care_entry"));
        } else if (node instanceof AdminEntry) {
            record.setItemType(EntryType.valueOf("admin"));
        }
    } else {
        record.setItemType(EntryType.valueOf("admin"));
    }
    record.setArchetypeId(composition.getArchetypeNodeId());
    RawJson rawJson = new RawJson();
    record.setEntry(JSONB.valueOf(rawJson.marshal(composition)));
}
Also used : Evaluation(com.nedap.archie.rm.composition.Evaluation) Action(com.nedap.archie.rm.composition.Action) RawJson(org.ehrbase.serialisation.dbencoding.RawJson) AdminEntry(com.nedap.archie.rm.composition.AdminEntry) Observation(com.nedap.archie.rm.composition.Observation) Instruction(com.nedap.archie.rm.composition.Instruction) Section(com.nedap.archie.rm.composition.Section)

Aggregations

Observation (com.nedap.archie.rm.composition.Observation)11 Composition (com.nedap.archie.rm.composition.Composition)10 Test (org.junit.Test)10 WebTemplate (org.ehrbase.webtemplate.model.WebTemplate)8 AdminEntry (com.nedap.archie.rm.composition.AdminEntry)6 IOException (java.io.IOException)6 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)6 Tuple (org.assertj.core.groups.Tuple)6 IntervalEvent (com.nedap.archie.rm.datastructures.IntervalEvent)5 CodePhrase (com.nedap.archie.rm.datatypes.CodePhrase)5 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)5 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)5 StandardCharsets (java.nio.charset.StandardCharsets)5 OffsetDateTime (java.time.OffsetDateTime)5 ZoneOffset (java.time.ZoneOffset)5 IOUtils (org.apache.commons.io.IOUtils)5 AlternativeEventsComposition (org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition)5 CoronaAnamneseComposition (org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.CoronaAnamneseComposition)5 EhrbaseBloodPressureSimpleDeV0Composition (org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition)5 EhrbaseMultiOccurrenceDeV1Composition (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition)5