Inspiration

If a patient has high blood pressure, their physician tracks a concrete number at every visit. If they have diabetes, they track A1C. Yet in dermatology—a $100B+ global market where topical retinoids, barrier repair regimens, and systemic prescriptions take 6 to 12 weeks to show results—follow-up consultations still rely on memory, subjective impressions, and uncalibrated phone selfies taken in different lighting. Because patients cannot see gradual week-to-week biomarker improvements in the mirror, over 50% abandon effective prescriptions prematurely, while dermatologists lack objective longitudinal data to tell whether a regimen is working, stalling, or triggering an adverse barrier flare.

Existing consumer skin-analysis apps treat computer vision as a single-day vanity gimmick—outputting a one-off "skin age" score with zero clinical memory across visits. We built DermBridge® to bridge that gap: transforming Perfect Corp’s YouCam AI Skin Analysis S2S v2.0 API from a single-selfie snapshot into a longitudinal clinical decision-support workstation built strictly for clinician review — not a diagnosis.

What it does

DermBridge® is an end-to-end longitudinal dermatology workstation for dermatologists, medical aesthetic clinics, and tele-dermatology teams:

12-Biomarker Longitudinal YouCam S2S v2.0 Engine: Ingests patient visit photos via direct clinic upload or signed 30-minute mobile check-in links (/capture/{token}) with guided oval framing and explicit patient consent (Photos are stored privately and deletable on request.). Each scan is analyzed across 12 frozen clinical skin concerns (acne, redness, moisture, pores, texture, wrinkle, oiliness, radiance, firmness, dark_circle_v2, dark_spot, and skin_tone) normalized onto a 0–100 scale with per-concern directionality (lower_is_better vs. higher_is_better). Minimal Detectable Change (MDC) Noise Filtering: Raw computer-vision scores fluctuate by 1–2 points due to ambient lighting. DermBridge applies per-concern MDC thresholds (±3.5 to ±5.0 points) and a minimum 7-day observation window to classify each biomarker as ↗ Improving, → Stable / Stalled, ↘ Worsening, or ◊ Insufficient Data—filtering out lighting noise so clinicians focus on real physiological change. Top-3 Priority Concerns & ±0.5-Point Grounded Clinical Agent: Ranks concerns by ∣ Δ ∣ × chief-complaint relevance ∣Δ∣×chief-complaint relevance (1.5× boost for patient-reported symptoms) and generates non-diagnostic consultation summaries and attribution hypotheses. A deterministic numeric validator parses every number in generated text and rejects any output that drifts by more than ±0.5 points from the true database measurements. Automated Prescription Cross-Referencing: Temporally aligns active and historical prescriptions (e.g., Adapalene 0.1% Gel, Ceramide Barrier Cream, Niacinamide 5%, Glycolic Acid 10% Toner) against YouCam biomarker trajectories, accounting for pharmacological onset windows (7–28 days) to flag Favorable Co-Movement (≥ MDC) vs. Potential Barrier / UV Flare Signals. One-Click 3-Page A4 Consultation PDF & FHIR R4 Export: Generates a 3-page clinical consultation report (report.pdf) with server-rendered trajectory charts and exports all 12 longitudinal concern scores as a standards-compliant HL7 FHIR R4 Observation Bundle (/api/patients/{id}/fhir) for hospital EHR integration.

How we built it

