Fetches full EMR documents by ID from patient_charts and formats them
into a single context string using EMRDocumentFormatter.
Returns empty string if document count exceeds MAX_FULL_EMR_DOCUMENTS
to avoid blowing up context window.
Used to bypass Pinecone chunked retrieval when full document text is needed.
Note: v1 also looked up the facility timezone via the chart's integration
and forwarded it to EMRDocumentFormatter.format as
metadata.facilityTimeZone. v2's DocumentFormatMetadata no longer carries
that field (timezone handling has been hoisted out of the formatter), so the
lookup was dropped during the port. Reintroduce a v2-native equivalent if
EMR document timestamps need facility-local rendering again.
Fetches full EMR documents by ID from patient_charts and formats them into a single context string using EMRDocumentFormatter.
Returns empty string if document count exceeds MAX_FULL_EMR_DOCUMENTS to avoid blowing up context window.
Used to bypass Pinecone chunked retrieval when full document text is needed.
Note: v1 also looked up the facility timezone via the chart's integration and forwarded it to
EMRDocumentFormatter.formatasmetadata.facilityTimeZone. v2'sDocumentFormatMetadatano longer carries that field (timezone handling has been hoisted out of the formatter), so the lookup was dropped during the port. Reintroduce a v2-native equivalent if EMR document timestamps need facility-local rendering again.