Summary

The On Demand Documents (ODD) module is intended to  support the generation of documents using the most recent discrete data elements when requested by a consumer. This module depends on the CdaHandler, XdsRepository and ContentHandler modules, and subscribes to document import events raised by the CdaImportService (CdaHandler module). It will also register itself as a ContentHandler (ContentHandler module) and will service get requests using the content handler.

Because the XDS repository requests are provided only an identifier (i.e. the XDS module will need to know to call the ODD handler), all registrations of ODD documents will be conveyed to this module in order for the XDS module to record any necessary data required.

NOTE: Alternatively, all ODD documents can (and will) be given a unique identifier matching the SHR's OID, which could be used to trigger this behavior as well.

General Design 

The general design of the module is as follows:

Registering that an ODD is available (or new data is available):

  1. The ODD activator will subscribe multiple CdaImportSubscriber instances with the SHR CDA import service. These import handlers may subscribe to document templates which are of interest.
  2. When the CDA import service finishes importing discrete data, it will call the "onDocumentImported" method for all subscribers of the particular document templates imported
  3. The subscriber may determine that the discrete data can be used to generate the particular type of document. For example, if an APHP or APS is imported by the SHR, then the ApsSubscriber may use this as a trigger event to register an ODD APS document.
  4.  The OnDemandDocumentService, upon receiving a registration of an ODD will persist the registration to the OpenMRS data store and will perform the necessary steps to convey this data to the XDS registry (to be handled by the XDS implementation as it will need to know how to service retrieve requests)

Servicing a query:

  1. A request to retrieve an ODD is initiated on the OnDemandDocumentService (for example, as the result of a RetrieveDocuments or from the ContentHandler's getDocument() method)
  2. The OnDemandDocumentService retrieves the OnDemandDocumentRegistration information from the data store to determine how it should generate the document
  3. The OnDemandDocumentService instantiates the appropriate generator and calls generateDocument() passing in the appropriate registration information (patient, encounters from which to draw observations, etc.) 

The static model for this is provided below:

  • No labels