AWS Builder Center
AIdeas: Perspective — Hearing What Mental Health Patients Can't Say. Showing What They Can't See.

AIdeas: Perspective — Hearing What Mental Health Patients Can't Say. Showing What They Can't See.

Perspective is an AI-powered companion that hears what mental health patients can't say — and shows what they can't see. Patients write or speak freely. The AI extracts emotions, symptoms, cognitive distortions, and triggers they couldn't identify on their own. Then it visualizes their progress, generates clinical summaries for their doctors, and uses their own history to challenge the distorted thinking that makes them want to quit treatment.

Software engineer and accessibility advocate
App Category: Social Impact

The Problem No One Designs For

A patient walks into a 15-minute appointment. The doctor asks, "How have the last two weeks been?" The patient says, "Sometimes I don't feel well, but right now I'm fine. It just comes and goes."
By the time they're sitting in the office, the worst has passed. They can't accurately describe what happened in between — and they're unintentionally misrepresenting how they actually felt.
The doctor suggests tracking. The patient tries paper, but forgets most days. On the days they do write, they can't describe what they're feeling — just that something was wrong. So they look for apps.
Every mood tracker has the same fundamental flaw: it assumes the patient knows how they feel and how intensely they feel it. "Rate your mood: happy, sad, anxious, angry." Then: "On a scale of 1–10, how anxious are you?" But the patient stares at the screen because they genuinely do not know — and the scales themselves have no clinical anchor. A "6" in one app means something completely different from a "6" in another, and neither maps to anything a clinician can interpret.
That's not a personal failing. Alexithymia — the inability to identify and describe one's own emotions — affects up to 32% of adults with depression and 79% of those with anxiety disorders. The very conditions being treated impair the patient's ability to participate in their own treatment.
How do you track what you can't identify? How do you remember what your condition makes you forget? How do you quantify something you can't describe, on a scale that means nothing?
That's the problem Perspective was built to solve.

My Vision

Perspective is an AI-powered companion for mental health patients who are actively in treatment — people managing anxiety, panic disorder, depression, bipolar disorder, and other conditions where the treatment journey spans months or years.
It replaces unreliable memory with structured, AI-analyzed data that patients and clinicians can actually use.
A patient simply writes what happened — a journal entry, a quick note after a panic attack, a few sentences at 2 AM when they can't sleep. Perspective's AI extracts the clinical picture automatically: emotions, symptoms, cognitive distortions, triggers, neurovegetative signals (sleep, appetite, energy), medication adherence, avoidance behaviors, and two dimensions of severity — emotional intensity anchored to SUDS (how bad it feels) and functional impact anchored to WSAS (how much it disrupts daily life). These are things the patient often cannot identify themselves.
Over time, it builds a longitudinal record that:
  • Shows real trends the patient can't see on their own
  • Generates structured twelve-section clinical summaries for appointments, with Patient Health Questionnaire-9 (PHQ-9) and Generalized Anxiety Disorder-7 (GAD-7) approximations
  • Uses the patient's own historical data to gently challenge the distorted thinking that makes them want to quit treatment
  • Detects early relapse signals across four condition groups — internalizing (depression, anxiety, PTSD, OCD), mood cycling (bipolar), psychosis spectrum, and eating behavior — when a diagnosis is captured from the patient's own journal entries. Perspective never infers a diagnosis; it captures them from what the patient writes about their clinician's assessment.
  • Adapts its AI behavior during medication changes, dose adequacy windows, and post-stressor periods
  • Tracks not just what patients write, but when they stop — because silence is a clinical signal too
This isn't replacing clinical care. It's bridging the gap between appointments with data the patient couldn't provide on their own.

Why This Matters

Mental health conditions come with a cruel irony: the symptoms themselves sabotage the patient's ability to engage with treatment.

The Clinical Data Gap

