Question
· Jul 1, 2019

Question about proper method for querying data from custom SDA3 container on Access Gateway for a patient loaded in the clinical viewer

I have created a custom container that contains medication adherence data. I want to know the best-practice way of querying the data for to display in a custom Zen page in the Clinical Viewer for a given loaded patient.

 

Let's say the custom class is called Hospital.Data.MedicationAdherenceData. Let's say the streamlet class is Hospital.SDA3.Streamlet.MedicationAdherenceData

 

I can look up the data by using the Sequence number as viewed in the HS.Viewer.Services component trace after loading up a patient in the Clinical Viewer. I do this by selecting from the custom streamlet class using "T+[sequence number]" as the aggregation key on the Access Gateway. Thus, should I just programatically generate the aggregation key on the Access Gateway (if so, how?) and query the table for the container's streamlet class for the aggregation key?

 

I read somewhere about importing the XML schema of the streamlet class to the Access gateway, but is this for accessing custom SDA3 container data or only SDA3 extensions?

 

Thanks.

Discussion (3)1
Log in or sign up to continue

Hi Cyriak, you do not need to generate the Aggregation Key, as that is done automatically when the Access Gateway fetches a patient's data.

I believe the simplest way for custom code running in the Viewer to get the Aggregation Key value would be to first get the ID of the patient object in the Viewer Cache from the CSP session:

Set tViewerPatientID = $listget(%session.Data("lastPatientId"))

(For historical reasons the value of %session.Data("lastPatientId") is a $list, though it should only ever have a single value.)

Then you would call web.SDA3.Loader:GetAgKey(), passing it the ID of the patient object to get the Aggregation Key:

Set tAgKey = ##class(web.SDA3.Loader).GetAgKey(tViewerPatientId)

GetAgKey() is documented as an API method, so it should be safe to use.

You are correct that you can then use the Aggregation Key to query for the current patient's data in the Aggregation Cache.

Does that answer your question?

Thanks so much for your reply. I greatly appreciate the information on how to get the Aggregation Key from the Viewer Cache. However, I have a question about one aspect of your reply:

You are correct that you can then use the Aggregation Key to query for the current patient's data in the Aggregation Cache.

Once I obtain the Aggregation Key, how do I go about querying the current patient's data in the Aggregation Cache? I had been thinking about querying the data from the HS_SDA3_Streamlet.Abstract table, but my understanding is that that table is located on the Edge, and so querying this data would require usage of an ECP link, which is not good practice. Is there a table I can query on the Access Gateway?


Please advise.

Thanks.

Hi Cyriak, the HS_SDA3_Streamlet.Abstract table is used on *both* the Edge *and* the Access Gateway.  When a patient's data is fetched on the Access Gateway, it is stored in this table temporarily, until the CSP session that initiated the fetch has ended, plus however long it takes for the session cleanup process to fire (usually a few minutes).  So once you've loaded a patient's record into the Viewer and you have their Aggregation Key, you can use that to query for their data on the Access Gateway.