AWS Builder Center

Building CareSync: An Autonomous Eldercare Medication Safety Platform with AWS Cedar and Serverless Architecture

Learn how we built CareSync for the AWS First Commit Hackathon to tackle preventable geriatric adverse drug reactions. Discover how we combined the open-source AWS Cedar Policy Engine for zero-trust proxy authorization with live openFDA Clinical RAG, Amazon SNS emergency alerting, and a circadian chronotherapy scheduler.

Building CareSync: An Autonomous Eldercare Medication Safety Platform with AWS Cedar and Serverless Architecture

Every year, more than 1.5 million elderly individuals suffer preventable adverse drug events caused by polypharmacy - managing multiple prescriptions across different specialists without coordinated safety oversight. For elderly patients like 78-year-old Roberta ("Grandma Bob"), taking an over-the-counter NSAID for knee arthritis while already prescribed an ACE inhibitor can silently trigger acute renal failure.
To solve this critical challenge, we built CareSync for the AWS First Commit Hackathon. CareSync is an autonomous, policy-governed medication safety and circadian chronotherapy platform that turns doctor voice notes and pill bottle photos into safe daily schedules while intercepting dangerous drug-drug interactions (DDIs).
In this post, we will walk through how we architected CareSync using the AWS Cedar Policy Engine, AWS SAM Local, AWS Lambda, Amazon SNS, and a live openFDA Clinical RAG pipeline.



The Architectural Challenge

Elderly medication management has three distinct failure points:
  1. Unprotected Medical Data: Family members, caregivers, and visiting nurses need selective access to regimens without exposing sensitive medical records to unauthorized parties.
  1. Delayed Drug Conflict Interception: Pharmacological interactions often go unnoticed until a patient is hospitalized.
  1. Regimen Non-Adherence: Seniors forget complex dosing schedules, and families are left unaware when critical doses are skipped.
To tackle these challenges, CareSync brings together zero-trust security, real-time clinical intelligence, and multi-tier emergency notifications.



1. Zero-Trust Access Control with AWS Cedar

Healthcare applications must guarantee least-privilege access. We implemented authorization using AWS's open-source Cedar Policy Engine ( policies.cedar ).
Every API invocation passes through Cedar authorization before any clinical history or schedule is read or updated:
// Permit verified healthcare proxies to view records and log adherence
permit (
principal,
action in [Action::"ViewPatientRecord", Action::"UpdateAdherence"],
resource
)
when {
principal in resource.authorized_family
};
When an authorized daughter ( User::Alice ) requests Grandma Bob's records, Cedar evaluates the relationship in sub-millisecond time and permits access. If an unauthorized caller ( User::Eve ) attempts access, Cedar immediately blocks the request with an immutable HTTP 403 Forbidden security diagnostic barrier.



2. Clinical RAG Powered by openFDA

Instead of relying on static mock databases, CareSync features a real-time Clinical Retrieval-Augmented Generation (RAG) engine directly integrated with the live US Food and Drug Administration (openFDA) API ( api.fda.gov/drug/label.json ).
When a new medication (e.g., Ibuprofen 400mg) is introduced:
  • Live Label Ingestion: CareSync fetches official FDA Structured Product Label monographs and DailyMed citations.
  • Black Box Warning Parsing: Automatically flags severe risks like cardiovascular events and gastrointestinal bleeding.
  • Geriatric Clearance Analysis: Evaluates renal and hepatic filtration risks specific to seniors.
  • Active Regimen Cross-Check: Detects that compounding Ibuprofen with Bob's Lisinopril attenuates blood pressure control and impairs kidney function, immediately advising safer clinical alternatives (e.g., Acetaminophen).



3. Friction-Free Intake: Ambient Speech & Computer Vision OCR

To eliminate manual data entry errors for elderly users and busy nurses, CareSync offers two natural input channels:
  • Ambient Microphone Dictation: Uses the browser's native Web Speech API to transcribe natural doctor dictation directly into clinical notes in real time.
  • Prescription Bottle OCR Scanner: Uses client-side computer vision to extract drug names, strengths, and administration instructions from pill bottle photos and automatically schedules them with one click.



4. Circadian Chronotherapy & Amazon SNS Escalations

Drugs work best when aligned with biological rhythms. CareSync organizes medications into four pharmacokinetic windows:
  • Morning (08:00 AM): Daily maintenance & blood pressure control.
  • Afternoon (01:00 PM): Nutritional supplements & midday therapy.
  • Evening (07:00 PM): Lipid-lowering agents with dinner.
  • Bedtime (10:00 PM): Sleep aids and nocturnal pressure agents.
Dose adherence is tracked with persistent checkmarks backed by a disk database engine. If a critical morning dose is missed, CareSync activates its Smart Escalation Ladder:
  • Tier 1 (T + 0 min): A gentle harmonic audio chime plays on the bedside tablet.
  • Tier 2 (T + 15 min): A high-priority push notification is dispatched to the family caregiver's smartphone.
  • Tier 3 (T + 45 min): An automated emergency alert is broadcast to designated contacts via Amazon SNS ( arn:aws:sns:...:caresync-emergency-alerts ).



Serverless Cloud Infrastructure with AWS SAM

CareSync is defined as infrastructure-as-code using AWS SAM ( template.yaml ), allowing rapid local testing via  sam local start-api  and seamless cloud deployment:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: CareSync Serverless Eldercare Architecture

Resources:
CareSyncApiFunction:
Type: AWS::Serverless::Function
Properties:
Handler: dist/main.handler
Runtime: nodejs20.x
Timeout: 30
MemorySize: 512
Events:
ApiEvent:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY



What We Learned

Building CareSync during the AWS First Commit Hackathon gave us hands-on experience with technologies we hadn't combined before:
  • Cedar Policy Modeling: Expressing real-world healthcare proxy relationships cleanly in Cedar's declarative syntax proved significantly faster and less error-prone than traditional imperatively coded role checks.
  • Dynamic Clinical RAG: Normalizing brand and generic drug nomenclature dynamically against the openFDA API taught us the power of grounding LLM and agent outputs in authoritative public medical registries.
  • Serverless Speed: Pairing modern TypeScript with Node.js 20 on AWS Lambda enabled sub-150ms cold starts and rapid local iteration with AWS SAM.



Conclusion & Open Source

CareSync demonstrates how combining the AWS Cedar Policy Engine, serverless cloud primitives, and authoritative clinical APIs can transform geriatric care from reactive crisis management into proactive, home-based safety.
Check out our open-source codebase on GitHub:  GitHub Repository: ADITYASINGH1206/AWS-First-Commit  (Licensed under MIT)
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article