Search in sources :

Example 1 with FeederAudit

use of com.nedap.archie.rm.archetyped.FeederAudit in project openEHR_SDK by ehrbase.

the class DBEncodeTest method testEncodeDecodeFeederAudit.

@Test
public void testEncodeDecodeFeederAudit() {
    String jsonFeederAudit = "{\n" + "              \"originating_system_item_ids\": [\n" + "                {\n" + "                  \"issuer\": \"EMIS\",\n" + "                  \"assigner\": \"EMIS\",\n" + "                  \"id\": \"123456\",\n" + "                  \"type\": \"FHIR\"\n" + "                }\n" + "              ],\n" + "              \"feeder_system_item_ids\": [],\n" + "              \"originating_system_audit\": {\n" + "                \"system_id\": \"EMIS\",\n" + "                \"time\": {\n" + "                  \"value\": \"2016-12-20T00:11:02.518+02:00\",\n" + "                  \"epoch_offset\": 1.482185462E9\n" + "                }\n" + "              }\n" + "            }";
    CanonicalJson cut = new CanonicalJson();
    FeederAudit feederAudit = cut.unmarshal(jsonFeederAudit, FeederAudit.class);
    String encodedToDB = new FeederAuditEncoding().toDB(feederAudit);
    FeederAudit decodedFromDB = new FeederAuditEncoding().fromDB(encodedToDB);
    assertEquals(feederAudit.getOriginatingSystemAudit().getSystemId(), decodedFromDB.getOriginatingSystemAudit().getSystemId());
}
Also used : FeederAudit(com.nedap.archie.rm.archetyped.FeederAudit) CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) CompositionTestDataCanonicalJson(org.ehrbase.test_data.composition.CompositionTestDataCanonicalJson) FeederAuditEncoding(org.ehrbase.serialisation.dbencoding.rmobject.FeederAuditEncoding) Test(org.junit.Test)

Example 2 with FeederAudit

use of com.nedap.archie.rm.archetyped.FeederAudit in project openEHR_SDK by ehrbase.

the class DBEncodeTest method testEncodeDecodeFeederAuditWithOriginalContent.

@Test
public void testEncodeDecodeFeederAuditWithOriginalContent() {
    String jsonFeederAudit = " {\n" + "    \"_type\" : \"FEEDER_AUDIT\",\n" + "    \"original_content\" : {\n" + "      \"_type\" : \"DV_PARSABLE\",\n" + "      \"value\" : \"{\\\"resourceType\\\":\\\"Observation\\\",\\\"meta\\\":{\\\"profile\\\":[\\\"https://www.medizininformatik-initiative.de/fhir/core/StructureDefinition/ObservationLab\\\"]},\\\"identifier\\\":[{\\\"type\\\":{\\\"coding\\\":[{\\\"system\\\":\\\"http://terminology.hl7.org/CodeSystem/v2-0203\\\",\\\"code\\\":\\\"OBI\\\"}]},\\\"system\\\":\\\"https://diz.mii.de/fhir/core/NamingSystem/test-lab-results\\\",\\\"value\\\":\\\"59826-8_1234567890\\\",\\\"assigner\\\":{\\\"identifier\\\":{\\\"system\\\":\\\"https://www.medizininformatik-initiative.de/fhir/core/NamingSystem/org-identifier\\\",\\\"value\\\":\\\"DIZ-ID\\\"}}}],\\\"status\\\":\\\"final\\\",\\\"category\\\":[{\\\"coding\\\":[{\\\"system\\\":\\\"http://loinc.org\\\",\\\"code\\\":\\\"26436-6\\\"},{\\\"system\\\":\\\"http://terminology.hl7.org/CodeSystem/observation-category\\\",\\\"code\\\":\\\"laboratory\\\"}]}],\\\"code\\\":{\\\"coding\\\":[{\\\"system\\\":\\\"http://loinc.org\\\",\\\"code\\\":\\\"59826-8\\\",\\\"display\\\":\\\"Creatinine [Moles/volume] in Blood\\\"}],\\\"text\\\":\\\"Kreatinin\\\"},\\\"subject\\\":{\\\"reference\\\":\\\"Patient/679e3fc3-cc9a-4e04-bc81-cb4d4a7e8e1c\\\"},\\\"encounter\\\":{\\\"reference\\\":\\\"Encounter/555\\\"},\\\"effectiveDateTime\\\":\\\"2018-11-20T12:05:00+01:00\\\",\\\"issued\\\":\\\"2018-03-11T10:28:00+01:00\\\",\\\"performer\\\":[{\\\"reference\\\":\\\"Organization/7772\\\",\\\"display\\\":\\\"Zentrallabor des IKCL\\\"}],\\\"valueQuantity\\\":{\\\"value\\\":72,\\\"unit\\\":\\\"..mol/l\\\",\\\"system\\\":\\\"http://unitsofmeasure.org\\\",\\\"code\\\":\\\"umol/L\\\"},\\\"interpretation\\\":[{\\\"coding\\\":[{\\\"system\\\":\\\"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\\\",\\\"code\\\":\\\"N\\\"}]}],\\\"referenceRange\\\":[{\\\"low\\\":{\\\"value\\\":72},\\\"high\\\":{\\\"value\\\":127},\\\"type\\\":{\\\"coding\\\":[{\\\"system\\\":\\\"http://terminology.hl7.org/CodeSystem/referencerange-meaning\\\",\\\"code\\\":\\\"normal\\\",\\\"display\\\":\\\"Normal Range\\\"}]}}]}\",\n" + "      \"formalism\" : \"application/json\"\n" + "    },\n" + "    \"originating_system_audit\" : {\n" + "      \"_type\" : \"FEEDER_AUDIT_DETAILS\",\n" + "      \"system_id\" : \"FHIR-bridge\"\n" + "    }\n" + "  }";
    CanonicalJson cut = new CanonicalJson();
    FeederAudit feederAudit = cut.unmarshal(jsonFeederAudit, FeederAudit.class);
    String encodedToDB = new FeederAuditEncoding().toDB(feederAudit);
    FeederAudit decodedFromDB = new FeederAuditEncoding().fromDB(encodedToDB);
    assertEquals(feederAudit.getOriginatingSystemAudit().getSystemId(), decodedFromDB.getOriginatingSystemAudit().getSystemId());
}
Also used : FeederAudit(com.nedap.archie.rm.archetyped.FeederAudit) CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) CompositionTestDataCanonicalJson(org.ehrbase.test_data.composition.CompositionTestDataCanonicalJson) FeederAuditEncoding(org.ehrbase.serialisation.dbencoding.rmobject.FeederAuditEncoding) Test(org.junit.Test)

