Profiles & Operations > Operation: Search Document

Operation: Search Document

Search Document

The Search Document operation issues a parameterized query that results in a searchset Bundle that contains all Document Bundles that match the search parameters (a searchset Bundle of document Bundles). This operation supports retrieval of a set of instances using the following search criteria:

Query Search Parameter Description Usage Note
patient.identifier (bundle.composition.patient.identifier) This parameter specifies an identifier associated with the patient who is the subject of this document. This use of patient.identifier follows the FHIR Chaining Parameters search methodology. This can be an HCN, MRN or ECID (Enterprise Client ID) and SHALL include both system and value.
timestamp (bundle.timestamp) This parameter specifies when this document was created. See FHIR http://hl7.org/fhir/R4/search.html#date for use of the date search type. Applied directly on bundle, does not require chaining.
composition.type (bundle.composition.type) This parameter specifies the type of document. This use of composition.type follows the FHIR Chaining Parameters search methodology. TBD
composition.category (bundle.composition.category) This parameter specifies the category of document. A document category can be any of the five parts based on document ontology. TBD
composition.status (bundle.composition.status) This parameter specifies the status of the document, e.g. "final" or "preliminary". This use of composition.status follows the FHIR Chaining Parameters search methodology. A status of "entered-in-error" indicates a Patient Summary that has been invalidated.
_lastupdated (bundle?_lastupdated) This parameter can be used to select resources based on the last time they were changed. This is primarily intended to support the vread operation and searching for historical documents.
_sort (_sort=[-]bundle.timestamp) This parameter can be used to specify sorting criteria. It can be used to sort in either ascending or descending order. The optional "-" prefix indicates descending order. This allows the sorting of search results based on the creation date of the document
_count This parameter specifies how many search results should be returned in a single page.

Scope

This transaction involves a request by an acCDR Document Consumer for a set of documents matching the specified search criteria. The request is received by the acCDR FHIR server which returns a Bundle containing the matching Document Compositions.

For example, a physician who has access to acCDR is seeing a new patient and wants to see a list of discharge summaries available for that patient. The physician uses the patient information held in the system to query acCDR FHIR server for any discharge summary documents that exist for that patient. The server returns a Bundle of any matching discharge summaries which is then displayed to the physician as a list. The PoS system is responsibile for listing the available discharge summaries for the user to review.

Note that in the first release of this implementation guide, we will only support a limited seach scenarios based on category. These are the scenarios and the corresponding category search parameter values. (NOTE this is work in progress)

Clinical Viewer Portlet Scenario LOINC search query expression FHIR Search by Document Category expression
Document Notes Search for documents related to care or a procedure that is not diagnostic nature, such as discharge summaries, procedure notes, clinic and progress notes !LP173115-9 category:not=LP173115-9
Other Results Search for documents related to a diagnostic procedure but not sent to DICS, such as cardiology reports, speech-language dignostic reports, neurology diagnostic reports (EEG). These are reports where type of service is a Dignostic Study but they are not sent to DICS (i.e. not mapped to acCDR code with DI modality) LP173115-9 category=LP173115-9

Interaction Diagram

search-document-diagram

Actor: acCDR Document Consumer

Role: Requests a set of acCDR documents from the acCDR FHIR server based on specified search criteria.

Actor: acCDR FHIR server

Role: Returns a Bundle containing DocumentReference instances that match the search criteria specified by the acCDR Document Consumer.

Specification

Search Request

The Search operation will return a searchset Bundle resource containing the acCDR Document Compositions (as document Bundles) that match the specified search criteria. The search request supports both GET and POST; we prefer the use of POST to avoid putting PHI in request URLs.

GET [base]/Bundle?([parameters]{&_format=[mime-type]})

POST [base]/Bundle/_search{?&_format=[mime-type]}

For POST request, the parameters SHALL be provided in the form of FHIR Parameters resource in the HTTP body of the request.

Search Response

A document Search Response may contain either:

  • a searchset Bundle containing zero or more Composition Document Bundles matching the search criteria. Each document Bundle will include all resources referenced by the Composition resource; no _include search parameter will be required. see note below:

note: to return a lightweight response that does not include all referenced resources, please see the Fetch DocumentReference operation page to return only DocumentReference resources

Example Search Queries

Search By Patient Identifier

GET [base]/Bundle?composition.patient.identifier=https%3A%2F%2Ffhir.infoway-inforoute.ca%2FNamingSystem%2Fca-on-patient-hcn|1234567890

OR

POST [base]/Bundle?_search with HTTP body composition.patient.identifier=https%3A%2F%2Ffhir.infoway-inforoute.ca%2FNamingSystem%2Fca-on-patient-hcn|1234567890

Search for documents for a patient and created in 2020 or Later

[base]Bundle?composition.patient.identifier=https%3A%2F%2Ffhir.infoway-inforoute.ca%2FNamingSystem%2Fca-on-patient-hcn|1234567890&timestamp=ge2020

OR

POST [base]/Bundle?_search with HTTP body composition.patient.identifier=https%3A%2F%2Ffhir.infoway-inforoute.ca%2FNamingSystem%2Fca-on-patient-hcn|1234567890&timestamp=ge2020

Example Response

Search Document Response Example TBD

Expected Behavior

See Response Handling page for additional response handling behaviour.

Legend
code = OperationOutcome.issue.code
severity = OperationOutcome.issue.severity
details.coding.code=OperationOutcome.issue.details.coding.code
details.coding.display=OperationOutcome.issue.details.coding.display
details.text = OperationOutcome.issue.details.coding.text
HTTP Status Scenario Description severity code details.coding.code details.coding.display details.text
200 OK At least one document matching the specified search criteria is found
200 OK At least one document matching the specified search criteria is found, but there is a consent block that prevents disclosure of patient data. Returns an OperationOutcome resource indicating that there is a consent block on the patient's record that prevents disclosure of patient data. warning suppressed
200 OK No documents matching the specified search criteria are found. warning not-found
400 Bad Request Missing security token error required Missing required security token: PIN
400 Bad Request Request is malformed (e.g. incorrect header value, patient identifier is missing system or value, etc) error -- -- -- --
500 Internal Server Error API validates the request but cannot return a valid response due to internal issues. fatal exception Internal Error
503 Service Unavailable Indicates that the services has been temporarily taken down (on purpose)
504 Gateway Timeout Downstream system(s) did not return timely response error timeout