None of this is a complaint about sandboxes. A sandbox holds test data, and test data is well behaved whereas real records are not. This post is about that gap: what a vendor sandbox can confirm, what only production can tell you, and how we tested against real data without anyone on our team reading a patient record.
A flexible modular architecture.
The task was to pull a patient’s clinical summary out of the EHR and hand it to an AI workflow downstream. The client’s customers ran on two EHRs: Epic and Cerner (Oracle Health).We started with a common FHIR library for everything the two platforms shared, mainly authentication and authorization through SMART on FHIR. The service proves who it is with a signed key and receives a short-lived access token. No user logs in and no consent screen appears.
On top of that sit two clients, one for Epic and one for Cerner. A configuration setting decides which client runs. The overall flow stays the same, and each vendor’s quirks stay inside its own client.
That separation helps when we add multiple strategies specific for Cerner or Epic.
Surprise 1: Some Sandbox APIs ignored date ranges
At the time of our testing, the sandbox APIs for Cerner took date ranges as parameters but did not respect them. Both the endpoints to extract a patient’s Continuity of Care Document (CCD) as well as the MAR (Medication Administration Record) returned complete documents irrespective of the date range set in the parameter. This meant we had to go into production blind, as we were not sure if this was just a sandbox issue.Turned out production worked properly but we had to open the CCDs to confirm.
Surprise 2: Documents that took too long
As per our flow, we first retrieved a Continuity of Care Document (CCD) from the vendor’s auto-generated document endpoint. A CCD is a clinical summary in C-CDA XML. It comes through the EHR integration, but it is not a native FHIR resource. The test data in sandbox is simply not representative of the complexity and length of production data.While everything worked smoothly in the sandbox, in production we realized that the system was set up to create the CCD at runtime, when requested. Some of these documents were large enough that the request timed out. We had to change our flow to an async pattern, which would then go back to get the document once created.
The fetch still failed for some documents that were simply too big. So we had to add adaptive date filters for such cases to restrict the data that could come through. We started with a broader date range and progressively reduced the date range till we could successfully retrieve the CCD
Surprise 3: Document arrived, but too big to use
A document that arrives is not yet a document you can use. The AI step downstream has a limited context window, and a CCD could be retrieved successfully and still carry too many tokens to fit.So we counted the tokens in every retrieved document. Too many tokens triggered the same date-range filtered retrieval.
There were cases where even the smallest time-window document still had too many tokens. In that scenario we extracted specific pre-defined nodes from the CCD.
Narrowing the date range and trimming the content were two separate tools used to shrink the context into an token count
Verifying against production, without reading patient data
Some of these fixes could only be confirmed on real records like whether date range is being respected in the api calls. Nobody on a build team should be browsing patient records. That holds true irrespective of whether the development team sits down the corridor from the hospital or remotely at their office.So for each situation the sandbox could not reproduce, we built a small parameterized test for production. Someone at the client’s end who was already authorized to see the data ran one command, looked at the result and gave us a go-ahead. It took them minutes, and we needed it only a handful of times.
On our side we worked from logs. They recorded how a document was retrieved and handled: which request timed out, which strategy worked, which date window was used and what the token count was. Where a log line could carry anything sensitive, we redacted it first.
What we would tell a team starting with Epic/Cerner Integration:
If you are about to take an EHR integration from sandbox to production:- Treat the sandbox as proof of the handshake. It shows that you can authenticate and form a valid request. It does not show how real data behaves.
- Design for the largest record, not the average one. Timeouts and oversized documents come from the patients with the most history.
- Plan for PHI. Some checks can only be done by someone looking at the retrieved data, and that data may contain PHI. Decide early who that person is and how they will do it. These are medical records, and the details matter.
- Log how a document was handled, not what it contained. Timeouts, retries, date windows and token counts are enough to diagnose a failure. Clinical content does not need to be in the logs.
- Don’t assume one vendor’s behavior applies to the other. Epic follows the same architecture in our build, but the CCD and MAR behavior described here is Cerner’s.
At Cennest, we build SMART on FHIR integrations on Epic and Cerner, and the AI workflows that sit on top of them. If you are taking an integration from sandbox to production, we'd love to compare notes.Team Cennest