Example 3 with FeederAudit

use of com.nedap.archie.rm.archetyped.FeederAudit in project openEHR_SDK by ehrbase.

the class LocatableUnmarshalPostprocessor method process.

/**
 * {@inheritDoc} Unmarshalls {@link Composition#setUid}
 */
@Override
public void process(String term, Locatable rmObject, Map<FlatPathDto, String> values, Set<String> consumedPaths, Context<Map<FlatPathDto, String>> context) {
    if (RmConstants.ELEMENT.equals(context.getNodeDeque().peek().getRmType()) || !context.getFlatHelper().skip(context)) {
        setValue(term + PATH_DIVIDER + "_uid", null, values, s -> rmObject.setUid(new HierObjectId(s)), String.class, consumedPaths);
        Map<Integer, Map<String, String>> links = extractMultiValued(term, "_link", values);
        if (rmObject.getLinks() == null) {
            rmObject.setLinks(new ArrayList<>());
        }
        rmObject.getLinks().addAll(links.values().stream().map(DefaultValues::createLink).collect(Collectors.toList()));
        consumeAllMatching(term + PATH_DIVIDER + "_link", values, consumedPaths, false);
        Map<FlatPathDto, String> feederAuditValues = FlatHelper.filter(values, term + "/_feeder_audit", false);
        if (!feederAuditValues.isEmpty()) {
            rmObject.setFeederAudit(new FeederAudit());
            handleRmAttribute(term, rmObject.getFeederAudit(), feederAuditValues, consumedPaths, context, "feeder_audit");
        }
        Map<FlatPathDto, String> nameValues = FlatHelper.filter(values, term + "/_name", false);
        if (!nameValues.isEmpty()) {
            final DvText name;
            boolean isDvCodedText = nameValues.keySet().stream().anyMatch(e -> "code".equals(e.getLast().getAttributeName()) && "_name".equals(e.getLast().getName()));
            if (isDvCodedText) {
                name = new DvCodedText();
            } else {
                name = new DvText();
            }
            rmObject.setName(name);
            handleRmAttribute(term, rmObject.getName(), nameValues, consumedPaths, context, "name");
        }
    }
}
Also used : DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) FlatPathDto(org.ehrbase.webtemplate.path.flat.FlatPathDto) DvText(com.nedap.archie.rm.datavalues.DvText) FeederAudit(com.nedap.archie.rm.archetyped.FeederAudit) DefaultValues(org.ehrbase.serialisation.walker.defaultvalues.DefaultValues) Map(java.util.Map) HierObjectId(com.nedap.archie.rm.support.identification.HierObjectId)

Example 4 with FeederAudit

use of com.nedap.archie.rm.archetyped.FeederAudit in project fhir-bridge by ehrbase.

the class AbstractConverter method buildFeederAudit.

