Search in sources :

Example 6 with PartySelf

use of com.nedap.archie.rm.generic.PartySelf in project fhir-bridge by ehrbase.

the class EntryEntityConverter method convert.

@Override
public E convert(@NonNull R resource) {
    E entity = convertInternal(resource);
    entity.setLanguage(resolveLanguageOrDefault(resource));
    entity.setSubject(new PartySelf());
    return entity;
}
Also used : PartySelf(com.nedap.archie.rm.generic.PartySelf)

Example 7 with PartySelf

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

the class EhrAccess method getStatus.

// get latest status
@Override
public EhrStatus getStatus() {
    EhrStatus status = new EhrStatus();
    status.setModifiable(isModifiable());
    status.setQueryable(isQueryable());
    // set otherDetails if available
    if (getStatusAccess().getStatusRecord().getOtherDetails() != null) {
        status.setOtherDetails(getStatusAccess().getStatusRecord().getOtherDetails());
    }
    // Locatable attribute
    status.setArchetypeNodeId(getArchetypeNodeId());
    Object name = new RecordedDvCodedText().fromDB(getStatusAccess().getStatusRecord(), STATUS.NAME);
    status.setName(name instanceof DvText ? (DvText) name : (DvCodedText) name);
    UUID statusId = getStatusAccess().getStatusRecord().getId();
    status.setUid(new HierObjectId(statusId.toString() + "::" + getServerConfig().getNodename() + "::" + I_StatusAccess.getLatestVersionNumber(this, statusId)));
    PartySelf partySelf = (PartySelf) new PersistedPartyProxy(this).retrieve(getParty());
    status.setSubject(partySelf);
    return status;
}
Also used : EhrStatus(com.nedap.archie.rm.ehr.EhrStatus) RecordedDvCodedText(org.ehrbase.service.RecordedDvCodedText) RecordedDvCodedText(org.ehrbase.service.RecordedDvCodedText) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) UUID(java.util.UUID) HierObjectId(com.nedap.archie.rm.support.identification.HierObjectId) DvText(com.nedap.archie.rm.datavalues.DvText) RecordedDvText(org.ehrbase.service.RecordedDvText) PartySelf(com.nedap.archie.rm.generic.PartySelf) PersistedPartyProxy(org.ehrbase.dao.access.jooq.party.PersistedPartyProxy)

Example 8 with PartySelf

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

the class PersistedPartySelf method render.

@Override
public PartyProxy render(PartyIdentifiedRecord partyIdentifiedRecord) {
    PartyRef partyRef = null;
    if (partyIdentifiedRecord.getPartyRefType() != null) {
        ObjectId objectID = new PersistedObjectId().fromDB(partyIdentifiedRecord);
        partyRef = new PartyRef(objectID, partyIdentifiedRecord.getPartyRefNamespace(), partyIdentifiedRecord.getPartyRefType());
    }
    return new PartySelf(partyRef);
}
Also used : PartyRef(com.nedap.archie.rm.support.identification.PartyRef) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) PartySelf(com.nedap.archie.rm.generic.PartySelf)

Example 9 with PartySelf

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

the class EhrController method createEhr.

@PostMapping
@ResponseStatus(value = HttpStatus.CREATED)
public // overwrites default 200, fixes the wrong listing of 200 in swagger-ui (EHR-56)
ResponseEntity<EhrResponseData> createEhr(@RequestParam(value = "subjectId", required = false) String subjectId, @RequestParam(value = "subjectNamespace", required = false) String subjectNamespace, @RequestParam(value = "committerId", required = false) String committerId, @RequestParam(value = "committerName", required = false) String committerName, @RequestHeader(value = "Content-Type", required = false) String contentType, @RequestBody(required = false) String content) {
    // subjectId and subjectNamespace are not required by EhrScape spec but without those parameters a 400 error shall be returned
    if ((subjectId == null) || (subjectNamespace == null)) {
        throw new InvalidApiParameterException("subjectId or subjectNamespace missing");
    } else if ((subjectId.isEmpty()) || (subjectNamespace.isEmpty())) {
        throw new InvalidApiParameterException("subjectId or subjectNamespace emtpy");
    }
    EhrStatus ehrStatus = extractEhrStatus(content);
    PartySelf partySelf = new PartySelf(new PartyRef(new HierObjectId(subjectId), subjectNamespace, null));
    ehrStatus.setSubject(partySelf);
    UUID ehrId = ehrService.create(ehrStatus, null);
    // TODO: use config file or alike to set the basic api path
    URI url = URI.create(getBaseEnvLinkURL() + "/rest/ecis/v1/ehr/" + ehrId.toString());
    return Optional.ofNullable(ehrId).flatMap(i -> buildEhrResponseData(i, Action.CREATE, contentType)).map(ResponseEntity.created(url)::body).orElse(ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build());
}
Also used : InvalidApiParameterException(org.ehrbase.api.exception.InvalidApiParameterException) PartyRef(com.nedap.archie.rm.support.identification.PartyRef) EhrStatus(com.nedap.archie.rm.ehr.EhrStatus) UUID(java.util.UUID) URI(java.net.URI) HierObjectId(com.nedap.archie.rm.support.identification.HierObjectId) PartySelf(com.nedap.archie.rm.generic.PartySelf) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus)

