I'll take a look at those docs, but I really like having direct access to my data so I can use it however I need (for instance in my custom dashboard, in a weekly report, manipulate it in Excel, etc, etc).  I don't want my data to be trapped in Zen or require Cache code to retrieve.

I actually have a SQL query that will give the average response time of a request for a given date range and message type:

SELECT Name, AVG(ResponseTime) as AvgResponse FROM (
SELECT
        li.SessionId,
        li.name,
        datediff(ms,min(li.TimeCreated),max(lo.TimeCreated)) as ResponseTime
FROM
    (Select h1.SessionId, TimeCreated, SAMLData_Organization, m1.name FROM ens.messageheader h1,HS_Message.XMLMessage m1 WHERE h1.MessageBodyId = m1.id) li
    LEFT JOIN (Select h2.SessionId, TimeCreated FROM ens.messageheader h2,HS_Message.XMLMessage m2 WHERE h2.MessageBodyId = m2.id) lo
    ON li.SessionId = lo.SessionId
WHERE li.TimeCreated >= '2016-10-01' AND li.TimeCreated < '2016-10-02'
AND Name = 'XDSB_QUERYREQUEST'
GROUP BY li.SessionId
) GROUP BY Name

I didn't know he had "Information Exchange".  Are you sure he does?

I've always been told performance was the reason for using my query environment and now you're saying it's because the data might be different or out of date??

Also, I couldn't find the APIs you mentioned, can I get a link?  Are these available in Healthshare or just this new "Information Exchange" sub-product?

Thanks for the info!  I found the statement, I believe, but I'm having trouble understanding.

 

 Quit $Case(pDT
, "DT":$S(pVal?1(4N,6N,8N)
&&($E(pVal,1,4)>1700)&&($E(pVal,1,4)<2200)&&(""=$E(pVal,5,6)||($E(pVal,5,6)>0&&($E(pVal,5,6)<=12)))&&(""=$E(pVal,7,8)||($E(pVal,7,8)>0&&($E(pVal,7,8)<=$Case($E(pVal,5,6),2:29,4:30,6:30,9:30,11:30,:31)))):$$$OK
, 1:$$$ERROR($$$EnsErrGeneral,"Invalid date value '"_pVal_"' found for type '"_pDT_"' in segment "_$S($get(info("SegNum"))'="":info("SegNum")_":",1:"")_info("SegName")_", field "_info("fieldNum")_", repetition "_info("rep")_", component "_info("comp")_", subcomponent "_info("subComp")_"."))
, "DTM":$S(pVal?1(4N,6N,8N,10N,12N,14N,14N1".".4N)&&(tZ?.1(1(1"+",1"-")4N))
&&($E(pVal,1,4)>1700)&&($E(pVal,1,4)<2200)&&(""=$E(pVal,5,6)||($E(pVal,5,6)>0&&($E(pVal,5,6)<=12)))&&(""=$E(pVal,7,8)||($E(pVal,7,8)>0&&($E(pVal,7,8)<=$Case($E(pVal,5,6),2:29,4:30,6:30,9:30,11:30,:31))))
&&(""=$E(pVal,9,10)||($E(pVal,9,10)>=0&&($E(pVal,9,10)<24)))&&(""=$E(pVal,11,12)||($E(pVal,11,12)>=0&&($E(pVal,11,12)<60)))&&(""=$E(pVal,13,14)||($E(pVal,13,14)>=0&&($E(pVal,13,14)<60))):$$$OK
, 1:$$$ERROR($$$EnsErrGeneral,"Invalid date/time value '"_pVal_"' found for type '"_pDT_"' in segment "_$S($get(info("SegNum"))'="":info("SegNum")_":",1:"")_info("SegName")_", field "_info("fieldNum")_", repetition "_info("rep")_", component "_info("comp")_", subcomponent "_info("subComp")_"."))

It looks like both `DT` and `DTM` require a format similar to "20161010" but what is up with the $Case($E(pVal,5,6),2:29,4:30,6:30,9:30,11:30,:31), this makes no sense to me. And why is it part of "DT" which seems to be date without time?

Great answer.  I work at an HIE, how come I've never heard of most of the "products"?  Besides Patient Index, all these other things are new to me.  Where can I find more info on the "Information Exchange" product?  Can you purchase/implement these items separately or are they dependent upon each other?  Where does the Clinical Viewer fit into this?  How is Health Insight different that DeepSee?

Try this:

SELECT  * FROM HS_SDA3_Streamlet.Encounter WHERE SourceMRN = '12345'

(Replace 12345 with the MRN of the patient you want to list the records of)

But as Robert mentioned, Intersystems does not recommend querying the tables directly. Do you know if you have a separate query environment set up by using the healthshare Mirror funtionality?

The reason they don't recommend querying the live data directly is due to potential performance impact.  But ultimately, that decision is up to you.  

I actually have it set to e-x which should include data type validation, right?

My question really is, how does that "DT" definition define a date? There's no regex or anything.  How does it know if it should be YYYYMMDD HHMMSS or mm/dd/yy hh:mm:ss?

 

<DataType name='DT' description='Date (2.8.13)'> <DataSubType piece='1' description='Date (2.8.13)'/> </DataType> doesn't really mean anything... does it?

And just to provide some context to what I'm trying to accomplish, we have had numerous instances in the past where a customer started sending data we did not expect.  In some cases, these changes technically met the schema and in other cases it violated it but we never had our productions set up to alert on validation exceptions.  As a result of a few of these, I am currently doing a complete ADT remediation process where I am tightening the schemas and enabling alerting for  validations on all namespaces.

Is this not recommended? Do you have other input or advice?