Thanks for the reply, Dan!
I feel I didn't do a good job of describing what I'm thinking. (I'm new to web development, so all the pieces and parts aren't necessarily clear yet.)
As I see it, the examples you sent are for web apps where the web app itself has a front-end and a back-end layer, but it's all quite well integrated such that the app can easily respond to transactions on the server (such as SMART oauth or FHIR calls) with page re-directs and user prompts as necessary. Front-end and back-end are a unified whole.
The scenario I was thinking of was one where the web app is it's own self-contained entity (possibly with a front-end and a back-end), and there is a separate and distinct REST layer that the web app can query -- but which has no direct control over the way the web app works. In this scenario, the web app would query the REST layer for data for a particular patient. This data to be returined might include patient data from the EHR FHIR server combined with other non-EHR data and analytics. In other words, the REST layer -- not the web app -- would be responsible for querying the EHR FHIR server. Does that make sense?
Questions that come to mind in this example are:
(1) If SMART authentication and patient selection occur in the web app, is it feasible to send the EHR OAuth token to the REST layer to have the REST layer query the EHR FHIR server? (Or does the REST layer need to authenticate with the EHR separately?)
(2) If we do this, would it even work, or would the EHR servers complain about the origin of the FHIR calls (given that they'd be coming from the REST layer rather than from the web app)?
(3) Is there a better way of doing this, or is the whole idea fundamentally wrong?
BTW, I am aware that SMART can be used by backend services (as described here:
http://docs.smarthealthit.org/authorization/backend-services/). But in this particular case it seems one needs to have permission to access the entire patient population in the EHR FHIR server, rather than just the records of a selected patient. (While that might be possible if a SMART app legitimately needs to access all patient data for analysis, it would be harder to justify for apps that only work with single-patient data.)
I know I'm probably not explaining it well. Hope it makes some sense.
Thanks,
Greg