Search in sources :

Example 1 with QueryList

use of org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryList in project ipf by oehf.

the class GetSubmissionSetAndContentsQueryTransformerTest method setUp.

@BeforeEach
public void setUp() {
    transformer = new GetSubmissionSetAndContentsQueryTransformer();
    query = new GetSubmissionSetAndContentsQuery();
    query.setUuid("uuid1");
    query.setUniqueId("uniqueId1");
    query.setHomeCommunityId("home");
    var confidentialityCodes = new QueryList<Code>();
    confidentialityCodes.getOuterList().add(Arrays.asList(new Code("code10", null, "scheme10"), new Code("code11", null, "scheme11")));
    confidentialityCodes.getOuterList().add(Collections.singletonList(new Code("code12", null, "scheme12")));
    query.setConfidentialityCodes(confidentialityCodes);
    query.setFormatCodes(Arrays.asList(new Code("code13", null, "scheme13"), new Code("code14", null, "scheme14")));
    query.setDocumentEntryTypes(Arrays.asList(DocumentEntryType.STABLE, DocumentEntryType.ON_DEMAND));
    ebXML = new EbXMLFactory30().createAdhocQueryRequest();
}
Also used : EbXMLFactory30(org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLFactory30) GetSubmissionSetAndContentsQueryTransformer(org.openehealth.ipf.commons.ihe.xds.core.transform.requests.query.GetSubmissionSetAndContentsQueryTransformer) GetSubmissionSetAndContentsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetSubmissionSetAndContentsQuery) QueryList(org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryList) Code(org.openehealth.ipf.commons.ihe.xds.core.metadata.Code) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with QueryList

use of org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryList in project ipf by oehf.

the class FindFoldersQueryTransformerTest method setUp.

@BeforeEach
public void setUp() {
    transformer = new FindFoldersQueryTransformer();
    query = new FindFoldersQuery();
    query.setPatientId(new Identifiable("id1", new AssigningAuthority("uni1", "uniType1")));
    query.getLastUpdateTime().setFrom("20150102030405");
    query.getLastUpdateTime().setTo("20150102030406");
    var codes = new QueryList<Code>();
    codes.getOuterList().add(Arrays.asList(new Code("code7", null, "scheme7"), new Code("code8", null, "scheme8")));
    codes.getOuterList().add(Collections.singletonList(new Code("code9", null, "scheme9")));
    query.setCodes(codes);
    query.setStatus(Arrays.asList(AvailabilityStatus.APPROVED, AvailabilityStatus.SUBMITTED));
    query.setHomeCommunityId("12.21.41");
    ebXML = new EbXMLFactory30().createAdhocQueryRequest();
}
Also used : EbXMLFactory30(org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLFactory30) FindFoldersQueryTransformer(org.openehealth.ipf.commons.ihe.xds.core.transform.requests.query.FindFoldersQueryTransformer) FindFoldersQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindFoldersQuery) AssigningAuthority(org.openehealth.ipf.commons.ihe.xds.core.metadata.AssigningAuthority) QueryList(org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryList) Code(org.openehealth.ipf.commons.ihe.xds.core.metadata.Code) Identifiable(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with QueryList

use of org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryList in project ipf by oehf.

the class GetDocumentsQueryTransformerTest method setUp.

@BeforeEach
public void setUp() {
    transformer = new GetDocumentsQueryTransformer();
    query = new GetDocumentsQuery();
    query.setUuids(Arrays.asList("uuid1", "uuid2"));
    query.setUniqueIds(Arrays.asList("uniqueId1", "uniqueId2"));
    query.setHomeCommunityId("home");
    var extraParams1 = new QueryList<String>();
    extraParams1.getOuterList().add(Arrays.asList("para-11", "para-12"));
    extraParams1.getOuterList().add(Arrays.asList("para-21", "para-22", "para-23"));
    var extraParams2 = new QueryList<String>();
    extraParams2.getOuterList().add(Arrays.asList("dia-31", "dia-32", "dia-33"));
    extraParams2.getOuterList().add(Collections.singletonList("dia-41"));
    query.getExtraParameters().put("$PatientPerimeter", extraParams1);
    query.getExtraParameters().put("$PatientDiameter", extraParams2);
    ebXML = new EbXMLFactory30().createAdhocQueryRequest();
}
Also used : EbXMLFactory30(org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLFactory30) GetDocumentsQueryTransformer(org.openehealth.ipf.commons.ihe.xds.core.transform.requests.query.GetDocumentsQueryTransformer) QueryList(org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryList) GetDocumentsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetDocumentsQuery) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with QueryList

