Back

AI clinical documentation improving encounter intelligence for Mediportal

Deveshi Dabbawala

August 31, 2026
Table of contents

Mediportal is a healthcare technology platform that supports digital clinical workflows through patient and encounter data, clinical APIs, and its existing user interface. Its platform provides access to encounter details and longitudinal patient records, while supporting the storage and delivery of clinical summaries for healthcare professionals and patients. The AI clinical documentation service extends this existing environment with automated encounter summarization and clinical risk intelligence without replacing Mediportal as the primary clinical system.

Problem: Fragmented clinical data limited AI clinical documentation

Mediportal already exposed encounter notes and longitudinal patient records through its clinical APIs, but using this information for AI clinical documentation required a controlled intelligence layer. The system needed to combine encounter and patient information into a consistent clinical context, preserve important medical details such as medications, allergies, assessment codes, CPT lines, and demographics, while removing PHI such as names, phone numbers, emails, and SSNs before free text reached the LLM.

The clinical workflow also required separate outputs for providers and patients, deterministic medication-related risk detection, external citations for identified risks, clear handling of incomplete reference lookups, and reliable write-back into Mediportal. The service also needed synchronous and asynchronous processing so full model latency did not block every request.

Solution: AI clinical documentation for encounter summaries and risk intelligence

GoML developed the AI clinical documentation service using Content Generation blueprint, supported by reusable clinical data ingestion, processing, and integration components. The service fetches encounter and patient data from Mediportal, converts it into a structured ClinicalContext, scrubs PHI before LLM processing, and runs summarization and deterministic clinical risk detection in parallel. The Content Generation blueprint supports the generation of structured provider summaries and patient-friendly summaries through AWS Bedrock.

The service returns structured JSON containing provider and patient summaries, risk alerts, supporting references, verification status, and processing timings. Complete results can also be written back into Mediportal through StoreEncounterSummary.

AI Matic delivery

GoML used the AI Matic Content Generation blueprint as the delivery foundation for Mediportal’s AI clinical documentation service. The blueprint supported structured provider and patient summary generation, while the implementation added clinical context normalization, PHI controls, deterministic risk detection, asynchronous processing, and Mediportal write-back.

The AWS AI infrastructure includes AWS Bedrock for clinical summarization, AWS Lambda for serverless and asynchronous processing, Amazon ECR for container delivery, Amazon Comprehend Medical for optional clinical PHI processing, Amazon Cognito for authentication, and Amazon CloudWatch for monitoring.

AI Matic delivery metrics

  • Average TTFV: 21 days
  • Average person-days saved: 5 days
  • Average customization: 100%

AI clinical documentation through structured clinical context

The service first converts Mediportal encounter and patient information into a normalized AI-ready clinical context.

The context preserves:

  • Encounter notes
  • Assessment and ICD-10 codes
  • Evaluation and Management and CPT information
  • Patient demographics
  • Medications with dosage, strength, route, and dates
  • Allergies
  • Prior encounter context
  • Documents
  • Data-quality alerts

Medication normalization also preserves distinct doses and maps Mediportal medication end dates into a standardized end_date field rather than deduplicating medications by name alone.

PHI-safe AI clinical documentation

Clinical information sent through the LLM path passes through a dedicated PHI-scrubbing layer.

The implementation uses:

  • Regex-based PHI redaction
  • Optional Amazon Comprehend Medical
  • Removal of names
  • Removal of phone numbers
  • Removal of email addresses
  • Removal of SSNs

Structured date of birth and age remain available under the client-defined rule.

This supports AI clinical documentation while controlling which identifying information reaches the generative AI layer.

Provider and patient AI clinical documentation

AWS Bedrock powers the summarization service.

The same clinical context produces two structured outputs:

  • Provider summary with formal clinical sections for clinician review
  • Patient summary with plain-language sections for the patient

The workflow also includes safeguards against generating unsupported visit documentation. If encounter documentation is empty, the service must not create SOAP content solely from historical chart information.

Deterministic clinical risk intelligence

The risk layer operates separately from the AI clinical documentation workflow.

The service checks for:

  • Medication-allergy signals
  • Drug-related interaction signals
  • Drug identity and class information
  • Label-based risk information
  • Supporting literature and reference citations

Risk matching is deterministic and uses sources including RxNorm, RxClass, openFDA, DailyMed, and PubMed. The LLM does not invent drug-drug pairs.

The output also includes risk_verification so downstream users can distinguish between a true no-alert result and a case where external reference checks could not be completed.

Parallel AI clinical documentation workflow

Summarization and risk detection run in parallel after the clinical data has been fetched, normalized, and scrubbed.

The synchronous workflow:

  • Authenticates the caller
  • Obtains a Mediportal OAuth token
  • Fetches encounter and patient data
  • Normalizes the clinical context
  • Scrubs PHI
  • Runs summarization and risk detection in parallel
  • Attaches summary references
  • Returns complete or partial structured JSON
  • Optionally writes a complete result back to Mediportal