Backend (apps/api — FastAPI, SQLAlchemy 2.0, Alembic, Pydantic v2): Built an asynchronous YouCam S2S v2.0 client (client.py) implementing presigned file registration (POST /s2s/v2.0/file), multi-action task creation (POST /s2s/v2.0/task/skin-analysis), exponential backoff polling (2s → 30s cap, 90s timeout), and results.output[] / score_info bundle hydration. Added automatic portrait face-framing (crop_portrait_for_youcam) using Pillow (PIL.Image + ImageOps.exif_transpose) so wide portrait photos where the face initially occupies <60% of image width are automatically zoomed around the facial region and re-analyzed by YouCam S2S v2.0. Implemented Longitudinal Trend, MDC Verdict, and Medication Cross-Referencing engines (flags.py, medications.py) plus the Grounded Clinical Agent (narrate.py, validate.py). Built the 3-Page A4 PDF Report & FHIR R4 Exporter (report.py) using Jinja2, Matplotlib, and ReportLab/WeasyPrint. Database & Private Storage (Supabase PostgreSQL + S3-Compatible Private Object Storage): Designed a 7-table relational schema (clinics, clinicians, patients, visits, concern_scores, treatment_flags, patient_medications) managed by Alembic migrations with automatic IPv4 connection-pool normalization and private S3 storage key isolation (never exposing raw patient photos on public URLs). Frontend (apps/web — Next.js 14 App Router, TypeScript, Tailwind CSS): Crafted an authoritative DermNet-inspired clinical interface featuring a two-tier cerulean medical masthead (#006599 / #127eb8), global Ctrl+K chart search, Dermatology Atlas spotlight cards, SVG trajectory sparklines, provenance badges separating Observed Measurements (●) from Temporal Correlations (◇) and Generated Hypotheses (✦), and a token-signed mobile patient capture flow. Challenges we ran into YouCam S2S v2.0 Face-Width Framing & Score Polarity Harmonization: Perfect Corp’s live S2S v2.0 endpoint requires the detected face to occupy more than 60% of the image width (error_src_face_too_small) and returns 0–100 skin-health scores (100 = clearest) inside data.results.output[] where action keys like pore, age_spot, and eye_bag differ from clinical terminology. We built an automatic EXIF-aware portrait cropper that progressively zooms onto the facial region when needed, mapped all 12 actions cleanly, and inverted symptom-burden metrics (acne, redness, pores, wrinkle, texture, oiliness, dark_circle_v2, dark_spot) so clinical burden and MDC deltas remain intuitive (Δ -30.00 = 30-point reduction in acne burden). Preventing AI Hallucinations in Clinical Summaries: Free-form LLMs frequently round, exaggerate, or invent numbers when summarizing tables—an unacceptable risk in healthcare software. We engineered a strict post-generation validator (validate_narrative_numbers) that extracts every numeric token from the summary and hypotheses and compares it against the patient's ground-truth scores and deltas (±0.5 tolerance), falling back deterministically if any number drifts. Eliminating Read/Write Contention on Live-Polling Charts: When a clinician had a patient chart open with live auto-refresh while simultaneously uploading a new visit photo over remote Supabase PostgreSQL, concurrent flag regeneration caused connection-pool contention. We separated read-first flag retrieval (get_or_create_patient_flags) from write-time regeneration and expanded the PostgreSQL connection pool for sub-second chart loads. Accomplishments that we're proud of Turning Single-Shot Skin AI into Longitudinal Clinical Intelligence: Successfully integrating live Perfect Corp YouCam S2S v2.0 with a multi-visit longitudinal database, MDC noise filtering, and automated prescription cross-referencing. Catching Real-World Regimen Trade-Offs Automatically: Demonstrating how DermBridge simultaneously validates a 30-point acne recovery (68.00 → 38.00) and 29-point moisture gain (42.00 → 71.00) on Adapalene 0.1% + Ceramide Cream while catching a 19-point worsening in Hyperpigmentation Spots (32.00 → 51.00) and 9-point worsening in Skin Texture triggered by adding Glycolic Acid 10% Toner without strict SPF. Zero-Hallucination Grounding & Full Test Coverage: Passing a 31-test automated pytest suite covering authentication, live/mock YouCam S2S parity, MDC boundary math, numeric hallucination rejection, prescription correlation logic, 3-page PDF rendering, and FHIR R4 export. Authentic Clinical UX: Designing a high-contrast, accessible dermatology workstation modeled after trusted medical references (DermNet), complete with color-independent status symbols, keyboard navigation (Ctrl+K), and explicit provenance badges.

What we learned

In longitudinal medicine, knowing what didn't change is as important as knowing what did: Applying Minimal Detectable Change (MDC) thresholds taught us how critical it is to suppress sub-threshold camera and lighting variance (such as a -1.50 shift in wrinkles within a ±4.0 noise floor) so clinicians aren't fatigued by false alarms. Temporal correlation requires pharmacological context: A prescription started yesterday cannot be judged on tomorrow's skin scan. Encoding therapeutic onset windows (e.g., 21 days for retinoids and exfoliating acids vs. 7 days for barrier creams) transformed raw score deltas into clinically meaningful regimen insights. What's next for DermBridge Overlay Mask Side-by-Side Slider: Interactive visual comparison of cached YouCam S2S v2.0 pathology masks (acne, redness, pores, age_spot overlays) across Baseline and Latest visits with synchronized pan/zoom. Cohort-Level Clinic Efficacy Benchmarks: Aggregate anonymized prescription response curves across Fitzpatrick skin types I–VI so clinics can benchmark average 90-day biomarker improvements by regimen. Direct SMART-on-FHIR EHR Launch: Embed DermBridge directly inside Epic and Cerner dermatology encounter tabs via SMART-on-FHIR OAuth2 launch and automated Observation / DiagnosticReport write-back.

Built With

Share this project:

Updates

Submission history