use of org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryList in project MobileAccessGateway by i4mi.

the class Iti67RequestConverter method searchParameterIti67ToFindDocumentsQuery.

/**
 * convert ITI-67 request to ITI-18 request
 * @param searchParameter
 * @return
 */
public QueryRegistry searchParameterIti67ToFindDocumentsQuery(@Body Iti67SearchParameters searchParameter) {
    boolean getLeafClass = true;
    Query searchQuery = null;
    if (searchParameter.get_id() != null || searchParameter.getIdentifier() != null) {
        GetDocumentsQuery query = new GetDocumentsQuery();
        if (searchParameter.getIdentifier() != null) {
            String val = searchParameter.getIdentifier().getValue();
            if (val.startsWith("urn:oid:")) {
                query.setUniqueIds(Collections.singletonList(val.substring("urn:oid:".length())));
            } else if (val.startsWith("urn:uuid:")) {
                query.setUuids(Collections.singletonList(val.substring("urn:uuid:".length())));
            }
        } else {
            query.setUuids(Collections.singletonList(searchParameter.get_id().getValue()));
        }
        searchQuery = query;
    } else {
        FindDocumentsQuery query;
        // TODO   related Note 4                  -->  $XDSDocumentEntryReferenceIdList
        TokenOrListParam related = searchParameter.getRelated();
        if (related != null) {
            FindDocumentsByReferenceIdQuery referenceIdQuery = new FindDocumentsByReferenceIdQuery();
            ;
            QueryList<ReferenceId> outerReferences = new QueryList<ReferenceId>();
            List<ReferenceId> references = new ArrayList<ReferenceId>();
            for (TokenParam token : related.getValuesAsQueryTokens()) {
                references.add(new ReferenceId(token.getValue(), null, getScheme(token.getSystem())));
            }
            outerReferences.getOuterList().add(references);
            referenceIdQuery.setTypedReferenceIds(outerReferences);
            query = referenceIdQuery;
        } else
            query = new FindDocumentsQuery();
        // query.setMetadataLevel(metadataLevel);
        // status  -->  $XDSDocumentEntryStatus
        TokenOrListParam status = searchParameter.getStatus();
        if (status != null) {
            List<AvailabilityStatus> availabilites = new ArrayList<AvailabilityStatus>();
            for (TokenParam statusToken : status.getValuesAsQueryTokens()) {
                String tokenValue = statusToken.getValue();
                if (tokenValue.equals("current"))
                    availabilites.add(AvailabilityStatus.APPROVED);
                else if (tokenValue.equals("superseded"))
                    availabilites.add(AvailabilityStatus.DEPRECATED);
            }
            query.setStatus(availabilites);
        }
        // patient or patient.identifier  -->  $XDSDocumentEntryPatientId
        TokenParam tokenIdentifier = searchParameter.getPatientIdentifier();
        if (tokenIdentifier != null) {
            String system = getScheme(tokenIdentifier.getSystem());
            if (system == null)
                throw new InvalidRequestException("Missing OID for patient");
            query.setPatientId(new Identifiable(tokenIdentifier.getValue(), new AssigningAuthority(system)));
        }
        ReferenceParam patientRef = searchParameter.getPatientReference();
        if (patientRef != null) {
            Identifiable id = transformReference(patientRef.getValue());
            query.setPatientId(id);
        }
        // date Note 1 Note 5              -->  $DSDocumentEntryCreationTimeFrom
        // date Note 2 Note 5              -->  $XDSDocumentEntryCreationTimeTo
        DateRangeParam dateRange = searchParameter.getDate();
        if (dateRange != null) {
            DateParam creationTimeFrom = dateRange.getLowerBound();
            DateParam creationTimeTo = dateRange.getUpperBound();
            query.getCreationTime().setFrom(timestampFromDateParam(creationTimeFrom));
            query.getCreationTime().setTo(timestampFromDateParam(creationTimeTo));
        }
        // period Note 1                   -->  $XDSDocumentEntryServiceStartTimeFrom
        // period Note 2                   -->  $XDSDocumentEntryServiceStartTimeTo
        // period Note 1                   -->  $XDSDocumentEntryServiceStopTimeFrom
        // period Note 2                   -->  $XDSDocumentEntryServiceStopTimeTo
        DateRangeParam periodRange = searchParameter.getPeriod();
        if (periodRange != null) {
            DateParam periodFrom = periodRange.getLowerBound();
            DateParam periodTo = periodRange.getUpperBound();
            query.getServiceStopTime().setFrom(timestampFromDateParam(periodFrom));
            query.getServiceStartTime().setTo(timestampFromDateParam(periodTo));
        }
        // category                        -->  $XDSDocumentEntryClassCode
        TokenOrListParam categories = searchParameter.getCategory();
        query.setClassCodes(codesFromTokens(categories));
        // type                            -->  $XDSDocumentEntryTypeCode
        TokenOrListParam types = searchParameter.getType();
        query.setTypeCodes(codesFromTokens(types));
        // setting                         -->  $XDSDocumentEntryPracticeSettingCode
        TokenOrListParam settings = searchParameter.getSetting();
        query.setPracticeSettingCodes(codesFromTokens(settings));
        // facility                        -->  $XDSDocumentEntryHealthcareFacilityTypeCode
        TokenOrListParam facilities = searchParameter.getFacility();
        query.setHealthcareFacilityTypeCodes(codesFromTokens(facilities));
        // event                           -->  $XDSDocumentEntryEventCodeList
        TokenOrListParam events = searchParameter.getEvent();
        if (events != null) {
            QueryList<Code> eventCodeList = new QueryList<Code>();
            eventCodeList.getOuterList().add(codesFromTokens(events));
            query.setEventCodes(eventCodeList);
        }
        // security-label                  -->  $XDSDocumentEntryConfidentialityCode
        TokenOrListParam securityLabels = searchParameter.getSecurityLabel();
        if (securityLabels != null) {
            QueryList<Code> confidentialityCodes = new QueryList<Code>();
            confidentialityCodes.getOuterList().add(codesFromTokens(securityLabels));
            query.setConfidentialityCodes(confidentialityCodes);
        }
        // format                          -->  $XDSDocumentEntryFormatCode
        TokenOrListParam formats = searchParameter.getFormat();
        query.setFormatCodes(codesFromTokens(formats));
        // TODO   author.given / author.family    -->  $XDSDocumentEntryAuthorPerson
        StringParam authorGivenName = searchParameter.getAuthorGivenName();
        StringParam authorFamilyName = searchParameter.getAuthorFamilyName();
        if (authorGivenName != null || authorFamilyName != null) {
            Person person = new Person();
            XcnName name = new XcnName();
            if (authorFamilyName != null)
                name.setFamilyName(authorFamilyName.getValue());
            if (authorGivenName != null)
                name.setGivenName(authorGivenName.getValue());
            person.setName(name);
            // String author = (authorGivenName != null ? authorGivenName.getValue() : "%")+" "+(authorFamilyName != null ? authorFamilyName.getValue() : "%");
            List<Person> authorPersons = Collections.singletonList(person);
            query.setTypedAuthorPersons(authorPersons);
        }
        searchQuery = query;
    }
    final QueryRegistry queryRegistry = new QueryRegistry(searchQuery);
    queryRegistry.setReturnType((getLeafClass) ? QueryReturnType.LEAF_CLASS : QueryReturnType.OBJECT_REF);
    return queryRegistry;
}
Also used : FindDocumentsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindDocumentsQuery) FindDocumentsByReferenceIdQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindDocumentsByReferenceIdQuery) Query(org.openehealth.ipf.commons.ihe.xds.core.requests.query.Query) GetDocumentsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetDocumentsQuery) ArrayList(java.util.ArrayList) ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) FindDocumentsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindDocumentsQuery) GetDocumentsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetDocumentsQuery) ReferenceId(org.openehealth.ipf.commons.ihe.xds.core.metadata.ReferenceId) InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException) StringParam(ca.uhn.fhir.rest.param.StringParam) QueryList(org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryList) DateParam(ca.uhn.fhir.rest.param.DateParam) QueryRegistry(org.openehealth.ipf.commons.ihe.xds.core.requests.QueryRegistry) FindDocumentsByReferenceIdQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindDocumentsByReferenceIdQuery) XcnName(org.openehealth.ipf.commons.ihe.xds.core.metadata.XcnName) AssigningAuthority(org.openehealth.ipf.commons.ihe.xds.core.metadata.AssigningAuthority) Code(org.openehealth.ipf.commons.ihe.xds.core.metadata.Code) Identifiable(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable) DateRangeParam(ca.uhn.fhir.rest.param.DateRangeParam) TokenOrListParam(ca.uhn.fhir.rest.param.TokenOrListParam) AvailabilityStatus(org.openehealth.ipf.commons.ihe.xds.core.metadata.AvailabilityStatus) TokenParam(ca.uhn.fhir.rest.param.TokenParam) Person(org.openehealth.ipf.commons.ihe.xds.core.metadata.Person)