ProblemImpactScale
Memory gaps & brain fogPatients can't recall two weeks of symptoms in a 15-minute appointment. Clinicians make treatment decisions on fragments.Anxiety, depression, and panic disorder all impair working memory and recall
Difficulty identifying emotionsMood trackers ask patients to label feelings they genuinely cannot identifyAlexithymia affects up to 32% of depressed adults, 79% of those with anxiety
Unanchored intensity scalesApps ask "rate your anxiety 1–10" but the scales have no clinical basis. A "7" means nothing to a clinician and nothing consistent across patients.No standard mood-tracking app maps to validated clinical instruments
Cognitive distortionsSystematic thinking errors convince patients treatment has failed when it hasn't~50% of patients drop out of mental health treatment prematurely
Medication abandonmentPatients quit during vulnerable adjustment periods28% stop antidepressants within month one; 44% within three months
Invisible deteriorationNeurovegetative signals (sleep, appetite, energy) change weeks before mood does — but no one is tracking them between appointmentsLeading indicators of psychiatric deterioration are only captured during clinical visits
Delayed interventionPatients endure weeks of worsening symptoms between appointments because nothing tells them to seek help sooner. By the time they see their doctor, the worst has passed — and the doctor says "you should have come in earlier."The gap between appointments is where treatment fails silently
The consequences are measurable: patients who continue treatment have an 18% relapse rate compared to 37% for those who discontinue. Keeping patients in treatment literally changes outcomes.
The scale of the problem is massive: over 300 million people worldwide live with depression, and over 280 million with anxiety disorders. In the US alone, roughly 21 million adults experienced at least one major depressive episode in the past year. Every one of them faces the same data gap between appointments. Perspective is designed for any patient in active treatment who journals — and the barrier to entry is writing a single sentence.

How Perspective Solves This

Perspective addresses this clinical data gap across three dimensions: giving clinicians the data patients can't provide, keeping patients in treatment when their own thinking tells them to quit, and catching deterioration before the patient or doctor notices it.
Structured data the patient can't provide. Perspective generates twelve-section clinical summaries covering neurovegetative trajectories, medication adherence, symptom trends, crisis flags, distortion patterns, avoidance behaviors, treatment correlations with before/after analysis, PHQ-9 approximation with per-item justification, and the patient's own words. Instead of starting an appointment with "How have you been?", a clinician can start with: "I see your panic attacks shifted from mornings to evenings after the medication change, and your overall intensity has been trending down. Let's talk about what happened in week three."
Adaptive AI that fights treatment dropout. When the AI detects a cognitive distortion in a journal entry, it doesn't just label it — it reframes it using the patient's own historical data. If a patient writes, "I'm back to square one, nothing has changed," Perspective surfaces their own records showing that three months ago their emotional intensity averaged SUDS 9.0 and this month it's SUDS 5.0.
Here's what a reframe looks like in practice. A patient writes: "I've been doing this for six months and I'm exactly where I started. Nothing works." The AI detects all-or-nothing thinking. It retrieves three semantically similar past entries from the Retrieval-Augmented Generation (RAG) Knowledge Base. The response: "You wrote something similar to this three months ago — 'I feel like I'm going backwards.' But your own entries in the following weeks showed your panic attacks dropped from six that week to two. Your data tells a different story than your current feeling."
The patient never sees the label "all-or-nothing thinking." They see their own words, their own timeline, and their own documented experience — used as evidence against the distortion telling them to quit. It's not a generic chatbot saying "things will get better." It's a tool that knows you.
Proactive relapse detection that doesn't wait for the next appointment. Perspective is the only mental health journaling app that tells a patient when to call their doctor sooner — and it doesn't wait for them to open the app to do it. After every journal entry, the system runs a calendar-day-based relapse risk check. If a patient has had 3 or more distinct days of sustained high distress in the past 10 days — corroborated by neurovegetative signals like poor sleep or low energy — it sets a flag on their profile and sends a proactive push notification that night via AWS EventBridge. The message is warm and specific: "Things have been harder lately. You don't need to wait for your next appointment." No diagnosis, no alarm. Just an open door.
The alert appears as a dismissible banner on the home screen — the patient must tap "I've seen this" before it disappears, ensuring the message was actually read. A 5-day cooldown prevents notification spam. The relapse risk is suppressed entirely during the initial medication adjustment window (days 0–14), because new medication side effects mimic deterioration and would trigger false positives. This proactive escalation fires even when the patient has gone silent.
Mental health recovery is not linear — it takes months, sometimes years. There are setbacks, plateaus, and relapses that are a normal part of the process. But when a patient with depression has a bad week, their distorted thinking tells them they've made no progress at all. That's when they stop medication. Cancel therapy. Quit. Perspective fights this directly — with their own data.