Example 10 with PartySelf

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

the class DefaultRestCompositionEndpointIT method testSaveCompositionEntityWithAnyProxy.

@Test
public void testSaveCompositionEntityWithAnyProxy() {
    ehr = openEhrClient.ehrEndpoint().createEhr();
    GECCOSerologischerBefundComposition composition1 = new GECCOSerologischerBefundComposition();
    composition1.setLanguage(Language.DE);
    composition1.setTerritory(Territory.DE);
    composition1.setCategoryDefiningCode(org.ehrbase.client.classgenerator.shareddefinition.Category.EVENT);
    composition1.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
    composition1.setComposer(new PartyIdentified(null, "Test", null));
    composition1.setStartTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
    composition1.setParticipations(new ArrayList<>());
    composition1.setBefund(new ArrayList<>());
    Enhancer enhancerObservation = new Enhancer();
    enhancerObservation.setSuperclass(BefundObservation.class);
    enhancerObservation.setCallback((MethodInterceptor) (obj, method, args, proxy) -> {
        if (method.getDeclaringClass() != Object.class && method.getName().equals("getLanguage")) {
            return Language.EN;
        } else {
            return proxy.invokeSuper(obj, args);
        }
    });
    BefundObservation befundObservation = (BefundObservation) enhancerObservation.create();
    composition1.getBefund().add(befundObservation);
    befundObservation.setSubject(new PartySelf());
    befundObservation.setJedesEreignis(new ArrayList<>());
    // Read will be overwritten by enhancerObservation
    befundObservation.setLanguage(Language.DE);
    befundObservation.setAnforderungDefiningCode(AnforderungDefiningCode.SARS_COV2_COVID19_AB_PANEL_SERUM_OR_PLASMA_BY_IMMUNOASSAY);
    befundObservation.setOriginValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
    BefundJedesEreignisPointEvent event = new BefundJedesEreignisPointEvent();
    event.setTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
    event.setLabortestBezeichnungDefiningCode(LabortestBezeichnungDefiningCode.SEROLOGIC_TEST_PROCEDURE);
    event.setVirusnachweistestDefiningCode(VirusnachweistestDefiningCode.SARS_COV2_COVID19_AB_PRESENCE_IN_SERUM_OR_PLASMA_BY_IMMUNOASSAY);
    event.setErgebnisStatusValue("registered");
    befundObservation.getJedesEreignis().add(event);
    Enhancer enhancerProAnalytQuantitativesErgebnisDvCount = new Enhancer();
    enhancerProAnalytQuantitativesErgebnisDvCount.setSuperclass(ProAnalytQuantitativesErgebnisDvCount.class);
    enhancerProAnalytQuantitativesErgebnisDvCount.setCallback((MethodInterceptor) (obj, method, args, proxy) -> {
        if (method.getDeclaringClass() != Object.class && method.getName().equals("getQuantitativesErgebnisMagnitude")) {
            return 33l;
        } else {
            return proxy.invokeSuper(obj, args);
        }
    });
    ProAnalytQuantitativesErgebnisDvCount quantitativesErgebnis = (ProAnalytQuantitativesErgebnisDvCount) enhancerProAnalytQuantitativesErgebnisDvCount.create();
    quantitativesErgebnis.setQuantitativesErgebnisMagnitude(22l);
    event.setQuantitativesErgebnis(quantitativesErgebnis);
    GECCOSerologischerBefundComposition composition = composition1;
    composition = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(composition);
    Optional<GECCOSerologischerBefundComposition> actual = openEhrClient.compositionEndpoint(ehr).find(composition.getVersionUid().getUuid(), GECCOSerologischerBefundComposition.class);
    assertThat(actual).isPresent();
    assertThat(actual.get().getBefund()).size().isEqualTo(1);
    BefundObservation actualObservation = actual.get().getBefund().get(0);
    assertThat(actualObservation.getLanguage()).isEqualTo(Language.EN);
    assertThat(actualObservation.getJedesEreignis()).size().isEqualTo(1);
    assertThat(actualObservation.getJedesEreignis().get(0).getQuantitativesErgebnis()).isNotNull();
    assertThat(actualObservation.getJedesEreignis().get(0).getQuantitativesErgebnis().getClass()).isEqualTo(ProAnalytQuantitativesErgebnisDvCount.class);
    assertThat(((ProAnalytQuantitativesErgebnisDvCount) actualObservation.getJedesEreignis().get(0).getQuantitativesErgebnis()).getQuantitativesErgebnisMagnitude()).isEqualTo(33L);
}
Also used : GECCOSerologischerBefundComposition(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.GECCOSerologischerBefundComposition) Language(org.ehrbase.client.classgenerator.shareddefinition.Language) Composition(com.nedap.archie.rm.composition.Composition) VersionUid(org.ehrbase.client.openehrclient.VersionUid) URISyntaxException(java.net.URISyntaxException) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) GECCOSerologischerBefundComposition(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.GECCOSerologischerBefundComposition) EpisodeofcareTeamElement(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareTeamElement) Assertions.assertThatNoException(org.assertj.core.api.Assertions.assertThatNoException) BefundJedesEreignisPointEvent(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.BefundJedesEreignisPointEvent) After(org.junit.After) URI(java.net.URI) ZoneOffset(java.time.ZoneOffset) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) MethodInterceptor(net.sf.cglib.proxy.MethodInterceptor) ProAnalytQuantitativesErgebnisDvCount(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.ProAnalytQuantitativesErgebnisDvCount) org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition) OpenEhrClient(org.ehrbase.client.openehrclient.OpenEhrClient) UUID(java.util.UUID) Category(org.junit.experimental.categories.Category) StandardCharsets(java.nio.charset.StandardCharsets) AnforderungDefiningCode(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.AnforderungDefiningCode) IOUtils(org.apache.commons.io.IOUtils) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) ParticipationMode(org.ehrbase.client.classgenerator.shareddefinition.ParticipationMode) LabortestBezeichnungDefiningCode(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.LabortestBezeichnungDefiningCode) OffsetDateTime(java.time.OffsetDateTime) OptimisticLockException(org.ehrbase.client.exception.OptimisticLockException) Optional(java.util.Optional) TestData(org.ehrbase.client.TestData) DefaultRestClientTestHelper.setupDefaultRestClientWithDefaultProvider(org.ehrbase.client.openehrclient.defaultrestclient.DefaultRestClientTestHelper.setupDefaultRestClientWithDefaultProvider) Territory(org.ehrbase.client.classgenerator.shareddefinition.Territory) BeforeClass(org.junit.BeforeClass) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) ArrayList(java.util.ArrayList) ProVirusCluster(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProVirusCluster) Flattener(org.ehrbase.client.flattener.Flattener) ClientException(org.ehrbase.client.exception.ClientException) Enhancer(net.sf.cglib.proxy.Enhancer) BefundObservation(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.BefundObservation) PartySelf(com.nedap.archie.rm.generic.PartySelf) Integration(org.ehrbase.client.Integration) Tuple(org.assertj.core.groups.Tuple) CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) CompositionTestDataCanonicalJson(org.ehrbase.test_data.composition.CompositionTestDataCanonicalJson) DvText(com.nedap.archie.rm.datavalues.DvText) EpisodeofcareAdminEntry(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareAdminEntry) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) DefaultValuePath(org.ehrbase.serialisation.walker.defaultvalues.DefaultValuePath) WrongStatusCodeException(org.ehrbase.client.exception.WrongStatusCodeException) Test(org.junit.Test) IOException(java.io.IOException) Participation(com.nedap.archie.rm.generic.Participation) DefaultValues(org.ehrbase.serialisation.walker.defaultvalues.DefaultValues) KorotkoffSoundsDefiningCode(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.definition.KorotkoffSoundsDefiningCode) VirologischerBefundComposition(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition) VirusnachweistestDefiningCode(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.VirusnachweistestDefiningCode) CompositionEndpoint(org.ehrbase.client.openehrclient.CompositionEndpoint) Assert(org.junit.Assert) Collections(java.util.Collections) Setting(org.ehrbase.client.classgenerator.shareddefinition.Setting) BefundJedesEreignisPointEvent(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.BefundJedesEreignisPointEvent) BefundObservation(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.BefundObservation) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) Enhancer(net.sf.cglib.proxy.Enhancer) ProAnalytQuantitativesErgebnisDvCount(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.ProAnalytQuantitativesErgebnisDvCount) PartySelf(com.nedap.archie.rm.generic.PartySelf) Test(org.junit.Test)

Aggregations

PartySelf (com.nedap.archie.rm.generic.PartySelf)29 DvText (com.nedap.archie.rm.datavalues.DvText)9 EhrStatus (com.nedap.archie.rm.ehr.EhrStatus)9 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)8 PartyRef (com.nedap.archie.rm.support.identification.PartyRef)8 HierObjectId (com.nedap.archie.rm.support.identification.HierObjectId)7 UUID (java.util.UUID)5 Test (org.junit.Test)4 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)3 URI (java.net.URI)3 ItemTree (com.nedap.archie.rm.datastructures.ItemTree)2 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)2 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)2 GenericId (com.nedap.archie.rm.support.identification.GenericId)2 BodyTemperatureAnyEventPointEvent (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureAnyEventPointEvent)2 BodyTemperatureObservation (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureObservation)2 VirologischerBefundComposition (org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition)2 ProVirusCluster (org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProVirusCluster)2 DefaultValuePath (org.ehrbase.serialisation.walker.defaultvalues.DefaultValuePath)2 DefaultValues (org.ehrbase.serialisation.walker.defaultvalues.DefaultValues)2