Example 5 with QueryList

use of org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryList in project ipf by oehf.

the class GetFolderAndContentsQueryTransformerTest method setUp.

@BeforeEach
public void setUp() {
    transformer = new GetFolderAndContentsQueryTransformer();
    query = new GetFolderAndContentsQuery();
    query.setUuid("uuid1");
    query.setUniqueId("uniqueId1");
    query.setHomeCommunityId("home");
    var confidentialityCodes = new QueryList<Code>();
    confidentialityCodes.getOuterList().add(Arrays.asList(new Code("code10", null, "scheme10"), new Code("code11", null, "scheme11")));
    confidentialityCodes.getOuterList().add(Collections.singletonList(new Code("code12", null, "scheme12")));
    query.setConfidentialityCodes(confidentialityCodes);
    query.setFormatCodes(Arrays.asList(new Code("code13", null, "scheme13"), new Code("code14", null, "scheme14")));
    query.setDocumentEntryTypes(Collections.singletonList(DocumentEntryType.STABLE));
    ebXML = new EbXMLFactory30().createAdhocQueryRequest();
}
Also used : EbXMLFactory30(org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLFactory30) GetFolderAndContentsQueryTransformer(org.openehealth.ipf.commons.ihe.xds.core.transform.requests.query.GetFolderAndContentsQueryTransformer) QueryList(org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryList) Code(org.openehealth.ipf.commons.ihe.xds.core.metadata.Code) GetFolderAndContentsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetFolderAndContentsQuery) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

