Search in sources :

Example 1 with FindSubmissionSetsQuery

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

the class FindSubmissionSetsQueryTransformerTest method testFromEbXMLNull.

@Test
public void testFromEbXMLNull() {
    var result = new FindSubmissionSetsQuery();
    transformer.fromEbXML(result, null);
    assertEquals(new FindSubmissionSetsQuery(), result);
}
Also used : FindSubmissionSetsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindSubmissionSetsQuery) Test(org.junit.jupiter.api.Test)

Example 2 with FindSubmissionSetsQuery

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

the class FindSubmissionSetsQueryTransformerTest method setUp.

@BeforeEach
public void setUp() {
    transformer = new FindSubmissionSetsQueryTransformer();
    query = new FindSubmissionSetsQuery();
    query.setPatientId(new Identifiable("id1", new AssigningAuthority("uni1", "uniType1")));
    query.setContentTypeCodes(Arrays.asList(new Code("code1", null, "system1"), new Code("code2", null, "system2")));
    query.getSubmissionTime().setFrom("20150102030405");
    query.getSubmissionTime().setTo("20150102030406");
    query.setAuthorPerson("per'son1");
    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) FindSubmissionSetsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindSubmissionSetsQuery) AssigningAuthority(org.openehealth.ipf.commons.ihe.xds.core.metadata.AssigningAuthority) Code(org.openehealth.ipf.commons.ihe.xds.core.metadata.Code) FindSubmissionSetsQueryTransformer(org.openehealth.ipf.commons.ihe.xds.core.transform.requests.query.FindSubmissionSetsQueryTransformer) Identifiable(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with FindSubmissionSetsQuery

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

the class Iti66RequestConverter method searchParameterIti66ToFindSubmissionSetsQuery.

/**
 * convert ITI-66 request to ITI-18 request
 * @param searchParameter
 * @return
 */
public QueryRegistry searchParameterIti66ToFindSubmissionSetsQuery(@Body Iti66SearchParameters searchParameter) {
    boolean getLeafClass = true;
    Query searchQuery = null;
    if (searchParameter.getIdentifier() != null || searchParameter.get_id() != null) {
        final GetSubmissionSetAndContentsQuery query = new GetSubmissionSetAndContentsQuery();
        if (searchParameter.getIdentifier() != null) {
            String val = searchParameter.getIdentifier().getValue();
            if (val.startsWith("urn:oid:")) {
                query.setUniqueId(val.substring("urn:oid:".length()));
            } else if (val.startsWith("urn:uuid:")) {
                query.setUuid(val.substring("urn:uuid:".length()));
            }
        } else {
            query.setUuid(searchParameter.get_id().getValue());
        }
        searchQuery = query;
    } else {
        final FindSubmissionSetsQuery query = new FindSubmissionSetsQuery();
        if (searchParameter.getCode() != null && !searchParameter.getCode().getValue().equals("submissionset")) {
            throw new InvalidRequestException("Only search for submissionsets supported.");
        }
        // patient or patient.identifier -> $XDSSubmissionSetPatientId
        TokenParam tokenIdentifier = searchParameter.getPatientIdentifier();
        if (tokenIdentifier != null) {
            String system = getScheme(tokenIdentifier.getSystem());
            if (system == null)
                throw new InvalidRequestException("Missing OID for patient");
            /*if (system.startsWith("urn:oid:")) {
	                 system = system.substring(8);
	             }*/
            query.setPatientId(new Identifiable(tokenIdentifier.getValue(), new AssigningAuthority(system)));
        }
        ReferenceParam patientRef = searchParameter.getPatientReference();
        if (patientRef != null) {
            Identifiable id = transformReference(patientRef.getValue());
            query.setPatientId(id);
        }
        // created Note 1 -> $XDSSubmissionSetSubmissionTimeFrom
        // created Note 2 -> $XDSSubmissionSetSubmissionTimeTo
        DateRangeParam createdRange = searchParameter.getDate();
        if (createdRange != null) {
            DateParam creationTimeFrom = createdRange.getLowerBound();
            DateParam creationTimeTo = createdRange.getUpperBound();
            query.getSubmissionTime().setFrom(timestampFromDateParam(creationTimeFrom));
            query.getSubmissionTime().setTo(timestampFromDateParam(creationTimeTo));
        }
        // TODO author.given / author.family -> $XDSSubmissionSetAuthorPerson
        StringParam authorGivenName = searchParameter.getSourceGiven();
        StringParam authorFamilyName = searchParameter.getSourceFamily();
        if (authorGivenName != null || authorFamilyName != null) {
            String author = (authorGivenName != null ? authorGivenName.getValue() : "%") + " " + (authorFamilyName != null ? authorFamilyName.getValue() : "%");
            query.setAuthorPerson(author);
        }
        // type -> $XDSSubmissionSetContentType
        TokenOrListParam types = searchParameter.getDesignationType();
        query.setContentTypeCodes(codesFromTokens(types));
        // source -> $XDSSubmissionSetSourceId
        TokenOrListParam sources = searchParameter.getSourceId();
        query.setSourceIds(urisFromTokens(sources));
        // status -> $XDSSubmissionSetStatus
        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);
        }
        searchQuery = query;
    }
    final QueryRegistry queryRegistry = new QueryRegistry(searchQuery);
    queryRegistry.setReturnType((getLeafClass) ? QueryReturnType.LEAF_CLASS : QueryReturnType.OBJECT_REF);
    return queryRegistry;
}
Also used : GetSubmissionSetAndContentsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetSubmissionSetAndContentsQuery) Query(org.openehealth.ipf.commons.ihe.xds.core.requests.query.Query) FindSubmissionSetsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindSubmissionSetsQuery) QueryRegistry(org.openehealth.ipf.commons.ihe.xds.core.requests.QueryRegistry) ArrayList(java.util.ArrayList) FindSubmissionSetsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindSubmissionSetsQuery) ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) AssigningAuthority(org.openehealth.ipf.commons.ihe.xds.core.metadata.AssigningAuthority) 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) InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException) StringParam(ca.uhn.fhir.rest.param.StringParam) GetSubmissionSetAndContentsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetSubmissionSetAndContentsQuery) DateParam(ca.uhn.fhir.rest.param.DateParam)

