I'm currently working on an app that can communicate with Epic using SMART on FHIR, but I'm running into some issues. I'm currently testing it against the Epic Testing Sandbox, trying to get all the features working.
I managed to get OAuth2 working and when I get the Access Token I also get an 'encounter' value. The documentation mentions that this is the FHIR ID of the encounter.
However, when I use this Encounter Id against the Encounter.Read endpoint, I get a response saying it can't find the Encounter.
I also tried getting the Encounter using the Encounter.Search endpoint, which has an identifier parameter. But this parameter requires a "code system" portion and I have no idea what to enter here...?
I tried using the same endpoint but with only the patient parameter, passing the patient value I get from the OAuth2 process and it returns the whole list of Encounters just fine.
What I did notice here was that the Encounter Ids had a different format than the Encounter Id passed by the OAuth2 process.
I noticed that on the Open Epic site that you can also launch using an app called "SMART on FHIR test", provided by Epic themselves. This results in a page showing all the information of the selected patient, including the Encounter Id as used within Epic itself.
The Encounter ID Passed by the OAuth2 process: TAqTmwSWejWw52Ksfl2zlaiKfIbqjpN1CXEL68zfvJLsB
The Encounter ID used internally in Epic: eVffiE7SavpOc0PtATuBQWg3
I'm completely stumped as to how this is supposed to work...
Can anyone tell me the proper way to use the Encounter ID passed by the OAuth2 process to get the Encounter within Epic?
OP here.
I discovered that there's a SMART of FHIR version setting within the app registered at Open Epic. This was set to DSTU2 for me, which was the reason why I was getting DSTU2 FHIR ID's after the OAuth2 process.
I changed this version setting to R4 and I'm now getting R4 FHIR ID's after the OAuth2 process.