QueryList (org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryList)7 BeforeEach (org.junit.jupiter.api.BeforeEach)6 EbXMLFactory30 (org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLFactory30)6 Code (org.openehealth.ipf.commons.ihe.xds.core.metadata.Code)5 AssigningAuthority (org.openehealth.ipf.commons.ihe.xds.core.metadata.AssigningAuthority)3 Identifiable (org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable)3 GetDocumentsQuery (org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetDocumentsQuery)2 DateParam (ca.uhn.fhir.rest.param.DateParam)1 DateRangeParam (ca.uhn.fhir.rest.param.DateRangeParam)1 ReferenceParam (ca.uhn.fhir.rest.param.ReferenceParam)1 StringParam (ca.uhn.fhir.rest.param.StringParam)1 TokenOrListParam (ca.uhn.fhir.rest.param.TokenOrListParam)1 TokenParam (ca.uhn.fhir.rest.param.TokenParam)1 InvalidRequestException (ca.uhn.fhir.rest.server.exceptions.InvalidRequestException)1 ArrayList (java.util.ArrayList)1 AvailabilityStatus (org.openehealth.ipf.commons.ihe.xds.core.metadata.AvailabilityStatus)1 Person (org.openehealth.ipf.commons.ihe.xds.core.metadata.Person)1 ReferenceId (org.openehealth.ipf.commons.ihe.xds.core.metadata.ReferenceId)1 XcnName (org.openehealth.ipf.commons.ihe.xds.core.metadata.XcnName)1 QueryRegistry (org.openehealth.ipf.commons.ihe.xds.core.requests.QueryRegistry)1