How I Built This

Research, Design, and Development with Kiro

Kiro was the development environment where research, design, and implementation happened simultaneously — not as separate phases, but as a continuous feedback loop.
I connected to PubMed and Consensus via Model Context Protocol (MCP) integrations directly within Kiro, which allowed me to systematically review the literature on digital phenotyping, linguistic biomarkers, transdiagnostic models, and validated clinical instruments while designing the system's specs. A research finding about neurovegetative signals being the leading indicators of psychiatric deterioration would immediately inform the extraction schema design. The discovery that distortion frequency predicts CBT outcomes (N=1,402) directly shaped the distortion density scoring algorithm. Every extraction field, risk threshold, and treatment window in Perspective is grounded in peer-reviewed evidence — not intuition.
When AWS infrastructure issues arose — OpenSearch Serverless SigV4 signing failures, CloudFormation cross-stack export deadlocks, Amazon Bedrock model access provisioning — I connected to the AWS MCP to get targeted guidance on service-specific debugging, reducing resolution time on problems that aren't covered in getting-started documentation.
I described Perspective's requirements in natural language — the patient data model, the AI extraction pipeline, the authentication flow — and Kiro generated structured specs (requirements.md, design.md, tasks.md) that broke the system into discrete implementation tasks. This spec-driven workflow forced me to think through the entire data flow before writing a single Lambda function.
The project has 49 Lambda handlers across authentication, entries, progress tracking, summaries, the AI pipeline, evaluation, and scheduled tasks. Kiro scaffolded the foundational patterns — the handler decorator, the DynamoDB service abstraction, response builders, and AWS Cloud Development Kit (CDK) stack definitions — so I could focus on the hard domain-specific problems: Amazon Bedrock extraction prompts, the RAG pipeline, the reframing logic, treatment event detection, condition-aware risk algorithms, and the LLM-as-Judge evaluation system.
With six CDK stacks and 49 handlers touching shared services, drift was a constant risk. Kiro hooks automated CDK deployments on code changes — write, save, deploy. This turned a manual multi-step process into an automated workflow across all six stacks.

Core AWS Architecture

Perspective is built entirely on AWS — a serverless, event-driven system with six CDK stacks.
LayerServicePurpose
AI EngineAmazon BedrockClinical extraction, distortion detection, reframing, sustain responses, summary generation, linguistic biomarker analysis
Vector SearchAmazon OpenSearch ServerlessRAG — stores entry embeddings for semantic similarity search
RAG PipelineAmazon Bedrock Knowledge BaseManages embedding pipeline and retrieval
OrchestrationAWS Step FunctionsAI processing pipeline with 4-way parallel execution
StorageAmazon DynamoDBSingle-table design for all patient data, encrypted at rest
EncryptionAWS KMSEncryption key management for patient data
AuthAmazon CognitoAuthentication and user identity via JWT
File StorageAmazon S3PDF export storage, Knowledge Base data source
ComputeAWS Lambda (49 functions)All API endpoints, pipeline steps, scheduled tasks
SchedulingAmazon EventBridgeProactive relapse risk alerts, daily check-in notifications
NotificationsAmazon SNSPatient check-in reminders and risk alert delivery
InfrastructureAWS CDKSix stacks, fully reproducible deployment
APIAmazon API GatewayREST API with Cognito authorizer and CORS
HostingAWS AmplifyWeb demo deployment for cross-platform access
FrontendReact NativeCross-platform mobile app — warm, non-clinical design
A high level diagram of perspective architechure
Perspective Architechure

Key Architectural Decisions