If one of the summary or risk processes fails, the service can still return HTTP 200 with result_status=partial instead of discarding the entire response.

Asynchronous AI clinical documentation processing

For AWS Lambda deployments, Mediportal also supports an asynchronous encounter intelligence workflow.

  • Returns an accepted response and job ID immediately  
  • Avoids waiting for full model processing  
  • Uses Lambda Event invocation for background processing  
  • Generates encounter intelligence asynchronously  
  • Stores the completed summary in MediPortal  
  • Returns the HTTP response within a few seconds  
  • Final summary is typically available in 30 to 90 seconds

Mediportal summary write-back

The service remains stateless for primary encounter-summary storage. Mediportal remains the canonical persistence layer.

When a result is complete and write-back is enabled, StoreEncounterSummary receives:

  • Provider encounter summary
  • Patient encounter summary
  • Clinical risk and review text

Optional DynamoDB storage is limited to caching reference data for external drug APIs rather than storing primary clinical summaries.

Infrastructure and deployment for AI clinical documentation

The AI clinical documentation service uses an AWS serverless and container-based deployment stack.

Key components include:

  • AWS Bedrock
  • AWS Lambda
  • Amazon ECR
  • Amazon Comprehend Medical
  • Amazon Cognito
  • Amazon CloudWatch
  • FastAPI
  • Mangum
  • Pydantic
  • Python 3.11+
  • Azure DevOps

Security and authentication

  • Supports API key, bearer token, and JWT authentication  
  • Uses X-API-Key for inbound UAT requests  
  • Uses OAuth2 client credentials for MediPortal access  
  • Applies least-privilege IAM permissions for AWS services  
  • Secures Bedrock, Comprehend Medical, ECR, and CloudWatch access  
  • Supports asynchronous Lambda self-invocation

Quality assurance for AI clinical documentation

Testing focuses on clinical data preservation, privacy controls, encounter intelligence output, asynchronous processing, and Mediportal write-back.

Validation includes:

  • Health and readiness checks
  • Medication, allergy, and lab preservation
  • Medication end-date normalization
  • Preservation of distinct medication doses
  • E&M and CPT preservation
  • PHI scrubbing on the LLM path
  • Schema-valid provider and patient summaries
  • Async accepted response and job ID
  • Successful Mediportal summary storage
  • Visibility of encounter-history failures through data-quality alerts

Impact

  • Immediate async acknowledgement
  • 10-40 seconds for typical synchronous encounter intelligence
  • 30-90 seconds for asynchronous generation and storage
  • Parallel summary and risk processing
  • Separate provider and patient outputs
  • Partial-result handling when one processing branch fails

About

Location 

United States 

Tech stack 

AWS Bedrock, AWS Lambda, Amazon ECR, Amazon Comprehend Medical, Amazon Cognito, Amazon CloudWatch, optional Amazon DynamoDB, FastAPI, Mangum, Pydantic, Python 3.11+, Azure DevOps, RxNorm, RxClass, openFDA, DailyMed, PubMed 

Before Gen AI and after Gen AI

Area 

Before Gen AI  

After Gen AI  

Clinical data preparation 

Encounter and patient data available through Mediportal APIs 

Normalized AI-ready ClinicalContext 

Encounter summaries 

Source clinical records 

Structured provider and patient summaries through AWS Bedrock 

PHI handling 

Identifying information present in source payloads 

LLM-bound free text scrubbed for names, phones, emails, and SSNs 

Clinical risk review 

Source medication and allergy information 

Deterministic risk alerts with citations and verification status 

Processing workflow 

Standard request-response integration 

Synchronous processing plus asynchronous ACK 

Summary persistence 

Clinical data stored in Mediportal 

Completed AI summaries written back through StoreEncounterSummary 

“With MediPortal’s AI clinical documentation service, encounter and patient data is transformed into structured provider summaries, patient-friendly explanations, and citation-backed clinical risk signals while MediPortal remains the system of record.”

Prashanna Rao, Head of Engineering, GoML

Key takeaways for AI clinical documentation

Common challenges

  • Clinical data needs normalization before LLM processing
  • PHI requires dedicated controls
  • Medication risk detection should remain deterministic
  • External reference failures must be distinguishable from genuine no-risk results

Practical guidance

  • Preserve clinically relevant codes and medication details
  • Generate separate provider and patient outputs
  • Keep risk detection separate from LLM generation
  • Return partial results when one processing branch fails
  • Use asynchronous processing when model latency should not block the caller
  • Write completed summaries back into the existing clinical workflow

Ready to build AI clinical documentation systems

Partner with GoML to build secure AI clinical documentation systems for healthcare workflows, powered by the AI Matic platform.

Outcomes

10-40
Seconds for typical synchronous encounter intelligence
30-90
Seconds for asynchronous generation and storage
80%
Immediate async acknowledgement