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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidorg.openehealth.ipf.commons.audit.AuditContextGets the auditcontext used by the IPF Framework.voidconfigMetadataExtractionMode(DocumentMetadata.DocumentMetadataExtractionMode documentExtractionMode) voidconfigSubmissionMode(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 theXdsProvideAndRetrieveDocumentSetQueryThis 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 providerOrganization) This method will start building aPixAddPatientFeed, which allows the user to create a new Patient in the system.
The properties of anFhirPatientare used as a template and expected to be filled.createPixMergePatientFeed(Destination destination, org.hl7.fhir.r4.model.Organization providerOrganization, String obsoletePatientId, 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 providerOrganization) This method will start building aPixUpdatePatientFeed, which allows the user to update an existing patient in the system.
The properties of anFhirPatientare 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) CreatesSearchRequestwhich queries the Healthcare Provider Directory returning aBatchResponsecontaining informations regarding the: Individual Provider Organizational Provider Relationship CreatesAddRequestwhich writes to the Healthcare Provider Directory a: Individual Provider, Organizational Provider or a Relationship returning aBatchResponsecontaining a response code for success and error CreatesDelRequestwhich deletes from the Healthcare Provider Directory a: Individual Provider, Organizational Provider or a Relationship returning aBatchResponsecontaining a response code for success and errorsend(PdqSearchQuery patientSearchQuery) Send your builtPdqSearchQuerythrough the Internet and receive the results from the webservice.booleansend(PixAddPatientFeed addPatientFeed) Send your builtPixAddPatientFeedthrough the Internet to the webservice and receive an answer, whether the Patient was added or not.booleansend(PixMergePatientFeed mergePatientFeed) Send the builtPixMergePatientFeedthrough the Internet to the webservice and receive an answer.send(PixPatientIDQuery searchPatientIDQuery) Send the builtPixPatientIDQuerythrough the Internet to the webservice and receive an answer.booleansend(PixUpdatePatientFeed updatePatientFeed) Send your builtPixUpdatePatientFeedthrough 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.RetrievedDocumentSetsend(XdsDocumentSetRequest retrievedDocumentsRequest) Send your builtXdsDocumentSetRequestthrough the Internet to the webservice and receive the documents of the Patient.org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponsesend(XdsFindFoldersStoredQuery findFoldersStoredQuery) Send your builtXdsFindFoldersStoredQueryto 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.Responsesend(XdsProvideAndRetrieveDocumentSetQuery documentSet) Use theXdsProvideAndRetrieveDocumentSetQueryto build the ProvideAndRetrieveDocumentSet request which is sent to the webservice and adds or replaces an existing documentorg.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponseSend your builtXdsRegistryStoredFindDocumentsQuerythrough the Internet to the webservice and receive the document handlers.send(XuaRequest xuaRequest) Use theXuaRequestwhich is sent to the webservice and returns details about the identity of the authenticated user
-
Constructor Details
-
HuskyService
-
-
Method Details
-
configAuditContext
public org.openehealth.ipf.commons.audit.AuditContext configAuditContext()Gets the auditcontext used by the IPF Framework.- Returns:
AuditContext
-
configAtna
-
configMetadataExtractionMode
public void configMetadataExtractionMode(DocumentMetadata.DocumentMetadataExtractionMode documentExtractionMode) -
configSubmissionMode
public void configSubmissionMode(SubmissionSetMetadata.SubmissionSetMetadataExtractionMode submissionSetExtractionMode) -
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-Destination- Returns:
- builder
-
createDocumentWithMetadata
This method will start building aXdsDocumentWithMetadata, which will be used to build theXdsProvideAndRetrieveDocumentSetQuery -
createFindFoldersStoredQuery
public XdsFindFoldersStoredQuery.XdsFindFoldersStoredQueryBuilder<?,?> createFindFoldersStoredQuery()This method will start building aXdsFindFoldersStoredQuery, which allows the user to search the folders of a Patient. -
createHpdAddFeed
This method will start building aHpdAddFeed, 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). -
createHpdDeleteFeed
This method will start building aHpdDeleteFeed, which is needed to create the HPD request -
createHpdSearchQuery
This method will start building aHpdSearchQuery, which is needed to create the HPD request -
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
PdqSearchQuerywith the parameters you wish. - See Also:
-
createPixAddPatientFeed
public PixAddPatientFeed.PixAddPatientFeedBuilder createPixAddPatientFeed(Destination destination, org.hl7.fhir.r4.model.Organization providerOrganization) This method will start building aPixAddPatientFeed, which allows the user to create a new Patient in the system.
The properties of anFhirPatientare used as a template and expected to be filled.- Parameters:
destination-Destination- Returns:
- PixAddPatientQueryBuilder - to build the query
- See Also:
-
createPixMergePatientFeed
public PixMergePatientFeed.PixMergePatientFeedBuilder createPixMergePatientFeed(Destination destination, org.hl7.fhir.r4.model.Organization providerOrganization, String obsoletePatientId, 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-DestinationproviderOrganization-OrganizationobsoletePatientId- - the ID of the patient that should be merged into the new one.homeCommunityOID- - the OID of the home communityhomeCommunityNamespace- - the namespace of the home community- Returns:
- builder filled with default parameters
-
createPixPatientIDQuery
Use this method to build aPixPatientIDQuery, where the user can ask for all IDs known of a patient. -
createPixUpdatePatientFeed
public PixUpdatePatientFeed.PixUpdatePatientFeedBuilder createPixUpdatePatientFeed(Destination destination, org.hl7.fhir.r4.model.Organization providerOrganization) This method will start building aPixUpdatePatientFeed, which allows the user to update an existing patient in the system.
The properties of anFhirPatientare used, fill them accordingly.- Parameters:
destination-DestinationproviderOrganization-Organization- Returns:
- PixUpdatePatientFeedBuilder
-
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 -
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:
-
createValueSetRequest
This method will start building aSvsValueSetRequest, which allows to download a value set -
createXuaRequest
This method will start building aXuaRequest, which will be sent to the webservice and returns details about the identity of the authenticated user -
send
CreatesSearchRequestwhich queries the Healthcare Provider Directory returning aBatchResponsecontaining informations regarding the: Individual Provider Organizational Provider Relationship CreatesAddRequestwhich writes to the Healthcare Provider Directory a: Individual Provider, Organizational Provider or a Relationship returning aBatchResponsecontaining a response code for success and error CreatesDelRequestwhich deletes from the Healthcare Provider Directory a: Individual Provider, Organizational Provider or a Relationship returning aBatchResponsecontaining a response code for success and error- Parameters:
hpdBatchRequest- contains a batch ofHpdRequest- Returns:
HpdResponse- Throws:
Exception- thrown in the webservice call
-
send
Send your builtPdqSearchQuerythrough the Internet and receive the results from the webservice.- Parameters:
patientSearchQuery- APdqSearchQuerypreviously built.- Returns:
- A
PdqSearchResultsobject containing the matchingFhirPatientobjects in a list. - Throws:
Exception- errors occurring in the webservice clientRuntimeException- For errors/exceptions happening in the webservice there will be a RuntimeException wrapped SOAPException thrown.
-
send
Send your builtPixAddPatientFeedthrough the Internet to the webservice and receive an answer, whether the Patient was added or not.- Parameters:
addPatientFeed-PixAddPatientFeed- Returns:
- True if the patient was added without error. Errors are reported as exceptions.
- Throws:
Exception- errors occurring in the webservice clientRuntimeException- For errors/exceptions happening in the webservice there will be a RuntimeException wrapped SOAPException thrown.
-
send
Send the builtPixMergePatientFeedthrough the Internet to the webservice and receive an answer.- Parameters:
mergePatientFeed-PixMergePatientFeed- Returns:
- True if the patient was updated without error. Errors are reported as exceptions.
- Throws:
Exception- errors occurring in the webservice clientRuntimeException- For errors/exceptions happening in the webservice there will be a RuntimeException wrapped SOAPException thrown.
-
send
Send the builtPixPatientIDQuerythrough the Internet to the webservice and receive an answer.- Parameters:
searchPatientIDQuery-PixPatientIDQuery- Returns:
PixPatientIDResult- Throws:
Exception- thrown in the webservice call
-
send
Send your builtPixUpdatePatientFeedthrough the Internet to the webservice and receive an answer (updated or error).- Parameters:
updatePatientFeed-PixUpdatePatientFeed- Returns:
- True if the patient was updated without error. Errors are reported as exceptions.
- Throws:
Exception- errors occurring in the webservice clientRuntimeException- For errors/exceptions happening in the webservice there will be a RuntimeException wrapped SOAPException thrown.
-
send
public SvsValueSetResponse send(SvsValueSetRequest valueSetRequest, boolean isUseRaw) throws Exception 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:
Exception- thrown in the webservice call
-
send
public org.openehealth.ipf.commons.ihe.xds.core.responses.RetrievedDocumentSet send(XdsDocumentSetRequest retrievedDocumentsRequest) throws Exception Send your builtXdsDocumentSetRequestthrough the Internet to the webservice and receive the documents of the Patient.- Parameters:
retrievedDocumentsRequest-XdsDocumentSetRequest- Returns:
RetrievedDocumentSet- Throws:
Exception- errors occurring in the webservice clientRuntimeException- For errors/exceptions happening in the webservice there will be a RuntimeException wrapped SOAPException thrown.
-
send
public org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse send(XdsFindFoldersStoredQuery findFoldersStoredQuery) throws Exception Send your builtXdsFindFoldersStoredQueryto the webservice to find folders (XDSFolder objects) in the registry for a given patientID with matching 'status' attribute- Returns:
QueryResponse- Throws:
Exception- thrown in the webservice call
-
send
public org.openehealth.ipf.commons.ihe.xds.core.responses.Response send(XdsProvideAndRetrieveDocumentSetQuery documentSet) throws Exception Use theXdsProvideAndRetrieveDocumentSetQueryto build the ProvideAndRetrieveDocumentSet request which is sent to the webservice and adds or replaces an existing document- Returns:
Response- Throws:
Exception- thrown in the webservice call
-
send
public org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse send(XdsRegistryStoredFindDocumentsQuery query) throws Exception Send your builtXdsRegistryStoredFindDocumentsQuerythrough the Internet to the webservice and receive the document handlers.- Returns:
QueryResponse- Throws:
Exception- errors occurring in the webservice clientRuntimeException- For errors/exceptions happening in the webservice there will be a RuntimeException wrapped SOAPException thrown.
-
send
Use theXuaRequestwhich is sent to the webservice and returns details about the identity of the authenticated user- Returns:
XuaResponse- Throws:
ClientSendException- thrown in the xua call
-