protected FeederAudit buildFeederAudit(@NonNull S resource) {
    FeederAudit result = new FeederAudit();
    String systemId = resource.getMeta().hasSource() ? resource.getMeta().getSource() : DEFAULT_SYSTEM_ID;
    result.setOriginatingSystemAudit(new FeederAuditDetails(systemId, null, null, null, null, null, null));
    List<DvIdentifier> identifiers = new ArrayList<>();
    if (resource.hasId()) {
        DvIdentifier identifier = new DvIdentifier();
        identifier.setId(resource.getId());
        identifier.setType("fhir_logical_id");
        identifiers.add(identifier);
    }
    identifiers.addAll(subjectIdentifiers(resource));
    result.setOriginatingSystemItemIds(identifiers);
    return result;
}
Also used : FeederAudit(com.nedap.archie.rm.archetyped.FeederAudit) FeederAuditDetails(com.nedap.archie.rm.archetyped.FeederAuditDetails) ArrayList(java.util.ArrayList) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier)

Example 5 with FeederAudit

use of com.nedap.archie.rm.archetyped.FeederAudit in project openEHR_SDK by ehrbase.

the class TestData method buildEpisodeOfCareComposition.

public static EpisodeOfCareComposition buildEpisodeOfCareComposition() {
    EpisodeOfCareComposition episode = new EpisodeOfCareComposition();
    episode.setComposer(new PartyIdentified(null, "Test", null));
    episode.setCategoryDefiningCode(Category.EVENT);
    episode.setLanguage(Language.DE);
    episode.setTerritory(Territory.DE);
    episode.setEpisodeofcare(new ArrayList<>());
    episode.setStartTimeValue(OffsetDateTime.now());
    episode.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
    FeederAudit audit = new FeederAudit();
    audit.setFeederSystemAudit(new FeederAuditDetails());
    audit.getFeederSystemAudit().setSystemId("System 1");
    audit.setOriginatingSystemAudit(new FeederAuditDetails());
    audit.getOriginatingSystemAudit().setSystemId("System 2");
    episode.setFeederAudit(audit);
    EpisodeofcareAdminEntry episodeofcareAdminEntry = new EpisodeofcareAdminEntry();
    episodeofcareAdminEntry.setUpperValue(OffsetDateTime.now());
    episodeofcareAdminEntry.setLowerValue(OffsetDateTime.now());
    episodeofcareAdminEntry.setLanguage(Language.DE);
    episodeofcareAdminEntry.setSubject(new PartySelf());
    episodeofcareAdminEntry.setIdentifier(new ArrayList<>());
    EpisodeofcareIdentifierElement identifierElement = new EpisodeofcareIdentifierElement();
    DvIdentifier value = new DvIdentifier();
    value.setId("123");
    identifierElement.setValue(value);
    episodeofcareAdminEntry.getIdentifier().add(identifierElement);
    EpisodeofcareIdentifierElement identifierElement2 = new EpisodeofcareIdentifierElement();
    DvIdentifier value2 = new DvIdentifier();
    value2.setId("456");
    identifierElement2.setValue(value2);
    episodeofcareAdminEntry.getIdentifier().add(identifierElement2);
    episodeofcareAdminEntry.setTeam(new ArrayList<>());
    EpisodeofcareTeamElement teamElement1 = new EpisodeofcareTeamElement();
    teamElement1.setValue(URI.create("https://github.com/ehrbase"));
    episodeofcareAdminEntry.getTeam().add(teamElement1);
    episode.getEpisodeofcare().add(episodeofcareAdminEntry);
    return episode;
}
Also used : FeederAudit(com.nedap.archie.rm.archetyped.FeederAudit) EpisodeofcareIdentifierElement(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareIdentifierElement) EpisodeofcareTeamElement(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareTeamElement) FeederAuditDetails(com.nedap.archie.rm.archetyped.FeederAuditDetails) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) EpisodeofcareAdminEntry(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareAdminEntry) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) PartySelf(com.nedap.archie.rm.generic.PartySelf) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier)

Aggregations

FeederAudit (com.nedap.archie.rm.archetyped.FeederAudit)5 FeederAuditDetails (com.nedap.archie.rm.archetyped.FeederAuditDetails)2 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)2 FeederAuditEncoding (org.ehrbase.serialisation.dbencoding.rmobject.FeederAuditEncoding)2 CanonicalJson (org.ehrbase.serialisation.jsonencoding.CanonicalJson)2 CompositionTestDataCanonicalJson (org.ehrbase.test_data.composition.CompositionTestDataCanonicalJson)2 Test (org.junit.Test)2 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)1 DvText (com.nedap.archie.rm.datavalues.DvText)1 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)1 PartySelf (com.nedap.archie.rm.generic.PartySelf)1 HierObjectId (com.nedap.archie.rm.support.identification.HierObjectId)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 EpisodeOfCareComposition (org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition)1 EpisodeofcareAdminEntry (org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareAdminEntry)1 EpisodeofcareIdentifierElement (org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareIdentifierElement)1 EpisodeofcareTeamElement (org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareTeamElement)1 DefaultValues (org.ehrbase.serialisation.walker.defaultvalues.DefaultValues)1 FlatPathDto (org.ehrbase.webtemplate.path.flat.FlatPathDto)1