HS.FHIRServer.DefaultBundleProcessor
class HS.FHIRServer.DefaultBundleProcessor extends HS.FHIRServer.Util.Bundle
Method Inventory
- AddToPostOrder()
- BuildDependencyCallback()
- ExecuteBundle()
- ExecuteBundleMain()
- ExtractUUID()
- GetFormatForContentType()
- ProcessBundle()
- ResolveReferencesImpl()
- dispatchRequest()
- prepareRequest()
Parameters
parameter BundleValidatorClass = HS.FHIRServer.Util.BundleValidator;
Class that provides the FHIR Bundle resource validation logic for this Bundle processing
class. The class is intended to handle Bundle-specific validation, i.e., the rules
applying to transaction, batch, document, and message Bundles.
Methods
classmethod AddToPostOrder(entryId As %String, ByRef visitContext, ByRef postContext, path As %CacheString = "", entryMethod As %String)
This is a function that recurses on all entries that the specified entry needs to have POST'd, then it adds
itself to the list. NOTE: This tries to minimize updates of newly posted resources. If a circular reference is detected, then
reposting may be necessary and is handled later.
classmethod BuildDependencyCallback(ByRef visitContext, pRefObj As %DynamicObject)
This method is a callback from the VisitAll method. It is called for each Reference object
in the resource. If the reference is bundle-internal, we capture it.
classmethod ExecuteBundle(pService As HS.FHIRServer.API.Service, pRequest As HS.FHIRServer.API.Data.Request, pResponse As HS.FHIRServer.API.Data.Response, pBundleType As %String, ByRef visitContext)
ExecuteBundle processes a batch or transaction Bundle according to the FHIR specification at:
http://hl7.org/fhir/http.html#transaction
Inputs:
pService : The FHIR Service instance that invoked this processor
pRequest : FHIR request message.
pResponse : FHIR response object to receive the result
pBundleType : String specifying the bundle type ("batch" or "transaction")
visitContext : The context multidimensional that is controlling this operation
http://hl7.org/fhir/http.html#transaction
Inputs:
classmethod ExecuteBundleMain(pService As HS.FHIRServer.API.Service, pRequest As HS.FHIRServer.API.Data.Request, pResponse As HS.FHIRServer.API.Data.Response, pBundleType As %String, ByRef visitContext)
API
ExtractUUID returns the UUID-portion of the input string if the specified string is a UUID, returns 0 if not.
Requirement for the presence of the "urn:uuid:" prefix is determined by the pPrefixRequired input parameter.
Once prefix is verified per the requirement, the remainder of validation takes place
with the prefix stripped.
classmethod GetFormatForContentType(mimeType As %String)
classmethod ProcessBundle(pService As HS.FHIRServer.API.Service, pRequest As HS.FHIRServer.API.Data.Request, pResponse As HS.FHIRServer.API.Data.Response)
Context layout
ctx("entry") : Count of entries
ctx("entry", n) : The n-th input bundle entry
ctx("entry", n, "response") : The response bundle entry for the n-th input bundle entry
ctx("entry", n, "fullUrl") : The temporary id (used only for POST entries) to allow references from other
: resources in the bundle. Used only for transaction interactions
ctx("ByFullUrl", fullUrl) : The actual id associated with the refkey. Used to resolve references to this resource.
ctx("ByFullUrl", fullUrl, "entry") : The entry Index associated with the refkey.
: resources in the bundle. Used only for transaction interactions
ctx("ByFullUrl", fullUrl, "from", iEntry) : EntryId of a resource referencing the fullUrl
ctx("ByFullUrl", fullUrl, "refObj") : Count of References to fullUrl within the bundle
ctx("ByFullUrl", fullUrl, "refObj", n) : n-th Reference Object referring to fullUrl
ctx("ByFullVersionedUrl", fullUrl, versionId) : The actual id associated with the versionId version of the refkey. Used to resolve references to this resource.
ctx("ByFullVersionedUrl", fullUrl, versionId, "entry") : The entry Index associated with the versionId version of the refkey.
ctx("ByFullVersionedUrl", fullUrl, versionId, "from", iEntry) : EntryId of a resource referencing the versionId version of the fullUrl
ctx("ByFullVersionedUrl", fullUrl, versionId, "refObj") : Count of References to versionId version of the fullUrl within the bundle
ctx("ByFullVersionedUrl", fullUrl, versionId, "refObj", n) : n-th Reference Object referring to versionId version of the fullUrl
ctx("ByMethod", method) : The count of operations to execute for the specified method
ctx("ByMethod", method, n) : The entry Index of the n-th operation to execute for the specified method
ctx("Depends", entryId, postedId) : Present if the specified entry requires the posted entry to be processed first.
ctx("Posted", entryId ) : Present when a POST entry has been processed (used for circular reference management)
ctx("Circular", entryId ) : Present when a POST entry has been processed but a prerequisite has not. It will be updated at the end
ctx("Conditional", entryId) : Present when a POST or PUT entry in a transaction bundle contains conditional references that require resolution
classmethod ResolveReferencesImpl(pService As HS.FHIRServer.API.Service, pRequest As HS.FHIRServer.API.Data.Request, pBundleType As %String, ByRef visitContext)
@API.Overridable
Implementation specific method to update stored FHIR resources after Circular and Conditional references have been resolved.
Must be implemented as the references have only been updated in memory in the visitContext at this point.
After all resources have been POSTed/PUT once in ExecuteBundleMain(), any Circular and Conditional references are corrected
in-memory in the visitContext by updating the reference objects. The updated JSON for the entries still needs to be propagated
to the FHIR server's storage via in-place updates (avoid incrementing the version etc as this is part of a single transaction).
See top of class for full visitContext info
visitContext("Circular", entryId ) : Present when a POST entry has been processed but a prerequisite has not. It will be updated at the end
visitContext("Conditional", entryId) : Present when a POST or PUT entry in a transaction bundle contains conditional references that require resolution
classmethod dispatchRequest(pService As HS.FHIRServer.API.Service, pRequest As HS.FHIRServer.API.Data.Request, pResponse As HS.FHIRServer.API.Data.Response, pBundleType As %String, ByRef visitContext)
classmethod prepareRequest(pService As HS.FHIRServer.API.Service, pTransRequest As HS.FHIRServer.API.Data.Request, ByRef visitContext, entryObj As %DynamicObject) as HS.FHIRServer.API.Data.Request