The architecture wasn't chosen from a menu — each service was selected for a specific clinical reason.
Step Functions for orchestration: The AI pipeline has hard data dependencies (extraction must complete before crisis detection can run) and hard independence guarantees (crisis detection must never wait for dictionary updates). Step Functions' native parallel state with error handling per branch gives both — and the visual execution graph in the console is invaluable for debugging a seven-step clinical pipeline where a failure in any branch has patient-safety implications.
Single-table DynamoDB: Every query in Perspective is patient-scoped. A patient's entries, extractions, markers, dictionary, engagement records, and profile all share the same partition key. Single-table design means every read is a single-partition query — no joins, no cross-table lookups, predictable latency at any scale. For a system where a patient might have hundreds of entries over a year of treatment, this matters.
OpenSearch Serverless for RAG: The reframing engine needs semantic similarity search scoped to a single patient's history. OpenSearch Serverless provides vector search with per-collection access control — critical when every patient's embeddings must be isolated. The serverless model also means zero capacity management for a system where usage patterns are inherently unpredictable (patients write when they're struggling, not on a schedule).

The Intelligence Pipeline

Every journal entry flows through a seven-step pipeline with parallel execution:
Step 1 → Amazon Bedrock Extraction. The AI extracts structured clinical data from the patient's plain-language entry: emotions, symptoms, cognitive distortions, triggers, severity (anchored to SUDS and WSAS), neurovegetative signals (sleep quality, appetite, energy — with verbatim patient quotes as supporting evidence), medication adherence and side effects, avoidance behaviors, linguistic biomarkers, and treatment events. "My doctor increased my dose" is detected as a medication_change event. "The psychiatrist confirmed I have bipolar II" triggers a diagnosis_received event. The system distinguishes formal diagnosis ("my psychiatrist diagnosed me") from self-research ("I looked it up and I think I have...") — only clinician-confirmed diagnoses update the monitoring profile.
Steps 2–5 → 4-Way Parallel Execution (this cut pipeline latency by 24%):
StepParallel BranchWhat It Does
2Crisis CheckScans for suicidal ideation, self-harm indicators. Surfaces 988 Lifeline and Crisis Text Line. Safety cannot wait for less critical operations.
3Dictionary UpdateBuilds a unique clinical vocabulary per patient — terms, categories, usage counts that evolve over treatment
4Auto MarkersCreates timeline markers from detected treatment events (medication changes, therapy starts, diagnoses) with a 3-day deduplication window. Markers condition all future AI behavior.
5Conditional ResponseDetermines the appropriate response using the priority cascade below, with RAG retrieval from Amazon Bedrock Knowledge Base when reframing is triggered
The Response Mode Priority Cascade:
PriorityModeWhen It TriggersWhat Happens
1CRISISSuicidal ideation, self-harm signalsSafety resources only. No AI engagement. Real numbers to call.
2SUSTAINWithin treatment window after medication change, dose adequacy period, or post-stressor eventSupportive reinforcement — no challenges during vulnerable periods
3REFRAMECognitive distortions detectedRAG-powered challenges using the patient's own history as evidence
4NONELow-severity entriesLeft alone. Not every entry needs a response.
This prevents the system from generating unhelpful responses when the patient doesn't need them. It's what therapists do — you don't push a patient to confront distortions during a medication adjustment. You support them through it.
When a distortion is detected and REFRAME mode triggers, the Conditional Response branch retrieves the patient's most semantically similar past entries from OpenSearch and builds the reframe using their own words as evidence. A patient who writes "nothing ever changes" gets shown — through their own documented experience — that things have changed.
Step 6 → Merge. All parallel outputs are combined into a unified payload.
Step 7 → Store + Risk Detection. The full extraction is encrypted with AWS KMS and stored in DynamoDB. The relapse risk algorithm then evaluates 8 signal types across 5 condition group configurations, checking for sustained multi-day distress patterns. Engagement and gap tracking runs here too — tracking when patients stop writing and flagging the silence as a clinical signal. The entry is indexed to the Knowledge Base so future reframes can retrieve it. If crisis is detected, immediate resources are surfaced. If relapse risk is flagged, a proactive push notification via EventBridge reaches the patient even when they haven't opened the app.

The App — Designed to Feel Safe, Not Clinical

The frontend is built in React Native. The color palette is intentionally warm and non-clinical: sage greens, soft lavenders, dusty blues, and warm corals on a light beige background. Every design choice — from the rounded cards to the DM Sans typeface — was made to lower the barrier to opening the app at 2 AM when you're struggling.
Mental health apps fail when they feel like homework. Perspective is designed to feel like a safe space.
A combined image showing screen shots of Perspective's onboarding screens
Perspective onboarding screens

Journal — Just Write

A screenshot of entry creation screen in perspective
Entry creation in Perspective
No mood sliders. No emoji grids. No "rate your day 1–10." The patient just writes — whatever they're feeling, in whatever words come naturally. "I cancelled plans with my friend because I just couldn't" is enough. The AI handles the clinical extraction behind the scenes.

The Personal Symptom Dictionary

A combined photo of emotions, symptoms and triggers extracted by Perspective
Emotions, symptoms, triggers extracted by Perspective
One of Perspective's most clinically significant features is invisible to the patient: a personal symptom dictionary that learns their unique language. Standard clinical taxonomies assume patients describe their experience in textbook terms. They don't. A patient with panic disorder might describe their attacks as "teeth chattering," "the ceiling spinning," or "the fog coming down" These are the same symptoms — but a rigid taxonomy would miss them entirely.
When Perspective's AI encounters a new term, it creates a dictionary entry, classifies it (physical symptom, panic-related), and stores it per-user. On every subsequent entry, the patient's full vocabulary is injected into the extraction prompt. "Jaw shaking" maps to the same entry as "teeth chattering." Over months, the system builds a clinical vocabulary that reflects how this patient experiences their condition — not how a textbook says they should.

Clinically-Anchored Severity Scoring

An image showing Perspective Progress screens
Persective scoring on individual entry vs aggregated scoring and visualization
Where most AI mental health tools produce scores the user must simply trust, Perspective anchors every severity number to validated clinical instruments used in real therapy. Emotional intensity maps to SUDS, used by Cognitive Behavioral Therapy (CBT) and Eye Movement Desensitization and Reprocessing (EMDR) clinicians worldwide — a score of 0.65 means SUDS 6.5, "struggling to cope." Functional impact maps to WSAS, validated in 1,371 psychiatric outpatients. Distortion density is computed deterministically from the research-validated finding that distortion frequency predicts therapy outcomes (N=1,402, Behaviour Research & Therapy 2023).
When Perspective flags a relapse risk, the clinician can read: "SUDS 6.5 for three consecutive days" — not just "a score of 0.65 that we invented." This is the difference between a mental health tool and a clinical instrument.
Perspective tracks these two severity dimensions separately: how bad it feels (emotional intensity, SUDS) and how much it disrupts daily life (functional impact, WSAS). These numbers often diverge — and the gap between them is clinically significant. A patient who reports severe distress but is still showing up to work tells a different story than one reporting mild anxiety who has quietly stopped leaving the house. The system scores functional impact only on what the patient explicitly says they cancelled or avoided — not what the AI infers.

AI Response Modes — What the Patient Actually Sees

Not every entry gets the same response. The system evaluates the patient's current clinical context — treatment windows, distortion patterns, crisis signals — and selects the appropriate mode. Here's what each one looks like in practice.
CRISIS — Safety first, always.
An image showing Perspective's crisis screen
Perspective - CRISIS response
When the system detects suicidal ideation or self-harm signals, there is no AI-generated response. No reframing. No therapeutic engagement with the content. The patient sees real crisis resources immediately — the 988 Suicide & Crisis Lifeline, the Crisis Text Line (text HOME to 741741), and their own doctor's contact if on file. The event is flagged in their timeline and will appear prominently in their next doctor summary.
SUSTAIN — Support during vulnerable periods.
An Image showing sustain Perspective
Perspective - Sustain response
When a patient is within a treatment window — the first 14 days of a new medication, the dose adequacy period (weeks 4–8), or the 21 days following a major life stressor — the system doesn't challenge anything. A patient five days into a new antidepressant who writes "I don't feel any different, I don't think this is working" is not catastrophizing — they're accurate. The medication hasn't had time to work.
Instead of reframing, the system normalizes the timeline, surfaces small positive signals from recent entries — better sleep one night, a slightly longer entry suggesting more cognitive processing — and reinforces that staying engaged during this window is itself meaningful. The response might read: "You're five days into a medication change. It's completely normal not to feel a difference yet — most people don't until week two or three. But I noticed your entry yesterday mentioned sleeping through the night for the first time in a while. That's worth noting."
REFRAME — Your own data vs. your distorted thinking.
A photo with two screenshots showing a reframe response generated by perspective
Perspective - REFRAME response
When the system detects a cognitive distortion — catastrophizing, all-or-nothing thinking, personalization — outside of a treatment window, it doesn't deliver a generic motivational quote. It retrieves the patient's own past entries using RAG from the Amazon Bedrock Knowledge Base and constructs a challenge grounded in their documented experience.
A patient writes: "I've been doing this for six months and I'm exactly where I started. Nothing works." The AI detects all-or-nothing thinking. It retrieves three semantically similar past entries. The response: "You wrote something similar to this three months ago — 'I feel like I'm going backwards.' But your own entries in the following weeks showed your panic attacks dropped from six that week to two. Your data tells a different story than your current feeling."
The patient never sees the label "all-or-nothing thinking." They see their own words, their own timeline, and their own documented experience — used as evidence against the distortion telling them to quit. That's not a chatbot. That's a tool that knows you.
NONE — Knowing when to stay quiet.
A photo showing no perspective generated
No perspective generated for the user
Not every entry needs a response. When a patient logs a low-severity entry — a routine day, a brief check-in, a moment of calm — the system leaves it alone. No forced positivity, no unnecessary engagement. The entry is still fully extracted, stored, and available for future RAG retrieval. But the patient isn't interrupted with a response they don't need. This is what therapists do — they don't comment on everything. Sometimes the most clinical thing the system can do is listen.
That's not a chatbot. That's a tool that knows you.

Linguistic Biomarkers — Clinical Signals from Text Structure

Amazon Bedrock's extraction call does more than identify emotions and symptoms — it evaluates the linguistic structure of the entry itself. Four markers are extracted from text at zero incremental inference cost:
  • Filler word density (um/uh/like per 100 words) — a validated anxiety and cognitive load marker (Journal of Affective Disorders 2023)
  • Sentence fragmentation — incomplete, trailing-off sentences — a proxy for disorganized thought, one of the early signals of psychosis prodrome
  • Thought coherence — semantic looseness across a single entry, where topic shifts between sentences lack coherent connection, is a text-based correlate of the flight of ideas seen in hypomania (Psychophysiology 2022; Journal of Biomedical Informatics 2025)
  • Hedging density ("I don't know" / "maybe" per 100 words) — a rumination and uncertainty marker that tracks cognitive indecisiveness
These signals require no voice input — they're extracted from the same text the patient typed, by the same Amazon Bedrock call already running for clinical extraction. They feed directly into the condition-aware relapse risk algorithm's signal set: high filler density for the internalizing group, loose thought coherence for mood cycling, fragmented speech for psychosis spectrum.

Condition-Aware Risk Detection

An image showing potential relapse notification to perspective user
Potential relapse notification sent to user despite relatively stable emotional intensity
Perspective's condition-aware layer is grounded in the transdiagnostic "internalizing" model — the scientific consensus that depression and anxiety share the same neurobiology and therefore the same digital relapse signatures. The system monitors across four condition groups, activated only when a diagnosis is captured from the patient's own journal entries:
  1. Internalizing — covers Major Depressive Disorder (MDD), all anxiety disorders, PTSD, OCD, and BPD with a single algorithm, validated by the NESDA study (J Affective Disorders 2021) and the transdiagnostic consensus (J Consulting & Clinical Psychology 2020)
  2. Mood Cycling — bipolar variants, running both downward (depressive) and upward (activation/hypomania) detection simultaneously using DSM-5 Criterion A and Criterion B7
  3. Psychosis Spectrum — schizophrenia/schizoaffective; primary signal is functional deterioration, not emotional intensity (Barnett 2018). Patients in this group never receive AI cognitive reframing — the system overrides to SUSTAIN or NONE, because cognitive challenging is clinically inappropriate for altered-perception states.
  4. Eating Behavior — eating disorders; primary signal is appetite shift
Most mental health apps only watch for deterioration. Perspective also detects mood elevation — catching the early signs of a hypomanic episode using elevated energy and decreased sleep need with maintained energy (a distinctive marker that separates hypomania from insomnia) before the patient or their doctor would recognize it clinically. Critically, antidepressant-induced manic switch is not suppressed during the initial medication adjustment window — this is clinically urgent and must always alert (meta-analysis 2018). This approach is validated by the active MEASURE-BD trial at the VA (NCT06204705), which uses the same Ecological Momentary Assessment (EMA) + smartphone modalities to predict bipolar episodes.
Adding a new condition never requires touching core logic — only a new ConditionGroupConfig entry.

Episode Compare — Knowing When a Comparison Is Honest

An image of a screen shot showing how an entry can be compared to previous episodes
A current entry being compared to historical episodes
When Perspective finds a past episode to compare against the current entry, it doesn't just find the numerically closest match and call it done. It computes a 5-dimension weighted similarity score — emotional intensity (30%), functional impact (25%), symptom overlap (20%), distortion density (15%), and emotion overlap (10%) — and applies a recency penalty that gradually down-weights episodes older than 90 days.
Match quality is classified into tiers (strong, moderate, weak) computed from content-only distance — before recency inflation — so age doesn't misclassify a strong content match as weak. If the best available match is still not clinically meaningful (content distance >0.50), the system says so: "Your pattern is still forming. Keep logging and Perspective will surface stronger parallels over time."
An honest "I don't know yet" is more useful than a confident wrong answer.

Treatment Windows — Knowing When Not to Push

One of the system's most clinically-informed design decisions is what it doesn't do. Perspective's SUSTAIN mode covers the full critical timeline of treatment — not just the first two weeks:
  1. Initial adjustment (0–14 days after medication/therapy change) — the clinical reason: medication changes take approximately two weeks before any meaningful effect is measurable. When a patient says "I don't feel better" on day 5 of a new antidepressant, they're not catastrophizing — they're accurate. Reframing that would be both clinically wrong and damaging to trust.
  2. Dose adequacy (28–56 days after medication change) — the weeks 4–8 assessment window where the clinical question shifts from "is this tolerable?" to "is this working?"
  3. Post-stressor (0–21 days after a life event marker) — vulnerability window after job loss, bereavement, or relationship ending
During these windows, the system normalizes the timeline, surfaces small positive signals in recent entries (better sleep, got out of bed, longer entry = more processing), and reinforces that staying engaged during this window is itself meaningful. The absence of pressure to get better faster is a deliberate design choice.

Clinical Summary — Make Every Appointment Count

An image showing pdf generated summary for doctor's review
Pdf summary generated for doctor's review
The clinical summary is designed for a clinician who has 15 minutes. It opens with a three-sentence executive overview: what changed since the last period, what warrants direct clinical attention, and the overall trajectory. The detail sections surface only deviations from baseline — stable data is omitted.
Perspective maintains a strict separation between what patients see and what clinicians see — from the same underlying data. The patient-facing progress narrative speaks entirely in the patient's own language: their own words, their own patterns, gently reflected back. It never uses clinical terminology, severity scores, or distortion labels. The clinician-facing summary — generated as a shareable PDF — presents the full clinical picture.
The twelve sections, ordered by clinical priority:
  1. Clinical Overview — 3 sentences: what changed, what warrants attention, overall trajectory
  2. Neurovegetative Signals — sleep, appetite, and energy trajectory — leading indicators that often precede mood shifts
  3. Medication Experience — adherence signals, side effects, and patient sentiment toward treatment
  4. Key Metrics — entry count, average severity scores, frequency changes versus prior period
  5. Symptom Trends — per-symptom frequency and intensity, deviation-focused (stable data omitted)
  6. Notable Episodes — entries with high severity, volatility flags, or crisis signals
  7. Crisis Flags — any crisis events, prominently displayed
  8. Cognitive Patterns — most frequent distortion types with evidence quotes from the patient's own words
  9. Engagement Patterns — logging frequency and gaps — a sudden silence after daily logging is itself a clinical signal

Demo


Try It Yourself

Perspective is designed as a mobile app — a companion that lives on your phone between appointments. The primary build targets Android and iOS via Expo.
If you'd like to test the system directly, a web build is deployed at: https://main.d263v7d5j4zlp7.amplifyapp.com
The web version runs the full backend pipeline — journal entry → AI extraction → reframe/sustain response → progress tracking — with one exception: voice input is a native capability not available in the browser. Text entry, the AI response pipeline, progress trends, and the doctor summary generator all work identically to the mobile experience.
This is not a demo build or a mock; it connects to the same production API, the same DynamoDB table, and the same Amazon Bedrock models as the mobile app. The demo data tells a 90-day panic disorder recovery story — every AI response was generated by real Amazon Bedrock calls using the production pipeline, not canned text. An entry about "I missed my dose yesterday and panicked about whether to take it late" gets a response that acknowledges the dose confusion specifically.

What I Learned

RAG transforms AI from generic to personal. Early prototypes used only the current entry for reframing. They read like a well-meaning chatbot — technically correct but emotionally hollow. The moment I added retrieval-augmented generation — pulling the patient's own past entries as context — the responses became genuinely useful. "You felt this same way three weeks ago, and your own entry the following day showed it passed." That's not a chatbot. That's a tool that knows you.
AI should know where it ends and the clinician begins. Perspective generates structured clinical summaries — but it does not tell doctors what to conclude. Removing the automated "Overall Trend" banner was a deliberate decision. The AI organizes and surfaces data; the clinician reads and interprets it. Knowing where to stop is as important as knowing what to build.
Clinical AI requires formal quality gates — and building them taught me six things. "We think the prompts work" is not an acceptable standard for a system generating clinical data. The LLM-as-Judge pipeline turns intuition into measurement — 84 test cases across six suites, two evaluation layers, and a deploy gate that blocks on any crisis detection false negative. Building it taught me:
  1. Start from observed failures, not hypothetical ones. The pipeline started with two DynamoDB production entries where the AI failed — negation blindness and colloquial mistranslation. Building evals for specific observed failures gives the test suite a clear purpose.
  2. Use a different model as judge. Production inference and evaluation use different model families. A model rating its own outputs introduces systematic optimism bias that defeats the purpose of evaluation.
  3. Temperature variance reveals borderline prompts. Running the reframe suite at temperature=0.4 produced scores that fluctuated between 0.82 and 0.88 across runs. Lowering to 0.3 stabilized scores and surfaced which prompts were genuinely marginal — variance is a signal, not noise.
  4. Rubric precision is as hard as prompt precision. Three criteria required rewrites after the judge applied them too broadly. An underspecified rubric causes false positives that erode confidence in the eval system and mask real failures.
  5. LLM judges catch what code review misses. The mood elevation alert message passed human review. The judge flagged implicit alarm framing on first evaluation. Both the mood elevation and PTSD alerts were real quality issues that the eval found and human review missed.
  6. Don't use LLM judgment for binary algorithm correctness. The relapse risk algorithm is pure Python with deterministic output. Python assertions with a mock DynamoDB caught a real bug that would have silently passed all algorithm-level tests with incorrect results.
The hardest engineering problems weren't the AI. Amazon Bedrock extraction works remarkably well. The challenges that consumed the most time were infrastructure: OpenSearch SigV4 signing, CloudFormation cross-stack export deadlocks, Amazon Bedrock model access provisioning, DynamoDB type constraints. Building AI applications on AWS is less about prompt engineering and more about understanding how services interact at the edges.
Absence of data is data. A patient who logged daily for three weeks and goes silent for five days is telling you something. The system that treats this as "missing data" is missing the point. Engagement patterns — including the gaps — are clinical signals.
Mental health treatment is a long road. Perspective doesn't shorten it. It just makes sure you can see how far you've come.

References

[1] Chakrabarty, T. et al. Cognitive Dysfunction in Major Depressive Disorder . Focus, 2016.
[2] Preece, D.A. et al. Alexithymia profiles and depression, anxiety, and stress . Journal of Affective Disorders, 2024.
[3] Rock, P.L. et al. Cognitive impairment in depression: a systematic review and meta-analysis . Psychological Medicine, 2014.
[4] Myin-Germeys, I. et al. Experience sampling methodology in mental health research . World Psychiatry, 2018.
[5] Hayes, A.M. et al. Change is not always linear. Clinical Psychology Review, 2007.
[6] Wierzbicki, M. & Pekarik, G. A meta-analysis of psychotherapy dropout. Professional Psychology: Research and Practice, 1993.
[7] Olfson, M. et al. Continuity of antidepressant treatment for adults with depression in the United States . American Journal of Psychiatry, 2006.
[8] Antidepressant discontinuation and relapse risk. PMC, 2022.
[9] Ryum, T. et al. CBT homework completion and treatment outcomes. Journal of Clinical Psychology, 2024.
[10] App-based diaries vs. clinic self-reports in chronic conditions. Scientific Reports, 2024.
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