Class HuskyService
java.lang.Object
org.projecthusky.communication.services.HuskyService
The main service class to use when working with the EPD web services. As it is marked as a @Component, it will be
immediately available in your application to reference.
It provides query building capabilities and executing those queries against a targeted service.
Functionality built so far:
It provides query building capabilities and executing those queries against a targeted service.
Functionality built so far:
- Searching for patients by Patient criteria -
PdqSearchQuery
. - Adding new patient -
PixAddPatientFeed
- Updating existing patient -
PixUpdatePatientFeed
- Searching for a Patient's documents -
XdsRegistryStoredFindDocumentsQuery
@Autowired private HuskyService service; //get an instance of the service class private String senderApp; //e.g. like the test-app: "1.2.3.4" private String searchWebServiceUri; //The address where the webservice resides. public void doMyBusinessStuff() {Destination
dest = Destination.builder().uri(URI.create(searchWebServiceUri)).senderApplicationOid(senderApp).build();Name
patientName = new Name(Name.builder().withFamily("Anders").build()); //This was not refactored yet, so creation is a bit weird. //Build the query, starting from the central service. Set all parameters you wish to send.PdqSearchQuery
query = this.service.startBuildingSearchQuery(dest) .patientName(patientName).build(); //Send your search parameters (name) to the service and receive the results.PdqSearchResults
result = this.service.send(query); //see your results for the name given as search parameter: for (FhirPatient
patient: result.getPatients()) { //do business } }
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
configMetadataExtractionMode
(DocumentMetadata.DocumentMetadataExtractionMode documentExtractionMode) void
configSubmissionMode
(SubmissionSetMetadata.SubmissionSetMetadataExtractionMode submissionSetExtractionMode) createDocumentSetRequest
(Destination destination) This method will start building aXdsDocumentSetRequest
, which allows the user to download the documents ofa Patient.This method will start building aXdsDocumentWithMetadata
, which will be used to build theXdsProvideAndRetrieveDocumentSetQuery
This method will start building aXdsFindFoldersStoredQuery
, which allows the user to search the folders of a Patient.This method will start building aHpdAddFeed
, which is needed to create the HPD requestThis method will start building aHpdBatchRequest
, which contain multiple HPD requests.This method will start building aHpdDeleteFeed
, which is needed to create the HPD requestThis method will start building aHpdSearchQuery
, which is needed to create the HPD requestcreatePdqSearchQuery
(Destination destination) Use this method to start building aPdqSearchQuery
.createPixAddPatientFeed
(Destination destination, org.hl7.fhir.r4.model.Organization scopingOrganization) This method will start building aPixAddPatientFeed
, which allows the user to create a new Patient in the system.
The properties of anFhirPatient
are used as a template and expected to be filled.createPixMergePatientFeed
(Destination destination, org.hl7.fhir.r4.model.Organization scopingOrganization, String obsolatePatientId, String homeCommunityOID, String homeCommunityNamespace) Use this method to build aPixMergePatientFeed
, with which the user can merge two know patient objects into one in case those two are the same person.
This case is mostly used to correct user errors when the same person is entered into a system multiple times and needs to be merged into one.createPixPatientIDQuery
(Destination destination) Use this method to build aPixPatientIDQuery
, where the user can ask for all IDs known of a patient.createPixUpdatePatientFeed
(Destination destination, org.hl7.fhir.r4.model.Organization scopingOrganization) This method will start building aPixUpdatePatientFeed
, which allows the user to update an existing patient in the system.
The properties of anFhirPatient
are used, fill them accordingly.This method will start building aXdsProvideAndRetrieveDocumentSetQuery
, which will be sent to the webservice and allows the user to add or replace an existing documentcreateRegistryStoredFindDocumentsQuery
(Destination destination, Identificator patientID) This method will start building aXdsRegistryStoredFindDocumentsQuery
, which allows the user to look for documents of a Patient identified by the ID by various parameters.This method will start building aSvsValueSetRequest
, which allows to download a value setThis method will start building aXuaRequest
, which will be sent to the webservice and returns details about the identity of the authenticated usersend
(HpdBatchRequest hpdBatchRequest) CreatesSearchRequest
which queries the Healthcare Provider Directory returning aBatchResponse
containing informations regarding the: Individual Provider Organizational Provider Relationship CreatesAddRequest
which writes to the Healthcare Provider Directory a: Individual Provider, Organizational Provider or a Relationship returning aBatchResponse
containing a response code for success and error CreatesDelRequest
which deletes from the Healthcare Provider Directory a: Individual Provider, Organizational Provider or a Relationship returning aBatchResponse
containing a response code for success and errorsend
(PdqSearchQuery patientSearchQuery) Send your builtPdqSearchQuery
through the Internet and receive the results from the webservice.boolean
send
(PixAddPatientFeed addPatientFeed) Send your builtPixAddPatientFeed
through the Internet to the webservice and receive an answer, whether the Patient was added or not.boolean
send
(PixMergePatientFeed mergePatientFeed) Send the builtPixMergePatientFeed
through the Internet to the webservice and receive an answer.send
(PixPatientIDQuery searchPatientIDQuery) Send the builtPixPatientIDQuery
through the Internet to the webservice and receive an answer.boolean
send
(PixUpdatePatientFeed updatePatientFeed) Send your builtPixUpdatePatientFeed
through the Internet to the webservice and receive an answer (updated or error).send
(SvsValueSetRequest valueSetRequest, boolean isUseRaw) Downloads a value set as defined in the given configuration, or in raw dformat exactly as downloadedorg.openehealth.ipf.commons.ihe.xds.core.responses.RetrievedDocumentSet
send
(XdsDocumentSetRequest retrievedDocumentsRequest) Send your builtXdsDocumentSetRequest
through the Internet to the webservice and receive the documents of the Patient.org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse
send
(XdsFindFoldersStoredQuery findFoldersStoredQuery) Send your builtXdsFindFoldersStoredQuery
to the webservice to find folders (XDSFolder objects) in the registry for a given patientID with matching 'status' attributeorg.openehealth.ipf.commons.ihe.xds.core.responses.Response
send
(XdsProvideAndRetrieveDocumentSetQuery documentSet) Use theXdsProvideAndRetrieveDocumentSetQuery
to build the ProvideAndRetrieveDocumentSet request which is sent to the webservice and adds or replaces an existing documentorg.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse
Send your builtXdsRegistryStoredFindDocumentsQuery
through the Internet to the webservice and receive the document handlers.send
(XuaRequest xuaRequest) Use theXuaRequest
which is sent to the webservice and returns details about the identity of the authenticated user
-
Constructor Details
-
HuskyService
-
-
Method Details
-
configAtna
-
configSubmissionMode
public void configSubmissionMode(SubmissionSetMetadata.SubmissionSetMetadataExtractionMode submissionSetExtractionMode) -
configMetadataExtractionMode
public void configMetadataExtractionMode(DocumentMetadata.DocumentMetadataExtractionMode documentExtractionMode) -
createPdqSearchQuery
Use this method to start building aPdqSearchQuery
. These queries are designed to search for patients by different criteria.
Previously they where called Patient Demographics Query (PDQ), as the official definition states.
Common criteria are:- Patient's name
- Patient's ID
- Patient's address
- Patient's birthday
- Patient's gender
- Patient's telecom contact
- etc
- Returns:
- A SearchQueryBuilder to build a
PdqSearchQuery
with the parameters you wish. - See Also:
-
createPixPatientIDQuery
Use this method to build aPixPatientIDQuery
, where the user can ask for all IDs known of a patient. -
createPixAddPatientFeed
public PixAddPatientFeed.PixAddPatientFeedBuilder createPixAddPatientFeed(Destination destination, org.hl7.fhir.r4.model.Organization scopingOrganization) This method will start building aPixAddPatientFeed
, which allows the user to create a new Patient in the system.
The properties of anFhirPatient
are used as a template and expected to be filled.- Parameters:
destination
-- Returns:
- PixAddPatientQueryBuilder
- See Also:
-
createPixUpdatePatientFeed
public PixUpdatePatientFeed.PixUpdatePatientFeedBuilder createPixUpdatePatientFeed(Destination destination, org.hl7.fhir.r4.model.Organization scopingOrganization) This method will start building aPixUpdatePatientFeed
, which allows the user to update an existing patient in the system.
The properties of anFhirPatient
are used, fill them accordingly.- Parameters:
destination
-scopingOrganization
-- Returns:
- PixUpdatePatientFeedBuilder
-
createPixMergePatientFeed
public PixMergePatientFeed.PixMergePatientFeedBuilder createPixMergePatientFeed(Destination destination, org.hl7.fhir.r4.model.Organization scopingOrganization, String obsolatePatientId, String homeCommunityOID, String homeCommunityNamespace) Use this method to build aPixMergePatientFeed
, with which the user can merge two know patient objects into one in case those two are the same person.
This case is mostly used to correct user errors when the same person is entered into a system multiple times and needs to be merged into one.- Parameters:
destination
-scopingOrganization
-obsolatePatientId
-homeCommunityOID
-homeCommunityNamespace
-- Returns:
-
createRegistryStoredFindDocumentsQuery
public XdsRegistryStoredFindDocumentsQuery.XdsRegistryStoredFindDocumentsQueryBuilder<?,?> createRegistryStoredFindDocumentsQuery(Destination destination, Identificator patientID) This method will start building aXdsRegistryStoredFindDocumentsQuery
, which allows the user to look for documents of a Patient identified by the ID by various parameters.- Returns:
- RegistryStoredFindDocumentsQueryBuilder
- See Also:
-
createDocumentSetRequest
public XdsDocumentSetRequest.XdsDocumentSetRequestBuilder createDocumentSetRequest(Destination destination) This method will start building aXdsDocumentSetRequest
, which allows the user to download the documents ofa Patient.- Parameters:
destination
-- Returns:
-
createDocumentWithMetadata
This method will start building aXdsDocumentWithMetadata
, which will be used to build theXdsProvideAndRetrieveDocumentSetQuery
-
createProvideAndRetrieveDocumentSetQuery
public XdsProvideAndRetrieveDocumentSetQuery.XdsProvideAndRetrieveDocumentSetQueryBuilder createProvideAndRetrieveDocumentSetQuery()This method will start building aXdsProvideAndRetrieveDocumentSetQuery
, which will be sent to the webservice and allows the user to add or replace an existing document -
createXuaRequest
This method will start building aXuaRequest
, which will be sent to the webservice and returns details about the identity of the authenticated user -
createFindFoldersStoredQuery
public XdsFindFoldersStoredQuery.XdsFindFoldersStoredQueryBuilder<?,?> createFindFoldersStoredQuery()This method will start building aXdsFindFoldersStoredQuery
, which allows the user to search the folders of a Patient. -
createValueSetRequest
This method will start building aSvsValueSetRequest
, which allows to download a value set -
createHpdSearchQuery
This method will start building aHpdSearchQuery
, which is needed to create the HPD request -
createHpdAddFeed
This method will start building aHpdAddFeed
, which is needed to create the HPD request -
createHpdDeleteFeed
This method will start building aHpdDeleteFeed
, which is needed to create the HPD request -
createHpdBatchRequest
This method will start building aHpdBatchRequest
, which contain multiple HPD requests. The request also provides more options like how to process the request (sequential or in parallel), how to retrieve the response (sequential or unordered) and how to proceed in case of an error (resume or exit). -
send
public PdqSearchResults send(PdqSearchQuery patientSearchQuery) throws javax.xml.bind.DataBindingException, javax.xml.bind.JAXBException, ParserConfigurationException, SerializeException, IOException Send your builtPdqSearchQuery
through the Internet and receive the results from the webservice.- Parameters:
patientSearchQuery
- APdqSearchQuery
previously built.- Returns:
- A
PdqSearchResults
object containing the matchingFhirPatient
objects in a list. - Throws:
javax.xml.bind.DataBindingException
javax.xml.bind.JAXBException
ParserConfigurationException
SerializeException
IOException
RuntimeException
- - For errors/exceptions happening in the webservice there will be a RuntimeException wrapped SOAPException thrown.
-
send
public boolean send(PixAddPatientFeed addPatientFeed) throws javax.xml.bind.JAXBException, SerializeException, ParserConfigurationException, IOException Send your builtPixAddPatientFeed
through the Internet to the webservice and receive an answer, whether the Patient was added or not.- Parameters:
addPatientFeed
-- Returns:
- True if the patient was added without error. Errors are reported as exceptions.
- Throws:
javax.xml.bind.JAXBException
SerializeException
ParserConfigurationException
IOException
RuntimeException
- - For errors/exceptions happening in the webservice there will be a RuntimeException wrapped SOAPException thrown.
-
send
public boolean send(PixUpdatePatientFeed updatePatientFeed) throws javax.xml.bind.JAXBException, SerializeException, ParserConfigurationException, IOException Send your builtPixUpdatePatientFeed
through the Internet to the webservice and receive an answer (updated or error).- Parameters:
updatePatientFeed
-- Returns:
- True if the patient was updated without error. Errors are reported as exceptions.
- Throws:
javax.xml.bind.JAXBException
SerializeException
ParserConfigurationException
IOException
-
send
public boolean send(PixMergePatientFeed mergePatientFeed) throws javax.xml.bind.JAXBException, SerializeException, ParserConfigurationException, IOException Send the builtPixMergePatientFeed
through the Internet to the webservice and receive an answer.- Parameters:
mergePatientFeed
-- Returns:
- Throws:
javax.xml.bind.JAXBException
SerializeException
ParserConfigurationException
IOException
-
send
Send the builtPixPatientIDQuery
through the Internet to the webservice and receive an answer.- Parameters:
searchPatientIDQuery
-- Returns:
- Throws:
Exception
-
send
public org.openehealth.ipf.commons.ihe.xds.core.responses.RetrievedDocumentSet send(XdsDocumentSetRequest retrievedDocumentsRequest) throws SerializeException, ParserConfigurationException, IOException Send your builtXdsDocumentSetRequest
through the Internet to the webservice and receive the documents of the Patient.- Parameters:
retrievedDocumentsRequest
-- Returns:
- Throws:
SerializeException
ParserConfigurationException
IOException
-
send
public org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse send(XdsRegistryStoredFindDocumentsQuery query) throws Exception Send your builtXdsRegistryStoredFindDocumentsQuery
through the Internet to the webservice and receive the document handlers.- Returns:
QueryResponse
- Throws:
Exception
-
send
Use theXuaRequest
which is sent to the webservice and returns details about the identity of the authenticated user- Returns:
XuaResponse
- Throws:
ClientSendException
-
send
public org.openehealth.ipf.commons.ihe.xds.core.responses.Response send(XdsProvideAndRetrieveDocumentSetQuery documentSet) throws SerializeException, ParserConfigurationException, IOException Use theXdsProvideAndRetrieveDocumentSetQuery
to build the ProvideAndRetrieveDocumentSet request which is sent to the webservice and adds or replaces an existing document- Returns:
Response
- Throws:
SerializeException
ParserConfigurationException
IOException
-
send
public org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse send(XdsFindFoldersStoredQuery findFoldersStoredQuery) throws SerializeException, ParserConfigurationException, IOException Send your builtXdsFindFoldersStoredQuery
to the webservice to find folders (XDSFolder objects) in the registry for a given patientID with matching 'status' attribute- Returns:
QueryResponse
- Throws:
SerializeException
ParserConfigurationException
IOException
-
send
public SvsValueSetResponse send(SvsValueSetRequest valueSetRequest, boolean isUseRaw) throws IOException, ParserConfigurationException, InitializationException, SAXException Downloads a value set as defined in the given configuration, or in raw dformat exactly as downloaded- Parameters:
valueSetRequest
- request used to create the value set configisUseRaw
- flag that signals if the response is needed in raw dformat- Returns:
- ValueSetResponse object that contains both formats of the response
- Throws:
IOException
- Signals that an I/O exception has occurred.SAXException
ParserConfigurationException
InitializationException
-
send
public HpdResponse send(HpdBatchRequest hpdBatchRequest) throws SerializeException, javax.xml.bind.JAXBException, ParserConfigurationException, IOException CreatesSearchRequest
which queries the Healthcare Provider Directory returning aBatchResponse
containing informations regarding the: Individual Provider Organizational Provider Relationship CreatesAddRequest
which writes to the Healthcare Provider Directory a: Individual Provider, Organizational Provider or a Relationship returning aBatchResponse
containing a response code for success and error CreatesDelRequest
which deletes from the Healthcare Provider Directory a: Individual Provider, Organizational Provider or a Relationship returning aBatchResponse
containing a response code for success and error- Parameters:
hpdBatchRequest
- contains a batch ofHpdRequest
- Returns:
HpdResponse
- Throws:
SerializeException
javax.xml.bind.JAXBException
ParserConfigurationException
IOException
-