Example 4 with FindSubmissionSetsQuery

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

the class FindSubmissionSetsQueryTransformerTest method testToEbXMLEmpty.

@Test
public void testToEbXMLEmpty() {
    transformer.toEbXML(new FindSubmissionSetsQuery(), ebXML);
    assertEquals(0, ebXML.getSlots().size());
}
Also used : FindSubmissionSetsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindSubmissionSetsQuery) Test(org.junit.jupiter.api.Test)

Example 5 with FindSubmissionSetsQuery

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

the class FindSubmissionSetsQueryTransformerTest method testFromEbXMLEmpty.

@Test
public void testFromEbXMLEmpty() {
    var result = new FindSubmissionSetsQuery();
    transformer.fromEbXML(result, ebXML);
    assertEquals(new FindSubmissionSetsQuery(), result);
}
Also used : FindSubmissionSetsQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindSubmissionSetsQuery) Test(org.junit.jupiter.api.Test)

Aggregations

FindSubmissionSetsQuery (org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindSubmissionSetsQuery)5 Test (org.junit.jupiter.api.Test)3 AssigningAuthority (org.openehealth.ipf.commons.ihe.xds.core.metadata.AssigningAuthority)2 Identifiable (org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable)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 BeforeEach (org.junit.jupiter.api.BeforeEach)1 EbXMLFactory30 (org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLFactory30)1 AvailabilityStatus (org.openehealth.ipf.commons.ihe.xds.core.metadata.AvailabilityStatus)1 Code (org.openehealth.ipf.commons.ihe.xds.core.metadata.Code)1 QueryRegistry (org.openehealth.ipf.commons.ihe.xds.core.requests.QueryRegistry)1 GetSubmissionSetAndContentsQuery (org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetSubmissionSetAndContentsQuery)1 Query (org.openehealth.ipf.commons.ihe.xds.core.requests.query.Query)1 FindSubmissionSetsQueryTransformer (org.openehealth.ipf.commons.ihe.xds.core.transform.requests.query.FindSubmissionSetsQueryTransformer)1