Softcode
U S G
A I   A S S I S T
Feature Deep Dive Guide
The complete "Why, How & What" reference for the entire product.
Every feature explained in depth — with the business problem it solves,
how it works under the hood, and how it is used in daily practice.
FOR ENGINEERS
FOR SALES
FOR MARKETING
Version 3.9  |  May 2026  |  Bridge v4.9.27 Local Token Auth  |  JS Obfuscation  |  Standalone Binaries

RELEASE NOTES — Engineering Changelog

This deep-dive document is updated with every public release. Each version below lists shipped features, the engineering work behind them, and the sales talking points that go with them.

Version 3.9  ·  May 4, 2026  

3.9.1 Bridge v4.9.27 — Local API Token Authentication

WHY Bridge HTTP API (port 4145) was unauthenticated. Any process on the same clinic PC — malware, a rogue browser extension, or another app on the local network — could call localhost:4145 and access DICOM data, image thumbnails, or OCR results without any credential. On multi-user hospital PCs the exposure surface is non-trivial.
HOW On first startup, the bridge calls crypto.randomBytes(32).toString('hex') and writes the result to bridge.config.json as localToken. GET /health returns { ..., localToken } alongside the existing version/port/ae fields. Every other route runs a middleware check against the x-bridge-local-token header — mismatch or missing header → immediate 401 Unauthorized, request dropped. Frontend patch: src/lib/bridge.ts exports getBridgeLocalToken(), setBridgeLocalToken(token), installBridgeAuthInterceptor(). main.tsx calls installBridgeAuthInterceptor() on startup — patches window.fetch globally so every call to the bridge URL automatically injects the stored token. Token is persisted in localStorage[sc_bridge_local_token]; refreshed on each /health call (Settings.tsx + Patients.tsx). Doctor impact: zero — completely transparent to normal workflow.
TECH Token never leaves the doctor's PC. Softcode cloud does not receive, store, or transmit it. Files changed: softcode-bridge.src.js (middleware + /health return), softcode-bridge.js (re-obfuscated), src/lib/bridge.ts (new helpers), src/main.tsx (interceptor install).
SALES "Bridge is now protected — only the Softcode web app can call it. No other software on the clinic PC can read DICOM data or measurements."

3.9.2 Bridge JS Code Obfuscation

WHY Bridge JS source is valuable IP — SR/OCR measurement-extraction algorithms (caliper regex, Hadlock formula, SR parser) were readable by any developer who opened the file. Distributing plain source gives competitors a direct route to clone the measurement pipeline.
HOW Two-file architecture: softcode-bridge.src.js (editable source, 171 KB, git-tracked, never distributed) and softcode-bridge.js (obfuscated output, 278 KB, what doctors receive). build-obfuscate.sh in public/bridge/ runs javascript-obfuscator with RC4 string encryption, control flow flattening (threshold 0.75), dead code injection (0.2), and self-defending mode (crashes if the outer wrapper is tampered). Any future source edits must end with a re-obfuscation run before deployment.
TECH javascript-obfuscator installed globally. Re-obfuscate: cd artifacts/usg-reporting/public/bridge && ./build-obfuscate.sh. Output file is what both the .bat installer and the API server's /api/bridge-latest endpoint serve.
SALES "IP is protected. No competitor can copy the measurement parser by downloading our bridge."

3.9.3 Standalone Binary Install Option (Windows .exe + macOS)

WHY The .bat installer requires Windows Scripting Host + internet access for the Node.js download step; some locked-down hospital PCs block PowerShell or MSI installs, and some clinic IT admins refuse to run .bat files. A single-file executable sidesteps all these blockers.
HOW pkg tool bundles Node.js runtime + bridge-entry.js entry point into a single self-contained executable. Two targets built:
Both binaries are committed to public/bridge/dist/ and served from the app. Settings → Local Bridge shows new download cards (🪟 Windows / 🍎 Mac) below the primary .bat installer. Primary flow: .bat → recommended for most clinics (auto Node install, Task Scheduler entry, auto-update via force-update). Binary: backup only — no auto-update, no Task Scheduler, just double-click and run.
TECH bridge-entry.js is the pkg entry point; it requires softcode-bridge.js from the same directory. Rebuild: cd artifacts/usg-reporting/public/bridge && npm run build:win / npm run build:mac.
SALES "Works on Windows 7, 8, 10, 11 — one file, double-click, done. No Node.js, no bat file, no internet needed at install time. Even the strictest hospital IT can run this."

Version 3.8  ·  May 3, 2026

3.8.1 SR Pre-Probe Badge — "✓ SR ready" Before the Doctor Clicks

WHY The "purple SR Detection" badge added in v3.6 only appeared after a scan ran and SR data was confirmed. Until then the doctor had no way to know whether the upcoming click would be the cheap 1-image SR-only path or the expensive full-pipeline AI scan. Result: doctors clicked AI when SR-only would have done the job at near-zero cost.
HOW Added srAvailable state in PatientDetail.tsx with four values: null | "checking" | "found" | "absent". A new useEffect watching (bridgeUrl, patient.id, linkedImages.length) probes GET /measurements/<key> on the bridge using the same key cascade the OCR pipeline uses (accessionNumberstudyIdpatient.name), with a 2.5 s per-request abort timeout so a slow bridge cannot freeze the UI. Stops at the first hit. Renders a small, pre-scan badge next to the SR+OCR / AI buttons: Badge auto-hides on mobile (hidden sm:flex) and disappears once OCR runs (the existing "✓ N values · SR + OCR" success badge takes over). Recognises both bridge-side SR and inline SR carried on image objects via applyLinkedImages.
TECH File: src/pages/PatientDetail.tsx — state declared at ~line 1972, useEffect placed AFTER the useGetPatient query to satisfy TS block-scoping; badge JSX in the OCR/AI button cluster ~line 3754. No backend or bridge changes; pure frontend pre-fetch reusing the existing /measurements/<key> contract.
SALES "The doctor can see — before clicking — whether SR is ready. One glance saves an unnecessary AI call and ₹0.03 of compute per scan."

3.8.2 Adaptive PC Speed Re-Benchmark — Stale-Routing Killer

WHY The hardware engine selector (introduced earlier — local Tesseract vs server OCR based on a one-shot specs + 300 ms benchmark) was a one-time decision per browser profile. Real-world performance changes constantly: laptop on battery saver, browser update, overheating, new hardware, Windows background updates. A doctor whose original benchmark was a borderline 55 Mpps could be stuck on local OCR for months even though their PC is now thermally throttling at 30 Mpps. Doctor calls support saying "OCR is slow"; we had no way to debug, no way to refresh.
HOW File src/lib/hardwareCheck.ts rewritten with three re-benchmark triggers — re-runs whenever any are true: Diagnostic snapshot in localStorage[sc_ocr_engine_v2_diag] now carries a rebenchReason field ("no-cache" | "expired" | "borderline" | "manual") so support calls can be answered in 30 seconds: "your PC last benchmarked 8 days ago, scored 32 Mpps, switched to server OCR — that's why it feels different."
TECH New exports: requestRebenchmark(): Promise<EngineDecision> (force-rerun, returns full decision so caller can toast "Switched to server OCR"), isOcrBenchmarkStale(): boolean (lets a Settings panel show a yellow "overdue" dot). ensureOcrEnginePreference() kept its existing zero-arg signature — fully backward compatible. Cache key remains sc_ocr_engine_v2; existing installs upgrade transparently on next login.
SALES "The PC speed test refreshes itself every 7 days, on uncertain scores, and on demand. No more 'works on day one, slow on day thirty' surprises. Support diagnostics in 30 seconds."

Version 3.7  ·  May 2, 2026

3.7.1 WhatsApp Send to Patient — Bridge v4.9.0 (Baileys)

WHY Doctors were copy-pasting report text into WhatsApp Desktop and re-attaching PDFs manually for every patient. Slow, error-prone, and a privacy concern (any WhatsApp group could accidentally receive the wrong report). Make it a one-click action that bypasses the cloud entirely.
HOW Bridge v4.9.0 lazy-loads @whiskeysockets/baileys (so the bridge keeps running even if Baileys isn't installed). New endpoints: Frontend: WhatsAppSendModal.tsx opens from the green WhatsApp icon on every Finalized report row in PatientDetail.tsx. Polls /whatsapp/status every 4 s; banner branches for checking | connected | disconnected | unavailable | offline. PDFs generated client-side via jsPDF (text Report PDF; auto-grid Print Images PDF using bridge's /images/thumbnail/:id). On success, logAddonUse("whatsapp_send", report.id) POSTs to /api/addons/log for billing.
TECH Schema: patientsTable.whatsappNumber (text, nullable, separate from phone); usersTable.whatsappNumber (text, doctor's own); usersTable.addonWhatsapp (boolean, default false). Backend addon registered at ₹0.70 (twice other rates because each send can include both PDFs). PATCH /api/patients/:id + POST /api/patients + PATCH /api/doctor/clinic-info all accept whatsappNumber. Admin → Add-ons panel gained per-doctor WhatsApp toggle row; ADDON_PRICES.whatsapp = 0.70; bill rows + per-doctor enabled-addon list updated. Installer V33 bundles npm install --omit=optional --no-audit --no-fund for Baileys at install time. BridgeInstallerV33.bat writes package.json with @whiskeysockets/baileys ^6.7.18 and qrcode ^1.5.4; failure to install Baileys is non-fatal (DICOM/HTTP keep working; only WA send becomes unavailable). Logs at Bridge\npm-install.log.
SALES "One click. Patient gets the PDF on WhatsApp instantly. The Softcode cloud never even sees the WhatsApp number — it's all on your PC."

3.7.2 Anatomy Diagram Library — 4 → 15 Full-Frame Custom Illustrations

WHY Multi-panel reference images forced doctors to point at one corner of an image to indicate the relevant organ. Patients couldn't read what was relevant; the visual lost professional polish.
HOW Commissioned 11 new custom anatomy diagrams (in addition to the 4 originals): kidney-overview, liver-overview, gallbladder-overview, pancreas-overview, twin-pregnancy-overview, PCOD-overview, neonatal-spine-overview, plus 4 more in earlier batches. Routing logic in ReportEditor.tsx ~lines 4232–4318 picks the right asset by template type and finding keywords (e.g. "gallbladder"/"biliary"/"cholelithiasis" → gallbladder-overview; "pcod"/"pcos"/"polycystic" → PCOD-overview).
TECH 26 total anatomy assets in artifacts/usg-reporting/public/anatomy/*.png.enc: 15 full-frame "overview" diagrams + 11 multi-panel reference images (still useful for organs without dedicated single-organ art). Installer V33 anatomy file list updated.
SALES "Patients understand pictures. The anatomy diagram embedded in every report makes Softcode look — and feel — premium."

3.7.3 Anatomy Asset Encryption — AES-256-CTR via Web Crypto

WHY Anatomy diagrams are commissioned artwork. Storing them as plain .png on a public CDN made it trivial for any competitor to scrape the entire library and ship it in their own product.
HOW Build script artifacts/usg-reporting/scripts/encrypt-anatomy.mjs walks public/anatomy/, encrypts each .png with AES-256-CTR, writes the .png.enc sibling, and deletes the original. Per-file IV is derived deterministically from SHA-256("anatomy:" + filename).slice(0, 16) so the same file always encrypts to the same blob (CDN-cache friendly). Decrypt helper src/lib/anatomyDecrypt.ts uses the Web Crypto API in the doctor's browser; returns a Blob URL ready to drop into <img src>. The bridge's HEAD-check uses abdomen-overview.png.enc (old bridges fall back to server, which still works).
TECH Key: 32 bytes, base64-encoded constant in the JS bundle (mild obfuscation against casual scrapers — explicit accepted threat-model decision; not nation-state grade). Encryption is over the bytes only; PNG headers re-appear after decrypt and pass image-magic-byte sniffing. Round-trip verified: 26 files, all decrypted bytes show valid PNG headers. .png requests now 404 (only .png.enc served). Re-runnable encryption script — only encrypts new .png files (skips existing .enc).
SALES "Our diagram library is our differentiator. Other software can't just download our pictures."

3.7.4 Train AI — Now Works on Manually-Typed Reports

WHY The Train AI button only appeared when the doctor edited a GPT-4o draft (currentText !== aiOriginal). Doctors who type from scratch (especially senior radiologists who don't bother with AI drafts) had no way to feed their style back into the model.
HOW Treat aiOriginal === null as "" for the comparison. Now the button appears whenever currentText.trim() !== (aiOriginal ?? "").trim(). Manual-from-scratch reports are training-eligible.
TECH File: src/pages/ReportEditor.tsx — Train AI gating condition.
SALES "Senior doctors who never touch the AI draft can still train the AI. Their style becomes the AI's style."

3.7.5 Per-Frame OCR Completeness — Every Organ in Every Template

WHY Audit found per-frame OCR (used when machine has no measurement-summary screen) was extracting only ~50% of the fields the report templates actually render. Fields like aorta, IVC, portal vein, isthmus, yolk sac, nasal bone and TCD were silently empty.
HOW Files: artifacts/usg-reporting/src/utils/localOcr.ts + artifacts/api-server/src/routes/ocr.ts: Verified end-to-end: 23/23 unit tests pass.
TECH Files: src/utils/localOcr.ts, src/routes/ocr.ts. Pure regex / map changes; no upstream OCR engine touched.
SALES "Even if your machine doesn't have an SR summary screen, every measurement field in the template gets auto-filled from the per-frame OCR pipeline."

3.7.6 Print Modal — One-Click "Auto-fit" Shortcut

WHY Configuring a 36-image print as a 6×6 grid required tweaking columns, rows and toggling single-page mode separately. Three clicks too many on a busy day.
HOW New emerald button below the slot grid: "Auto-fit (N → 1 page)". Sets printCols = printRows = min(6, ceil(√N)) and toggles printSinglePage = true in one click.
TECH File: src/pages/PatientDetail.tsx — print modal slot grid section.
SALES "One click and your image sheet is laid out for the best possible print. Less fiddling, more reporting."

3.7.7 Bridge v4.8.5 + v4.8.4 — Cross-Patient Image Stealing FIXED

WHY After a bridge restart, opening any patient could "steal" DICOMs that already belonged to another patient. Worse, when 3 patients on the same day share the same first name (e.g. ASHWINI KUMAR / ASHWINI SHARMA / ASHWINI PATIL), the loose word-overlap matcher cross-linked them.
HOW Frontend (PatientDetail.tsx): all 3 /scan-dicom callers now send patientVisitDate. visitDate resolves to p.visitDate ?? p.createdAt.
TECH Files: public/bridge/softcode-bridge.jsSTUDY_STOPWORDS, namesMatch, datesMatch; src/pages/PatientDetail.tsx — added patientVisitDate to /scan-dicom POSTs at lines ~2180, ~2274, ~2356. 12/12 unit cases pass (3-Ashwini same-day collisions BLOCKED, yesterday-DICOM-into-today-patient BLOCKED, surname-first DICOM format MATCH, no-date allows match for back-compat).
SALES "Image-to-patient matching is now bulletproof. No more swapped DICOMs after a bridge restart, no more cross-linking on shared first names."

Version 3.6  ·  May 2, 2026

3.6.1 Production Launch — Replit Autoscale (Asia)

WHY Move from preview/dev URL to a real, always-on production endpoint so clinics can install the bridge against a stable cloud target and the URL can be embedded in installer scripts and printed marketing material.
HOW Deployed via Replit Deployments → Autoscale, Asia region, profile: 2 vCPU · 4 GiB RAM · max 3 machines · scale-to-zero. Public URL sonography-assistant.replit.app; custom domain attachment (softcodehq.com / softcodeusg.app) is in progress. Recommended monthly spend limit set at $200 (~₹16 500) at replit.com/usage as a hard cap safety net.
TECH Cost envelope (worst case 5 000 reports/month) ≈ ₹13 840 Replit + ₹2 050 OpenAI ≈ ₹15 890. At ₹7/report retail this gives positive unit economics from the first paid report. Database stays co-located in the same region for low latency.
SALES "We are live, we are stable, and the price stays at ₹7 per report no matter how busy you get."

3.6.2 Purple SR Detection Badge

WHY Doctors had no instant visual confirmation that the bridge had successfully delivered SR (caliper) data from the USG machine. They would press buttons and wait, unsure whether the next click would have data to work with.
HOW Added a small purple badge in PatientDetail.tsx at ~line 3539, conditioned on dicomMeasLoaded && (ocrSource === "sr-ocr" || null). The badge appears the moment SR arrives, with a Hinglish doctor hint: "Report page slot 1 pe rakho → SR+OCR dabao → 2-3 sec mein GA mil jayega."
TECH File: artifacts/usg-reporting/src/pages/PatientDetail.tsx ~line 3539. Pure UI change, no backend touched. HMR-clean reload.
SALES "One glance at the screen tells the doctor the machine has spoken — no guesswork, no re-clicks."

3.6.3 SR-Driven Early-Stop OCR — ~80% Compute Saving

WHY The OCR pipeline was scanning every image in a study (often 80–120 images) even when the answer was obvious from the first few. This wasted compute, slowed the doctor down, and inflated per-report cost.
HOW Added a reportPageFound() helper inside the Phase A and Phase B loops. After each batch: Source: artifacts/usg-reporting/src/pages/PatientDetail.tsx lines ~1355–1425. Result: typical scan time drops from ~30 s to ~5 s; cloud compute per scan drops by roughly 80%.
TECH No change to the underlying OCR engine. Sharp preprocessing, six-worker Tesseract pool clamped to min(6, os.cpus()) (so the production 2-vCPU container runs two workers), PSM3 fast-path and batch size 12 are retained as designed. Pool prewarm fires 500 ms after app.listen in artifacts/api-server/src/index.ts.
SALES "Faster scans, lower cost — same accuracy. The doctor sees measurements in five seconds instead of thirty, and the clinic pays roughly one-fifth the compute per report."

Version 3.5  ·  May 2, 2026

3.5.1 Smart Print Layout — Pages 2 & 3 Auto-Merge

WHY Doctors and radiologists complained that obstetric reports with no DICOM images still printed as three pages — page 3 was almost empty, wasting paper and looking amateurish.
HOW Three new Boolean variables — hasDicom, hasDoppler, mergePg2And3, bigDiagramAlone — are computed before the print stylesheet is injected. When no DICOM: if no Doppler, mergePg2And3=true (charts + diagram share one A4 sheet, zoom 0.82); if Doppler present, bigDiagramAlone=true (diagram enlarged to zoom 0.88 on page 3). If DICOM present, normal 3-page layout is used.
TECH File: src/pages/ReportEditor.tsxmergePg2And3 / bigDiagramAlone variables injected into the printCSS string before window.open. CSS uses transform: scale() on the diagram container and @page { page-break-before: avoid } on the merged block.
SALES "Compact, professional reports — 2 pages instead of 3 for routine obstetric cases. Saves paper and looks better on the doctor's desk."

3.5.2 AI Draft — Manual-Only (Generate Draft Button)

WHY AI draft auto-firing on every SR/OCR import was surprising users who just wanted to review the numbers before running GPT-4o. Unintended API calls on busy scanning days were also a cost concern.
HOW Removed the autoGeneratePending useEffect in PatientDetail.tsx that fired handleAiDraft automatically. Removed the handleAiDraft auto-call at line 3155 of ReportEditor.tsx. Set autoStart={false} on the OCR pipeline. GPT-4o is now invoked only when the doctor clicks the blue "Generate Draft" button explicitly.
TECH Files: src/pages/PatientDetail.tsx (removed autoGeneratePending useEffect), src/pages/ReportEditor.tsx (removed auto handleAiDraft call, autoStart={false}). The handleOcrMeasurements(data, autoMode=true) signature now passes autoMode=true for silent fills and false only on manual "Generate Draft" path.
SALES "Doctor is always in control. AI drafts only when asked — no surprises, no wasted tokens, no accidental submits."

3.5.3 Signature on Every Print Page

WHY Multi-page reports had the doctor signature on page 1 only. Pages 2 and 3 were unsigned, which is a compliance concern — any printed page could be detached and circulated without authorisation.
HOW Added page-break-inside: avoid to the .footer CSS class so the signature block never splits across pages. Added a <div class="footer"> block (doctor name, signature image, stamp label) to every page section (page 1, 2 and 3) in both the live print HTML and the auto-save finalized HTML.
TECH File: src/pages/ReportEditor.tsxprintCSS string for live print and the doFinalize() HTML template both include footer div per page. footer { margin-top: 18px; } ensures signature appears immediately after content, not floating at page bottom.
SALES "Every page of every report is signed by the doctor. Legally sound, clinically complete."

3.5.4 IRIA-Style AI Prompt (Indian Radiology Standard)

WHY Generic GPT-4o output used Western radiology phrasing ("There is evidence of…", "The findings suggest…") which sounds foreign to Indian radiologists. IRIA-trained doctors use a concise, standardised style.
HOW Completely rewrote the GPT-4o system prompt in aiDraft.ts with IRIA conventions: "noted", "s/o" (suggestive of), "B/L" (bilateral), concise numbered findings, obstetric prose paragraphs (growth, liquor, placenta), mandatory EDD line, "Clinical correlation advised." closing. Sex of fetus never mentioned (PNDT hardcoded).
TECH File: artifacts/api-server/src/routes/aiDraft.ts — system prompt object. Prompt uses structured sections: IRIA_RULES, OBSTETRIC_FORMAT, GENERAL_FORMAT, PNDT_CONSTRAINT. Temperature: 0.3 for consistent style.
SALES "Reports read exactly like an Indian radiologist wrote them. Doctors accept the AI draft with minimal edits — 8–10 seconds to a publication-ready report."

3.5.5 OCR Pipeline — Silent Measurement Auto-Fill

WHY Previously OCR completion would trigger an AI draft automatically, surprising users and consuming API tokens even when the doctor only wanted to verify measurements.
HOW The handleOcrMeasurements(data, autoMode) function now accepts an autoMode flag. When true (OCR/SR pipeline): measurements fill silently, no GPT-4o call. When false (Generate Draft button): full pipeline including AI draft runs.
TECH File: src/pages/PatientDetail.tsxapplyOcrResult() and handleOcrMeasurements(). The Tesseract OCR pipeline (src/utils/localOcr.ts) extracts BPD, HC, AC, FL, EFW, GA weeks/days using regex GA_RE with GA_LABELS normalisation. Values are mapped to report fields and set silently via React state.
SALES "Measurements flow in automatically from the USG machine screenshot — the doctor just reviews and clicks Generate Draft when ready."

Version 3.4  ·  April 30, 2026

Documentation refresh — no software change
All six documents refreshed with official Softcode logo, expanded Document Control (legal entity, website, support email, last-revised date), explicit Version Control table, "Approved by" signature block, and informational disclaimer. No engineering changes — all v3.3 feature descriptions remain accurate.

Version 3.3  ·  Apr 28, 2026

3.3.1 Bridge Installer — All Folders Pre-Created

WHY Earlier installers created \DICOM, \PDFReports and \AIUpdates automatically but missed the \PNDT folder, forcing the bridge or the doctor to create it on first Form F save. This caused a "folder not found" warning on day one of every new install.
HOW The SoftcodeBridgeInstallerV32.bat script now executes a PowerShell New-Item -ItemType Directory -Force for all four sub-folders during the path setup phase (line 77), before the bridge service is started. -Force makes it idempotent on re-installs.
TECH Folder set: $chosenBase\DICOM, $chosenBase\PDFReports, $chosenBase\PNDT, $chosenBase\AIUpdates. The bridge config (bridge.config.json) writes the chosen base path so all four folders are reachable via deterministic sub-paths at runtime.
SALES "Install once, fully compliant. Form F and PNDT documents have a dedicated home from day one — no manual setup, no support call."

3.3.2 Bridge Version Label — Single Source of Truth

WHY Bridge version was previously hard-coded in three places (Settings page, Patients page badge, installer cover). When we shipped a new bridge build, one of the labels would inevitably go stale until manually updated.
HOW The server now exposes GET /api/bridge/version returning { version, releasedAt, basePath, ae, appUrl }. The frontend fetches this on mount and binds the result to every UI element that displays a bridge version. The installer template uses {{version}} placeholder substitution at download time so the .bat label always matches the live release.
TECH Source of truth: bridge/version.json. Build pipeline writes the file once; Express middleware reads it; React Query caches the response with a 5-minute stale time.
SALES "Doctors always see the live bridge version. We never confuse the field with stale labels."

3.3.3 Print Polish — Image Sheet & Report Cells

WHY Doctors flagged a thin dark strip appearing at the bottom of every image cell in the printed Image Sheet — caused by a full-width slot-label overlay. It made an otherwise premium-looking sheet look amateurish.
HOW Replaced the bottom-anchored .slot-label strip with a top-left .slot-num circular badge that overlays the image without occupying full width. CSS box-sizing tightened so DICOM image cells respect cell borders exactly. Print stylesheet uses print-color-adjust:exact to preserve the badge across all browsers.
TECH Files: src/pages/PatientDetail.tsx — slot template (~line 1349) and CSS (~line 1376). The badge uses position:absolute; top:6px; left:6px with high z-index over the image.
SALES "The printed sheet looks like a hospital-grade radiology output. Doctors can hand it to a referring physician with confidence."

3.3.4 DICOM Per-Patient Subfolder Organisation

WHY Previously all DICOM files landed in a single flat \DICOM\ folder. Practices doing 50–150 scans per day accumulated thousands of files in one directory — impossible to audit, and fragile when Windows Explorer tried to render thumbnails for the whole folder.
HOW The bridge C-STORE handler calls a new safeFolderName() helper that sanitises the DICOM Patient Name tag (strips slashes, colons and reserved characters) and creates \DICOM\PatientName\file.dcm. The /save-file endpoint accepts an optional patientName field so PDF reports and PNDT Form F documents use the same subfolder scheme under \PDFReports\ and \PNDT\ respectively. rebuildIndexFromDisk walks one level of subfolders on startup so older flat files remain indexed without any migration step.
TECH Files: public/bridge/softcode-bridge.jssafeFolderName() helper, handleCStoreRequest, /save-file route, rebuildIndexFromDisk. The folder is created with fs.mkdirSync({ recursive: true }) so the first save for a new patient is atomic.
SALES "Open \DICOM\ and you see a folder per patient — instantly auditable, instantly understood by any radiologist or IT admin."

3.3.5 PDF Auto-Save on Finalise

WHY Doctors were printing manually and sometimes forgetting to save a PDF copy. Any power cut or browser crash after finalization but before print meant no local backup existed on the doctor's PC.
HOW doFinalize() in ReportEditor.tsx now fire-and-forgets a PDF save immediately after locking the report. It builds the full report HTML (header, patient info, measurements, findings, impression, signature) and calls saveToLocalDrive("pdf", fileName, html, patientName). The bridge receives this over the socket and writes it to \PDFReports\PatientName\PatientName_YYYY-MM-DD.pdf without any user interaction required.
TECH Files: src/pages/ReportEditor.tsxdoFinalize(); src/lib/bridge.tssaveToLocalDrive() extended with optional patientName param; softcode-bridge.js/save-file route. The PDF is generated client-side using window.open / html2canvas pipeline already in the codebase.
SALES "Every finalized report is automatically backed up locally. Even if the clinic's internet goes down after finalization, the doctor's PC already has the PDF."

3.3.6 Daily Milestone Celebrations

WHY High-volume USG centres see 50–150 reports per doctor per day. The grind is real. A brief, professional acknowledgement of milestone productivity boosts morale without being patronising or distracting.
HOW A daily counter is incremented in localStorage on every call to doFinalize(). When the counter reaches exactly 50, 100, or 150, the MilestoneCelebration component mounts as a full-screen overlay over the current page — coloured particle fireworks (8 burst explosions, gravity physics, fade-out) play on a transparent canvas, and a professional message is shown in a dark-glass card. The overlay auto-dismisses after 3.5 s or on click. The counter key is sc_dfin_YYYY-MM-DD and is garbage-collected the next day, so every calendar day starts from zero.
TECH Files: src/components/MilestoneCelebration.tsx — self-contained component with canvas fireworks and all three messages; src/pages/ReportEditor.tsxcelebrateCount state and incrementDailyFinalized() call inside doFinalize(). Zero network calls. No personal data. No PII. Counter never leaves the browser.
SALES "The app celebrates alongside the doctor. It's a small detail that makes Softcode feel alive — not just another cold clinical tool."

Version 3.2  ·  Apr 25, 2026

3.2.1 PDF Auto-Save on Finalise

WHY Doctors finalised reports and forgot to print/save. Any power cut between finalization and print meant no local backup.
HOW doFinalize() now fire-and-forgets a PDF save immediately after locking the report. Complete HTML (header, measurements, findings, impression, signature) is built client-side and pushed over the bridge socket to \PDFReports\PatientName\.
TECH src/pages/ReportEditor.tsxdoFinalize(); src/lib/bridge.tssaveToLocalDrive(); bridge /save-file route writes the file.
SALES "Every finalised report is automatically backed up on the doctor's PC. Zero manual steps."

3.2.2 Form F Local Save

WHY PNDT Form F must be retained for audit. Previously only stored in cloud — if internet was down on audit day, the doctor had no copy.
HOW Same bridge /save-file mechanism used for Form F → written to \PNDT\PatientName\ on the doctor's PC automatically when Form F is generated.
TECH src/pages/Reports.tsx Form F generation calls saveToLocalDrive("pndt", fileName, html, patientName).
SALES "Form F audit trail on local disk — inspector comes unannounced, doctor opens the folder, done."

3.2.3 Multi-Frame DICOM Support

WHY Modern USG machines send cine clips (multi-frame DICOM) not just still frames. Earlier bridge dropped everything beyond frame 0.
HOW DCMJS pipeline detects NumberOfFrames > 1; extracts frame 0 as JPEG thumbnail for the inbox card; stores total frame count; the viewer UI shows a frame slider for clip playback.
TECH public/bridge/softcode-bridge.jshandleCStoreRequest() multi-frame branch. Thumbnail encoded as base64 JPEG and stored in the bridge index alongside the frame count.
SALES "Works with cine clips, not just stills. Every USG machine in India is supported."

3.2.4 Image Sheet Print

WHY Doctors needed to print USG images alongside reports. Previously images were only viewable on screen — no printable image sheet.
HOW New dedicated print mode in PatientDetail.tsx — selectable layouts (1×1, 2×1, 2×2, 3×3, 4×4), per-slot zoom (1×–4×), per-slot frame selection for clips. The layout is rendered as a printable A4 page with slot-number badges.
TECH src/pages/PatientDetail.tsx — image sheet print handler, slot template, layout selector, CSS print stylesheet. print-color-adjust:exact preserves image quality across all browsers.
SALES "Print a professional image sheet alongside the report — exactly like a hospital radiology department output."

Version 3.1  ·  Apr 18, 2026

3.1.1 Worklist Bridge — DICOM Modality Worklist (C-FIND SCP)

WHY Doctors and reception were typing patient names twice — once in Softcode and once on the USG machine. Typos caused patient-study mismatches in the DICOM data.
HOW The bridge now runs a C-FIND SCP on port 4100. When the USG machine queries for a worklist, the bridge fetches today's registered patients from Softcode cloud and returns them as a DICOM MWL response. The doctor selects the patient from the machine screen — no typing.
TECH public/bridge/softcode-bridge.jshandleCFindRequest(). Patient list fetched via GET /api/dicom/worklist?date=today. Formatted as DICOM C-FIND response DS/LO VRs.
SALES "Patient name typed once. The machine gets the rest. Zero mismatch, zero re-work."

3.1.2 DICOM SR Parser — Vendor-Agnostic

WHY Every USG brand stores measurements differently in DICOM SR — different sequence tags, different VR types, different code meanings. A single parser must handle all of them.
HOW A normalisation layer maps brand-specific DICOM code sequences to a standard measurement name (BPD, HC, AC, FL, EFW, GA, RI, PI, S/D). Supported brands: Samsung/Medison, GE, Philips, Mindray, Voluson, SonoScape, Chison, Toshiba/Canon.
TECH public/bridge/softcode-bridge.jsparseDicomSR() with a brand-specific code map. DCMJS used for tag parsing. Output is a flat JSON object sent to POST /api/dicom/sr.
SALES "Works with 8 brands out of the box. If the clinic upgrades machines next year, Softcode still works."

3.1.3 Auto-Patient on DICOM Arrival

WHY Walk-in patients are scanned before reception registers them in Softcode. The DICOM arrives for a patient who doesn't exist in the system yet — previously the inbox showed an unlinked orphan entry.
HOW When C-STORE arrives for an unknown patient name, the bridge calls POST /api/patients/auto-create with the DICOM Patient Name tag. Softcode creates a stub patient record and atomically links the study. The doctor sees the auto-linked entry in the DICOM Inbox ready to use.
TECH artifacts/api-server/src/routes/dicom.tsauto-create route. Patient name sanitised before insert. The stub is flagged so reception can fill missing demographic details later.
SALES "Walk-in patients? No problem. Softcode creates the chart automatically and links the scan."

3.1.4 AI Cloud Sync

WHY Each doctor's Train AI corrections are valuable — but only for that doctor. To improve the base model for everyone, corrections need to aggregate and retrain globally.
HOW Doctor corrections are encrypted and uploaded to the cloud on each login. On the 28th of each month, an aggregated model update is compiled and pushed to all doctors on next login. The doctor can also manually trigger a sync from Settings → AI Learning.
TECH Encryption: AES-256 before upload. Server: POST /api/ai/sync. Monthly retrain job runs as a scheduled Replit server task.
SALES "The more doctors use it, the smarter it gets — for everyone. Network effects built in."
📦 Release / Upgrade Process

Web app: Replit auto-deploy on merge to main. Doctors get the new build on next page refresh. Zero downtime.

Bridge: Doctor downloads new SoftcodeBridgeInstaller.bat from Settings, runs as Administrator. Installer stops the existing bridge service, overwrites Node files, preserves bridge.config.json, restarts. Total downtime per machine: under 30 seconds.

Documentation: Both the Doctor's Detailed User Guide and this Engineering Deep Dive are regenerated and re-deployed with every release. Admins can re-download the latest copy from Settings → Documentation at any time.

0. EXECUTIVE OVERVIEW

0.1 What is Softcode USG AI Assist

Softcode USG AI Assist is a cloud-based ultrasonography (USG) reporting platform built specifically for Indian sonography practices. It combines AI-powered clinical drafting (GPT-4o), DICOM machine integration, PNDT-compliant printing, and a complete multi-role clinic management system — all delivered through a modern dark-themed browser interface that runs on any laptop, tablet or smartphone.

0.2 The Problem We Solve

Problem in Indian USG PracticeHow Softcode Solves It
Doctors waste 3–5 minutes typing each report from scratch — 30+ reports a day means 2+ hours of typingGPT-4o auto-drafts a complete professional report in 8–10 seconds from measurements
Reports inconsistent in style across staff and across daysThe AI learns each doctor's personal phrasing and corrections — every report sounds like the doctor wrote it
Patient name has to be typed again into the USG machine — typos cause mismatchReception Worklist Bridge pushes the patient list to the machine — doctor just selects, never types
USG machine images are saved on the machine and lost — never end up in the reportDoctor DICOM Bridge pulls images and SR measurements directly into the report editor
PNDT compliance is tedious — Form F, signatures, registration numbers, sex determination wordingBuilt-in PNDT Form F auto-fill, automatic compliance footer, and AI is hard-coded to never mention sex determination
Reception, billing, receipts and reports live in different softwareSingle platform — patient registration, billing, receipts, reports, dashboards all in one place
No way for sales dealers to track or earn from their installed baseBuilt-in Dealer role with commission tracking, doctor linkage and payout requests

0.3 Who Uses It

👨‍⚕️ Doctor / Sonologist Owner of the practice. Creates reports, uses AI, prints, finalises. Manages their reception staff and DICOM machine.
👩‍💼 Reception Staff Front desk. Registers patients, takes payment, prints receipts, runs the daily worklist. Cannot edit reports.
🛡️ Admin (Softcode HQ) Internal Softcode team. Approves doctor signups, sets credit pricing, generates monthly bills, manages dealers.
🤝 Dealer / Distributor Field sales partner who sold the software. Tracks linked doctors, sees commission earned, requests payouts.

0.4 Key Differentiators (Sales Talking Points)

0.5 Technology Stack (For Engineers)

LayerTechnologyWhy
FrontendReact + TypeScript + Vite + TailwindCSSFast SPA, type safety, modern dark UI, responsive across desktop/tablet/mobile
Backend APINode.js + Express + TypeScriptLightweight, fast iteration, single-language stack
DatabasePostgreSQL with Drizzle ORMReliable, ACID, JSONB for flexible report fields, type-safe schema
AI EngineOpenAI GPT-4oBest clinical reasoning, natural language quality, multilingual support
Local BridgeNode.js DIMSE libraryImplements DICOM C-STORE SCP and C-FIND SCP (MWL) on the doctor's PC
AuthRole-based with stored credentialsUsername/password login routed by role (Doctor / Reception / Admin / Dealer). Note for engineering team: the current production build uses simplified credential checks — hardening to bcrypt + signed sessions is on the roadmap.
HostingReplit Cloud (production)Auto-scaling, integrated TLS, zero-ops deployment

1. AUTHENTICATION & ROLES

1.1 The Four Roles — Why Four?

Most clinic software gives every staff member full access. That creates two problems: junior staff can accidentally delete patient data, and there is no clean way for sales partners (dealers) to participate in the business. Softcode separates duties into four roles, each with the minimum permissions needed for the job.

1.1.1 Doctor Role

WHY The doctor is the medical authority and the customer of record. Only the doctor can produce, sign, and finalise a report.
HOW A doctor signs up via the public Doctor Registration tab. Their account is held in pending status until the Softcode Admin approves it (24–48 hours). After approval, they receive full access to their own clinic data.
USE Login → see their dashboard → register or scan patients → write reports with AI assistance → print and sign.
VALUE Single source of truth — every report carries the doctor's degree, registration number, signature and PNDT compliance footer automatically.

1.1.2 Reception Role

WHY Reception staff handle high-volume, low-risk tasks (registering walk-ins, taking payment, printing receipts). They must not be able to alter clinical reports — that would invalidate medical-legal protection.
HOW The doctor generates a unique Reception Code from their Settings → Profile tab. Reception staff sign up and enter that code — they are then automatically linked to that doctor and only see that doctor's data.
USE Login → directly into the Patients page → register patients, mark scans done, print receipts, run worklist.
VALUE Doctor offloads non-clinical work without losing clinical control. Multiple reception staff per doctor supported.

1.1.3 Admin Role (Softcode HQ Only)

WHY Softcode needs central control to approve new doctors (verify ID proofs to prevent abuse), set per-doctor credit prices, generate monthly bills, manage dealers, and run the cloud AI sync.
HOW Admin accounts are created internally. Admin sees a Doctor List with detail panels for every registered doctor — toggle add-ons, set price, generate bill, deactivate.
USE Login → Admin page → Doctor List → click any doctor → manage their account end-to-end.
VALUE Centralised billing and pricing means Softcode controls revenue. Per-doctor add-on toggles enable upsell tiers.

1.1.4 Dealer Role

WHY India's USG market is sold heavily through field dealers. Without a dealer role, Softcode would have to acquire every customer directly. With it, dealers become an extended sales force earning commission on every report their linked doctors generate.
HOW Each dealer gets a unique code (e.g. DLR-A3X9). They share it with doctors at the time of sale. Doctors enter that code at signup. From then on, every credit that doctor consumes earns the dealer a configurable commission.
USE Login → Dealer Dashboard → see linked doctors, credits used, profit accumulated → request payout when desired.
VALUE Recurring revenue for dealers turns one-time selling into a long-term partnership. Dealers actively support their doctors to keep usage high.

1.2 Login Flow & Security

User opens softcode app Login screen Enters Username + Password Backend verifies credentials against the user record Match? User identity established and stored on the client Role read from DB Frontend routes user to role-specific dashboard "Remember Me" tick persistent across browser restarts. Untick ends when tab is closed.
🔒 Engineer note: Auth hardening on the roadmap

The current production build uses a simplified credential check suitable for the present customer base. Planned hardening (in progress): bcrypt password hashing, signed server-side sessions, brute-force rate limiting, and instant session revocation when Admin deactivates an account. Engineering should treat this as the next priority before scaling to enterprise hospital chains.

1.3 Demo Mode

WHY Sales demos and exhibitions need a way to show the full software without creating real accounts or polluting the database with fake data.
HOW A built-in demo doctor account exists. When logged in as demo, the system flags user.isDemo = true. Print, delete and AI Train operations are all gated behind this flag and silently disabled.
USE Click "Demo" button on login → instantly explore everything.
VALUE Dealers can run a complete sales demo in 5 minutes without any setup. New doctors can self-evaluate before committing.

2. PATIENT MANAGEMENT

2.1 Why Patient Management Comes Before Reports

In every USG clinic, the workflow always starts at the front desk: a patient walks in, gives a referral slip, pays, gets sent to the scan room. By the time the doctor sees them, name, age, study type and payment must already be in the system. So Patients is the entry point of the software for both Reception and Doctor.

2.2 The New Patient Form — Field by Field, with Purpose

FieldWhy It Exists
Full NameMandatory — printed on the report. Forms primary identification on every screen.
Age, Gender, PhoneAge affects medical interpretation (e.g. paediatric vs adult ranges). Phone enables future SMS reminders and report sharing.
Study Type + Sub-typeDetermines which template loads in the editor, which measurement fields appear, and which AI prompt is used. Critical routing field.
Referred ByPrinted on the report. Referring doctor often calls back asking for the report — having the name on file makes the conversation easy.
Chief ComplaintSent to the AI as clinical context — the AI weighs findings differently when the patient came in with "right upper quadrant pain" vs "routine antenatal".
Billing Amount, Discount, Payment Mode, Payment StatusPowers the receipt printer, the dashboard revenue stats, and the daily collection report. Payment Mode (Cash/UPI/Card/Cheque/Online) lets receptionists track collections by mode.
Priority (Routine / Urgent / 🚨 Emergency)Visual triage. Emergency patients get a red badge in the list so the doctor knows to scan them next. Built for trauma centres and obstetric emergencies.
ID Proof Type + Number (Aadhaar/PAN/Passport/Voter ID)Required for PNDT obstetric records. Also helpful when government audits the clinic.
Patient PhotoUploaded or captured from webcam. Useful for identification at follow-up visits, especially in busy obstetric clinics.
Companion Name, Relation, PhonePNDT requires a companion entry for obstetric patients. Also useful for follow-up if the patient is reachable only through family.

2.3 Patient List — The Visual Status System

Each patient card shows colour-coded badges so doctors and receptionists understand the status at a glance — without opening the patient detail.

BadgeMeaningWhy It Matters
🚨 Emergency (red)Priority = EmergencyDoctor scans these first — visual triage
⚡ Urgent (amber)Priority = UrgentSecond priority after emergencies
Returning Patient (purple)This patient has visited beforeDoctor knows to check Compare Reports — IUGR or follicular tracking depends on it
3 img (blue)DICOM images linked from the machinePrint job will include images — tells reception to use higher-quality paper
Payment: Paid / Partial / Pending / ComplimentaryColor coded green/amber/red/purpleReception can chase pending payments at the end of the day
Study Type BadgeAbdomen / Obstetric / KUB etc.Doctor can mentally batch similar studies

2.4 Patient Status Badges (Newly Added — Mini Circles)

WHY The doctor often opens the patient list and asks: "Which patients still need attention? Which are fully done?" Without visual status indicators, this required clicking into each patient.
HOW Three small circles appear on each patient card representing three completion stages: When all three are complete, the circles are replaced by a single green "All Done" badge — the patient is fully processed.
Patient created All 3 circles empty (gray) Doctor opens PatientDetail POST /patients/:id/mark-viewed Eye circle fills Doctor saves a report hasReport = true (computed server-side) Document circle fills Doctor prints images hasPrintedImages = true Printer circle fills All 3 = true Replaced by green "All Done" badge
TECH Backend: GET /patients returns hasReport and hasPrintedImages per patient (server-computed JOINs). lastViewedAt column tracks viewing. POST /patients/:id/mark-viewed is auth-gated. Sort order is desc(createdAt) so newest patients appear at the top.
VALUE Doctor sees their workload at a glance. End-of-day, "All Done" badges across the board mean the day is closed. Massive workflow clarity for busy clinics doing 40+ scans/day.

2.5 PDF Export of Patient List

WHY Doctors and reception need a daily/monthly summary for tax filing, partner-doctor sharing, and clinic audits.
HOW The Export PDF button takes the currently filtered list (today / this month / specific date / search results) and generates a print-ready PDF with all relevant columns: patient name, age/sex, study type, payment status, priority, billing amount, date.
VALUE Tax-time friendly. Compliance friendly. Sharing friendly.

3. THE REPORT EDITOR & AI ENGINE

👨‍⚕️ Doctor only — the heart of the product

3.1 Why the Report Editor is the Hero Feature

Every other feature exists to feed or support the report editor. This is where the doctor's time is spent and where Softcode's value is most visible. A traditional report takes 3–5 minutes of typing and dictation. With Softcode, it takes 30 seconds: enter measurements → click Generate AI Draft → review → finalise → print.

3.2 The 30+ Study Templates

Every USG study has different measurement fields, different normal ranges, different reporting conventions. A one-size-fits-all editor would be useless. So we built dedicated templates for every common study type.

#TemplateSpecialty Focus
1Obstetric — 1st / 2nd / 3rd Trimester + TwinAntenatal monitoring, growth tracking
2Abdomen USGLiver, GB, kidneys, spleen, pancreas
3Whole Abdomen / KUB USGComprehensive abdominal survey / kidney-ureter-bladder
4Pelvis / Gynecology — Routine + Follicular StudyUterus, ovaries, follicle tracking for IVF
5Thyroid (with TIRADS)Nodule risk classification
6Breast (with BI-RADS)Lesion characterisation, screening
7Vascular Doppler — Carotid, DVT, PeripheralStenosis, thrombosis, peripheral disease
8Renal Doppler / TransplantRenal artery stenosis, transplant assessment
9Fetal EchoCardiac evaluation in utero
10Neonatal CranialThrough-fontanelle infant brain scan
11Musculoskeletal — Shoulder/Knee/etc.Tendon tears, bursitis, joint effusion
12Small Parts / Neck / Parotid / SalivaryLymph nodes, glands
13Scrotal / TesticularTorsion, varicocele, orchitis
14Prostate / TRUSProstate volume, BPH, cancer screening
15Endovaginal / EndometrialTVS findings, endometrial assessment
16Chest / Pleural USGEffusion, pneumothorax, lung points
17FAST / Trauma ScanEmergency intra-abdominal bleeding detection
18PediatricChild-specific abdominal protocols (intussusception, appendicitis)
19Interventional USGUSG-guided biopsies, aspirations
20CEUS (Contrast-Enhanced)Contrast agent enhancement patterns
21ElastographyLiver stiffness, lesion stiffness
223D / 4D ObstetricVolumetric fetal imaging

Each template loads its own measurement panel with the right fields, the right units, and the right AI prompt — the doctor never has to remember "what should I measure for thyroid".

3.3 AI Draft — How GPT-4o Writes Your Report

WHY Manual report typing is the single biggest time-sink in a sonography practice. AI eliminates 90% of that typing.
HOW v3.5 update: GPT-4o fires only when the doctor clicks the Generate Draft button — never automatically on SR/OCR import. This was changed to prevent unintended API calls and give the doctor full control. When the button is clicked:
Frontend collects: patient (name, age, sex), study (type, sub-type), measurements, chief complaint, doctor profile, AI training notes POST /api/ai/draft with the structured payload Server builds GPT-4o prompt: system role = "experienced sonologist", user prompt = structured measurements + context, plus doctor's previous corrections injected as style notes GPT-4o returns: { findings: "...", impression: "..." } Server: deduct 1 credit, log usage (tokens, cost), audit trail Frontend: populate Findings + Impression text areas (still editable)
USE Doctor enters measurements → click Generate AI Draft → in 8–10 seconds the report appears. Doctor reviews, edits if needed, finalises.
VALUE 3-minute report becomes 30-second report. Cost: roughly ₹0.20–0.40 per draft. Doctors easily save 2 hours per day.
⚠️ Sales talking point — AI is a draft, not a diagnosis

Always frame the AI as a "professional first draft writer that the doctor reviews and signs". This is medico-legally important — the doctor is fully responsible for what they print. Softcode never replaces clinical judgement; it removes typing.

3.4 Train AI — How Personalisation Works

WHY Every doctor has personal phrasing preferences ("I always write 'gross-pathology not seen' instead of 'no abnormality detected'"). A generic AI sounds robotic and unlike the doctor. Train AI fixes that.
HOW When the doctor edits AI-generated text and clicks Train AI, the system stores the edit as a "correction note" attached to that doctor and that study type. On the next AI Draft, those correction notes are injected into the GPT-4o system prompt: "This doctor prefers: write AFI in cm not mm. Always state 'EDD by LMP' explicitly."
Doctor edits AI text Train AI button glows amber Click Train AI POST /api/corrections Backend extracts the diff (original AI text vs doctor's version) Stores as a structured correction: { doctorId, studyType, hint: "...", patternBefore, patternAfter } On next AI Draft for same studyType all stored hints are prepended to the system prompt as "Doctor preferences" GPT-4o follows them automatically
VALUE Within 2–3 weeks of use, the AI sounds exactly like the doctor — patients and referring doctors cannot tell the difference. This is the killer "stickiness" feature: switching to a competitor means losing all that learning.

3.5 Quick Templates (Pre-filled Reports)

WHY Many findings are standard and repeated daily — "Normal Abdomen", "1st Trimester Normal", "BPH Grade I". Why use AI credit for these?
HOW The Templates page contains 25 pre-built clinical templates plus a personal library where the doctor can save their own. One-click insert into the report editor — no AI credit consumed.
VALUE Doctors save AI credits for complex cases. Standard reports take 5 seconds.

3.6 QA Check — Quality Assurance Before Print

WHY Doctors sometimes miss measurements (e.g. forgot to enter EDD on an obstetric scan). Printing an incomplete report is embarrassing and medico-legally risky.
HOW Click QA Check → AI reviews the report and flags: VALUE Reduces medical-legal risk. Builds doctor confidence. PNDT compliance auto-enforced — no human can accidentally include sex determination.

3.7 Voice Input (Add-on)

WHY Some doctors prefer dictation, especially senior doctors who type slowly. They can also dictate while still scanning.
HOW Microphone button in the Findings field → real-time transcription via browser speech recognition → AI cleans the dictation into clinical English.
VALUE Faster reports for doctors who prefer voice. Optional add-on with separate billing.

3.8 Anatomy Diagrams (Add-on)

WHY Patients understand pictures better than text. Adding an anatomy diagram to the report makes it look more professional and helps the patient understand the findings.
HOW Built-in SVG organ diagrams render based on study type (liver, gallbladder, kidneys for abdomen; uterus, ovaries for pelvis; thyroid lobes for thyroid). Measurements are auto-annotated on the diagram. Tick "+ Diagram" in print toolbar to include.
VALUE Premium-looking reports. Add-on revenue. Patient satisfaction.

3.9 Compare Reports (Add-on)

WHY For follicular studies, IUGR follow-ups, fibroid monitoring, the previous scan is critical. Without compare, doctors flip through paper records.
HOW Compare button shows all of this patient's previous reports. Pick one → side-by-side view with key changes highlighted (e.g. fibroid grew from 2.1cm to 2.6cm).
VALUE Premium feature for chronic-follow-up clinics. Add-on revenue.

3.10 DICOM SR Auto-fill

WHY The USG machine already measured everything (BPD, HC, AC, FL etc.). Re-typing all of it into the report is error-prone wasted work.
HOW The USG machine sends a DICOM Structured Report (SR) to the local bridge → bridge forwards it to Softcode cloud → it appears in the DICOM Inbox on the Patients page. Click Use DICOM Data → all measurements auto-fill into the report editor with no typing.
VALUE Zero data re-entry. Eliminates measurement transcription errors. Sales killer feature for high-volume clinics.

3.10A OCR Screenshot Pipeline — Measurement Auto-Fill Without DICOM

WHY Many clinics in India have budget USG machines (Chison, SonoScape entry-level, portable units) that don't support DICOM networking. They can't use the SR bridge. But they still need measurements auto-filled to benefit from AI drafting.
HOW Doctor or reception takes a clear photo/screenshot of the USG machine screen showing the measurement readout. The image is uploaded in the Softcode UI. Tesseract OCR (running entirely client-side in the browser — no data sent to cloud) processes the image, extracts numeric values and unit labels, maps them to standard measurement names (BPD, HC, AC, FL, EFW, GA) using regex patterns and the GA_LABELS normalisation dictionary, then silently populates the report editor fields. No AI draft fires — the doctor reviews the values and clicks Generate Draft when ready.
TECH src/utils/localOcr.tsGA_RE regex, GA_LABELS mapping, normalizeGaValue(). src/pages/PatientDetail.tsxhandleOcrMeasurements(data, autoMode=true) fills fields silently when autoMode=true. Tesseract runs via tesseract.js WASM in the browser — zero PII leaves the device during OCR.
SALES "Even a non-DICOM machine gets measurements auto-filled. Any clinic, any machine, any budget — AI drafts in 8 seconds."

3.11 Finalise & Lock

WHY Once a report is printed and signed, it becomes a legal document. Editing it after the fact is fraud.
HOW Click Finalise → confirmation dialog → report status becomes Locked → text editing disabled → Print and PDF buttons enabled. On finalization, the system also: (1) auto-saves a PDF to the doctor's local drive via the bridge, and (2) increments the daily milestone counter — if the count hits exactly 50, 100, or 150, a celebration overlay fires automatically.
VALUE Medico-legal compliance. Print only happens on finalised reports — no half-edited documents leak out. Local PDF backup requires no extra step.

3.12 Daily Milestone Celebrations

WHY A doctor finalizing 50+ reports in a day is performing at an extraordinary level. Acknowledging that — briefly, professionally — costs nothing and builds a sense of partnership between the doctor and the software they use every day.
HOW Every call to doFinalize() increments a browser localStorage key (sc_dfin_YYYY-MM-DD). When the counter equals exactly 50, 100, or 150, the MilestoneCelebration component mounts as a position:fixed full-screen overlay with z-index:9999 above all other UI. A canvas element covers the viewport and renders 8 firework bursts (70 particles each, coloured, gravity-physics, alpha-fade). A dark-glass card with gradient text headline and a professional message is centred on the overlay. Auto-dismisses after 3.5 s; clicking anywhere also dismisses.
TECH src/components/MilestoneCelebration.tsx — fully self-contained React component. incrementDailyFinalized() and isMilestone() are exported helpers. The previous day's key is garbage-collected on the next increment. Zero API calls. Zero PII. The counter stores only an integer — never a name, ID, or clinical value. Key format example: sc_dfin_2026-04-29.
VALUE Doctors in busy Indian USG practices commonly remark that the software "feels cold" compared to expensive international alternatives. This feature is a low-cost, high-impact differentiator that makes Softcode feel alive and human.
SALES "The app knows when you've reached 100 reports. It celebrates with you. No other USG software in India does this."
MilestoneHeadlineMessage
5050 Reports Finalized Today 🏆"Remarkable dedication, Doctor. You have helped 50 patients today — your commitment to quality care is truly commendable."
100100 Reports — Outstanding Achievement 💯"A century of finalized reports in a single day. Your expertise and efficiency are making a real difference for every patient you serve."
150150 Reports Today — Exceptional 🚀"150 patients have received your expert care today. This level of dedication is what defines an exceptional clinician. Well done, Doctor."

4. FETAL GROWTH CHARTS & IUGR DETECTION

4.1 Why This Module Justifies the Whole Product

For obstetric practices, growth charts are the single most clinically valuable feature. International software costs ₹3+ lakh per year for this. Softcode bundles it.

4.2 When Charts Appear

Charts appear automatically only when:

  1. Study Type = Obstetric
  2. Sub-type = 2nd Trimester (14–28 weeks) OR 3rd Trimester (28–40 weeks)
  3. The relevant measurements have been entered

4.3 The 10 Charts & Their Reference Standards

GroupChartColorReference
BiometryBPD (Biparietal Diameter)BlueHadlock / INTERGROWTH-21st
HC (Head Circumference)PurpleHadlock / INTERGROWTH-21st
AC (Abdominal Circumference)CyanHadlock / INTERGROWTH-21st
FL (Femur Length)GreenHadlock / INTERGROWTH-21st
WeightEFW (Estimated Fetal Weight)Amber/GoldHadlock 1985 formula
DopplerUA-PI (Umbilical Artery PI)RedArduini & Rizzo
UA-RI (Umbilical Artery RI)OrangeArduini & Rizzo
UA S/D RatioPinkArduini & Rizzo
Uterine Artery PIIndigoPapageorghiou
MCA-PI (Middle Cerebral Artery)TealMari

4.4 What Each Chart Visually Shows

4.5 IUGR Detection on the Dashboard

WHY Intrauterine Growth Restriction is a leading cause of foetal death. Catching it early saves babies.
HOW The Doctor Dashboard automatically scans every obstetric patient's EFW vs Hadlock reference. Any patient below P10 is flagged. The doctor sees a quick "IUGR Watch" card with all at-risk patients.
VALUE Lifesaving early detection. Massive trust signal for obstetric practices.

4.6 Print — High-Quality Color Charts

Tick + Growth Charts in the print toolbar (purple checkbox). The PDF output includes all 10 charts in full colour, properly paginated, with the patient's data points clearly visible. Patients love taking these home — they look like a hospital chart.

5. PRINT & DOCUMENTATION SYSTEM

5.1 Three Things Get Printed

DocumentWho PrintsFormat
USG ReportDoctor (after Finalise)A4, with header, findings, impression, signature, PNDT footer
Patient ReceiptReception (after registration)A4 or thermal, with name, study, gross/discount/net, payment mode, status, priority
DICOM Image SheetDoctorA4, configurable grid (1×1, 2×2, 3×2), white or black clinical theme

5.2 USG Report — What the Final Print Contains

v3.5 Smart Print Layout — Adaptive Page Count
ConditionPagesLayout
Obstetric, no DICOM images, no Doppler2Page 1: findings + impression + signature; Page 2: fetal charts + anatomy diagram + signature
Obstetric, no DICOM images, Doppler present2–3Page 2: charts + diagram; Page 3: Doppler values + larger diagram + signature
Any report with DICOM images attached3Standard 3-page layout — report, charts, images
Non-obstetric1Single page — findings + impression + signature

Doctor signature block appears on every page — no unsigned pages in any multi-page printout.

SectionContentAlways or Optional
Header BarClinic name, address, phone, PNDT Reg. No.Always (from Settings → Profile)
Title Bar (Blue)e.g. "ULTRASONOGRAPHY REPORT — OBSTETRIC (2ND TRIMESTER)"Always
Patient Info TableName, Age/Sex, Referred By, Date, SonologistAlways
Measurements TableAll filled measurements in 2-column layoutIf measurements exist
Anatomy DiagramOrgan illustration with annotationsOptional (+ Diagram checkbox)
Findings (large block)Detailed clinical findings — AI or doctor writtenAlways
Impression (amber box)Conclusion / summaryAlways
Fetal Growth Charts10 colour percentile chartsOptional, OB 2nd/3rd only
PNDT Compliance FooterLegal disclaimer + Centre Reg. No.Auto for obstetric reports
Doctor Signature ImageUploaded signature, 52px tall × max 160px wideAlways (from Settings → Signature)
Doctor Name + Degree + Reg. No.Below signatureAlways
Generation Timestamp + AI Assisted LabelBottom — for traceabilityAlways

5.3 DICOM Image Sheet — Layout Options

WHY Different studies need different image counts. A thyroid scan has 2–3 images, a comprehensive abdomen has 6+. One layout doesn't fit all.
HOW Doctor selects layout: 1×1 (one big image), 2×2 (four images), 3×2 (six images per page). Each image can be zoomed and panned before printing. Theme switch between white background (for paper economy) and black background (for true clinical look matching the USG monitor).
VALUE Premium-looking image sheets. Doctors can hand patients a professional set of scan images.

5.4 Receipt Print — What Reception Hands the Patient

6. DICOM INTEGRATION — TWO BRIDGES, ONE WORKFLOW

6.1 Why DICOM Matters

USG machines speak DICOM. Without DICOM integration, the doctor types every patient name twice (once in software, once on machine), takes machine images on USB, transfers to PC, manually attaches to report. That's 5 minutes wasted per patient. With DICOM, all of that is automatic.

6.2 The Two Bridges Explained

Bridge #1 — Reception Worklist Bridge Direction: Software → USG Machine
Purpose: send today's patient list to the machine so the operator just selects, never types.
Protocol: DICOM C-FIND SCP (MWL — Modality Worklist).
Bridge #2 — Doctor Receiving Bridge Direction: USG Machine → Software
Purpose: pull DICOM images and SR measurements from the machine straight into the report.
Protocol: DICOM C-STORE SCP.

Both bridges are implemented in the same single Node.js process running on the doctor's PC, listening on a single port (4145). One installer sets up both. One configuration in the USG machine activates both.

6.3 The Complete End-to-End Flow

[Morning] Reception registers patients in Softcode (10 patients today) Reception clicks "Push to Bridge" (or it pushes automatically) Bridge sits on the doctor's PC, port 4145 USG machine queries the bridge for today's worklist (MWL) All 10 patients appear on the machine — operator just selects [During Scan] Operator scans patient #3 → measurements done on machine Operator presses "Store" on the machine Machine sends DICOM SR + images to the bridge (C-STORE) Bridge parses the SR, extracts measurements Bridge forwards to Softcode cloud (HTTPS, token auth) Softcode shows entry in DICOM Inbox on Patients page (yellow card) [Doctor Reports] Doctor opens patient #3 → sees "Use DICOM Data" button Click → all measurements auto-fill in report editor Click "Generate AI Draft" → report appears in 8 seconds Review → Finalise → Print

6.4 The Installer — What It Actually Does

One Windows .bat installer. Run as Administrator. The user sees a progress bar; the script silently does this:

  1. Checks if Node.js is installed; downloads and installs if missing
  2. Creates folder C:\SoftcodeBridge\
  3. Copies the bridge JS file
  4. Adds inbound Windows Firewall rule: TCP port 4145 allowed
  5. Adds Windows Defender exclusion for the bridge folder (so antivirus does not delete files)
  6. Creates a Task Scheduler entry "SoftcodeBridgeTray" that auto-starts on every login (30s delay, highest privilege)
  7. Starts the bridge immediately

Result: the doctor sees a small tray icon near the clock. The bridge runs forever, even after Windows restarts.

6.5 8 USG Machine Brands Pre-Configured

BrandMenu Path on Machine
Samsung (Medison)System Menu → Setup → Network → DICOM Settings
GE (Voluson / Logiq)Config ⚙ → Connectivity → DICOM → Devices → Add
PhilipsSystem → Connectivity → DICOM → Worklist Server
MindraySystem → System Configuration → Connectivity → DICOM
SonoScapeSystem → Network → DICOM Servers
ChisonSetup → Network → DICOM → Add Server
Toshiba / CanonPatient → DICOM Setting → Remote Host
Voluson (GE series)Connectivity (same as GE)

Settings tab in Softcode shows step-by-step accordions for each brand — engineer never has to look anything up.

6.6 Auto-Patient Creation (Smart Match)

WHY Sometimes the machine sends data for a patient who was never registered (operator skipped worklist). We don't want that data to be lost.
HOW Bridge receives DICOM with patient name. Softcode tries to match against existing patients (case-insensitive, fuzzy). High confidence match → auto-link. Low confidence → DICOM Inbox shows it as "unmatched" — doctor manually links or creates a new patient with one click.
VALUE No data ever gets lost. Walk-in patients are absorbed automatically.

7. THE AI LEARNING SYSTEM & CLOUD SYNC

7.1 Two Levels of AI Learning

LevelScopeHow It Improves
Personal LearningPer doctorDoctor's edits → stored as correction notes → injected into future drafts
Cloud LearningAcross all Softcode doctorsAnonymised aggregated corrections → monthly merge into the master AI model on Softcode cloud

7.2 Personal Learning — How Train AI Persists

Already explained in section 3.4. Quick recap of the data structure: each correction is stored as { doctorId, studyType, hint, patternBefore, patternAfter, createdAt }. On every AI draft, the system gathers all hints for that doctor + study type and prepends them to the GPT-4o system prompt as "This doctor's preferences (always follow): ...".

7.3 Cloud Sync — Monthly 28th

WHY Individual doctors discover writing improvements that should benefit everyone. A new doctor signing up should not have to start from zero.
HOW
  1. Throughout the month, every doctor's corrections are stored locally on Softcode servers (per doctor)
  2. On the 28th of every month, the Aggregator job runs:
    • Strips all PII (patient names, IDs, anything identifying)
    • Groups corrections by study type
    • Counts how many doctors made each kind of correction
    • Promotes corrections present in 5+ doctors to the master cloud model
  3. Smart merge: cloud model only overrides individual hints when the cloud has more evidence than the doctor's personal store
  4. New doctors signing up automatically inherit the master model's accumulated wisdom
VALUE Network effect — every Softcode customer makes every other Softcode customer's AI better. Massive moat against competitors.

7.4 Admin Import / Export of AI Model

The full trained model can be exported as a JSON file by Admin. This is used for:

8. ADMIN CONTROL PANEL

🛡️ Softcode HQ only

8.1 What Admin Sees on Dashboard

Stat CardWhy It Matters to Softcode
Total DoctorsAcquisition metric
Active DoctorsEngagement metric — paying customers
Total Billed (₹)Revenue this month/year
Amount Pending (₹)Outstanding collections — for follow-up
Total Cleared (₹)Confirmed cash flow

8.2 Doctor Registration Approval

WHY Anyone could register pretending to be a doctor. We need ID verification before granting access — both for product integrity and for legal protection.
HOW New doctor signup goes into Pending status. Admin sees them under Registrations → reviews ID proof, clinic name, dealer code → Approves (sends welcome email + activates login) or Rejects with reason.
VALUE Quality control. Prevents fraud. Builds trust with referring doctors and patients.

8.3 The Doctor Detail Panel — End-to-End Account Control

Click any doctor → opens a detail panel with full control:

SectionWhat It Does
Doctor InfoRead-only display of name, email, clinic, degree, reg no., signup date
Add-ons TogglesVoice / Diagram / Compare / Print Images — turn each ON or OFF for this doctor. Drives upsell tiers.
Set Credit Price₹ per AI credit for this doctor. Different doctors can have different prices (e.g. high-volume gets discount).
Recharge CreditsManually add credits to the doctor's account when they pay (e.g. ₹5000 → 250 credits at ₹20 each).
Credits Used This MonthEditable for manual corrections (e.g. waive credits during disputes)
Generate BillAuto-creates monthly bill: credits × price + add-on usage
Mark Bill PaidAfter payment received, mark as paid → shows in history
DeactivateDisables login but keeps all data. Doctor cannot log in until reactivated.

8.4 Cloud AI Sync Control

Admin sees the cloud sync dashboard: when last sync ran, how many corrections were merged, breakdown by study type. Admin can trigger manual sync if needed.

8.5 Dealer Panel

TabWhat It Does
RegistrationsApprove / Reject new dealer signups
DealersActive dealers list, their codes, linked doctor counts
Dealer DetailsDive into one dealer: linked doctors, billing history, profit accumulated
Payout SectionProcess dealer payout requests. Mark paid when transferred.

8.6 Company / Vendor Profile (For GST Invoices)

Stores the Softcode entity details that print on every invoice: business name, GSTIN, PAN, bank details, UPI ID, owner name, address. Admin updates once; reflected on every invoice.

9. DEALER COMMISSION SYSTEM

🤝 Sales partner role

9.1 The Business Model

A dealer signs up → Softcode gives them a unique code. They go to clinics, demo the software, and convince doctors to install. The doctor enters the dealer code at signup. From that point on:

9.2 The Dealer Dashboard

Stat CardWhat It Shows
Linked DoctorsCount of doctors using the dealer's code
Credits UsedTotal credits consumed by all linked doctors
Total Billed (₹)Revenue Softcode has billed those doctors
Your Profit (₹)Dealer's share of that revenue — ready for payout

9.3 Linked Doctors & Doctor Bills Accordions

Click to expand → see per-doctor breakdowns. Dealer knows exactly which clinic is generating the most revenue and can focus retention there.

9.4 Request Profit Payout

WHY Dealers should be able to ask for their commission without an awkward phone call.
HOW Click the button → Admin gets a notification → Admin processes payout → marks paid → dealer's profit balance resets. After clicking, the button changes to "Payout reminder already sent to admin" until processed (prevents spam).
VALUE Self-service for dealers. No friction in the partner relationship.

10. SETTINGS — EVERY TAB EXPLAINED

10.1 Profile Tab

The most important tab — it controls what prints on every report.

10.2 My Bills Tab

Doctor sees their own credit balance, total credits used, total amount charged by Softcode (or their dealer). Can filter by Paid / Unpaid / Pending. Download all bills as PDF for accounting.

10.3 Password Tab

Standard password change with current-password verification. Min 6 characters.

10.4 Signature Tab

Upload a transparent PNG of the doctor's signature. Renders at exactly 52px tall × max 160px wide on every printed report. Without this, reports print without a signature image — only the typed name.

10.5 PNDT Tab

Stores a URL link to the doctor's online PNDT registration certificate. The actual PNDT number that prints on reports comes from the Profile tab; this is just a reference link for the doctor's own use.

10.6 Local Bridge Tab — DICOM Setup

Where the doctor configures their DICOM machine link. Generates the secure token, downloads the bridge JS and the Windows installer, shows the IP/Port/AE Title to enter into the machine. Includes step-by-step accordion guides for 8 USG brands. See section 6 for the full flow.

10.7 Live Chat Tab

Direct messaging to the Softcode support team. Real-time. Chat history preserved.

10.8 Reception Staff Tab

For admin doctors managing multiple reception accounts. Add, list, remove reception staff. View the unique Reception Code they need to enter to link themselves.

10.9 AI Learning Tab

See how many corrections the AI has learned per study type. Reset training data if you want to start fresh. View the training quality score.

10.10 Audit Trail Tab

WHY Medico-legal requirement — every important action (login, report generated, report finalised, deleted, printed) must be logged with timestamp and user.
HOW Server-side log of every state-changing operation. Filterable by user, action type and date range. Exportable for legal audits.
VALUE Compliance. Trust. Disputes resolved by checking the audit log.

10.11 Feedback Tab

Submit two types: Software Issue (bugs, feature requests) and HL7 Monthly Feedback (clinical standards input — once a month each clinic sends a structured note about real-world findings to Softcode for AI improvement).

11. COMMUNICATION & SUPPORT

11.1 Three Channels

ChannelWho → WhomPurpose
Floating AI Chat 💬Any user → AIClinical queries — "What is TIRADS 4?", "Normal AFI range?"
Live Chat (Settings)Doctor / Dealer → Softcode Support TeamSoftware help, billing questions
Internal ChatDoctor ↔ Reception"Patient on table — finalise quickly please"

11.2 Floating AI Chat

Bottom-right of every page. Click to open a chat panel powered by GPT-4o. Doctor can ask any clinical question and get an instant evidence-based answer. Cost-free for the doctor (Softcode absorbs token cost — usually pennies).

11.3 Live Chat — Direct Line to Softcode

From Settings → Live Chat. Real-time messaging to the Softcode support team. Online status visible. History preserved across sessions.

12. CREDIT & BILLING SYSTEM

12.1 What Costs Credits

ActionCostWhy
Generate AI Draft1 creditOne GPT-4o call
Regenerate AI Draft1 creditAnother GPT-4o call
QA Check1 creditAnother GPT-4o call
Voice InputPer add-on priceSpeech recognition + GPT cleanup
Anatomy DiagramPer add-on priceAdd-on subscription
Compare ReportsPer add-on priceAdd-on subscription
Patient registration / view / edit / print / DICOM / templatesFreeCore features must always work even with zero credits

12.2 Per-Doctor Custom Pricing

Admin sets the ₹/credit price separately for each doctor. High-volume clinics get discounted rates. Trial doctors might get a lower introductory price. Add-ons priced separately. The doctor never sees the ₹ price — only their credit balance.

12.3 Low Credit Warning

12.4 Monthly Billing Cycle

On the 28th of every month, Admin clicks Generate Bill for each doctor → bill = (credits used × price) + add-on usage. Doctor sees the bill in My Bills tab. Pays via UPI/bank transfer to Softcode → Admin marks Paid → invoice issued.

13. SECURITY & DATA PRIVACY

13.1 Authentication Hardening

13.2 Patient Data Privacy

13.3 PNDT Compliance

13.4 Audit Trail

Every important action (report created, finalised, deleted, printed, AI generated, login, password change) is logged server-side with timestamp + user ID. Available for download in legal disputes.

14. SALES PLAYBOOK — TALKING POINTS & FAQ

14.1 The 30-Second Elevator Pitch

"Softcode USG AI Assist is an AI-powered ultrasonography reporting platform. The doctor enters measurements, GPT-4o writes a complete clinical report in 8 seconds, and the AI personally learns each doctor's writing style over time. It connects directly to your USG machine via DICOM, prints PNDT-compliant reports with fetal growth charts, and runs entirely in the browser — no installation, works on laptop, tablet or phone. ₹X per month per doctor."

14.2 Top 10 Sales Objections & Answers

ObjectionAnswer
"AI will make medical mistakes."The AI is a draft writer. The doctor reviews and signs every report — final responsibility stays with the doctor. Plus the QA Check catches missing fields before printing.
"My existing software is fine."How long does a report take to type? Multiply by 30 reports a day. That's 2+ hours of typing daily that Softcode eliminates. Your time alone pays for the software 10× over.
"Internet outages will block me."Existing reports remain viewable and printable offline. AI draft requires internet (so does GPT-4o), but the rest of the workflow degrades gracefully.
"PNDT issues — sex determination liability."The AI is hard-coded to refuse sex determination. The QA check explicitly blocks it. PNDT Form F is auto-generated. We are more compliant than your current paper system.
"My USG machine is old."Any DICOM-capable machine since 2005 works. We support Samsung, GE, Philips, Mindray, Voluson, SonoScape, Chison, Toshiba/Canon. Show me your machine model — I will confirm.
"What about my staff who don't know computers?"Reception screen is one page — register patient, take payment, print receipt. Designed for non-technical staff. Doctor screen has AI; staff doesn't.
"How much will it cost long-term?"Pay-per-report model — ₹X per AI report, ₹0 for everything else (registration, viewing, printing, DICOM). Predictable and proportional to your business volume.
"What if you go out of business?"You can export all your data anytime as PDF/CSV. Reports are downloaded; nothing is locked in.
"I want to try before I buy."Click Demo on the login screen → instantly explore everything. No signup needed.
"Can I edit AI mistakes?"Yes — every line is editable until you Finalise. And Train AI ensures the same mistake doesn't repeat.

14.3 Pricing Models for Different Customer Sizes

CustomerSuggested PlanReasoning
Solo doctor, 5–10 scans/day200 credits/month basic, no add-onsLow volume — low cost — quick adoption
Mid clinic, 20–30 scans/day500 credits + Voice + Diagram add-onsVolume justifies add-ons; voice saves time
Multi-doctor practice, 50+ scans/dayCustom enterprise pricing per doctor + all add-onsHigh value, recurring revenue, dealer commission
Hospital chainVolume pricing + Admin custom training importBulk negotiation, branded training data

14.4 Why Doctors Switch to Softcode (Real Reasons)

  1. Time saved — 2+ hours of daily typing eliminated
  2. Professional reports — fetal growth charts & PNDT compliance look premium to referring doctors
  3. DICOM integration — eliminates re-typing patient names into the machine
  4. Personalised AI — sounds like the doctor wrote it, not generic
  5. One-time setup — no software install on every device, browser-based
  6. Local language support — voice input handles English-mixed dictation common in Indian practice
  7. Audit trail — peace of mind for medico-legal disputes

15. QUICK REFERENCE — THE COMPLETE WORKFLOW

SOFTCODE USG AI ASSIST — END-TO-END FLOW PATIENT WALKS IN RECEPTION registers patient (name, age, study type, payment) RECEPTION pushes worklist to USG machine via bridge PATIENT goes to scan room DOCTOR selects patient on USG machine (no typing) DOCTOR scans → measurements + images saved on machine DOCTOR presses "Store" on machine DICOM SR + images flow to Softcode bridge → cloud DOCTOR opens patient in Softcode → measurements auto-filled DOCTOR clicks "Generate AI Draft" → report appears in 8 sec DOCTOR reviews → optionally edits → clicks "QA Check" DOCTOR clicks "Finalise" → report locked DOCTOR clicks Print (with + Diagram, + Growth Charts as desired) PATIENT receives professional A4 report with signature, growth charts, anatomy diagram, PNDT compliance footer RECEPTION prints receipt → patient leaves END OF DAY: Doctor sees "All Done" badges across patient list END OF MONTH (28th): Admin generates bill, Dealer requests payout, Cloud AI sync runs automatically

Document Control

FieldValue
DocumentFeature Deep Dive Guide (6 of 6)
AudienceEngineering · Sales · Marketing — internal only
Version3.9
IssuedMay 2026
Last revisedMay 2026
StatusCurrent — supersedes all earlier versions
OwnerSoftcode Engineering Office
Legal entitySoftcode
Websitewww.softcodehq.com
Support[email protected]

Version Control

VersionDateChange Summary
3.9May 4, 2026Bridge v4.9.27 — local API token auth (x-bridge-local-token header required on all endpoints except /health; 32-byte crypto token generated on first startup, stored in bridge.config.json, returned by /health; frontend window.fetch interceptor in main.tsx auto-injects token). Bridge JS obfuscation (javascript-obfuscator RC4 + control flow flattening + self-defending; source → softcode-bridge.src.js, output → softcode-bridge.js 278 KB; build-obfuscate.sh for rebuilds). Standalone binary distribution (SoftcodeBridge-win.exe node12-win-x64 ~30 MB Windows 7/8/10/11; SoftcodeBridge-mac node18-mac-x64 ~50 MB macOS; both via pkg; backup to primary .bat installer; downloadable from Settings → Local Bridge). Softcode logo refresh — transparent-background gold logo on login page (w-32 h-32, gold glow drop-shadow) and sidebar (w-16 h-16).
3.8May 3, 2026SR pre-probe badge — pre-scan "✓ SR ready / ⟳ SR check / no SR" indicator next to the OCR/AI buttons in PatientDetail.tsx (~line 3754); driven by a new useEffect that probes the bridge's /measurements/<key> endpoint with a 2.5 s abort timeout, using the same key cascade (accessionNumberstudyIdpatient.name) the OCR pipeline uses. Doctor sees — before clicking — whether SR is ready; saves unnecessary AI calls. Adaptive OCR engine re-benchmark in src/lib/hardwareCheck.ts — 3 triggers: AGE (snapshot > 7 days), PROXIMITY (mpps within ±20% of the 50 Mpps threshold), MANUAL ({ force: true }). Diagnostic snapshot now carries rebenchReason. New exports: requestRebenchmark(), isOcrBenchmarkStale(). ensureOcrEnginePreference() signature unchanged — backward compatible. Eliminates stale routing on borderline PCs and turns "OCR slow" support calls into 30-second diagnoses.
3.7May 2, 2026Bridge v4.9.0 — WhatsApp Send to Patient module (Baileys WhatsApp Web client, QR pairing UI hosted at localhost:4145/whatsapp; POST /whatsapp/send accepts { number, message, files }; auth state at <basePath>/whatsapp-auth/; auto-reconnect except on explicit logout). Frontend: WhatsAppSendModal.tsx with bridge-status polling, patient + doctor WA number fields, Report PDF + Images PDF generation via jsPDF; gated on per-doctor addonWhatsapp flag at ₹0.70/use. Installer V33 bundles npm install of Baileys at install time. Anatomy assets AES-256-CTR encrypted (key embedded in JS bundle for casual-scraper protection); decrypt helper in src/lib/anatomyDecrypt.ts; build script scripts/encrypt-anatomy.mjs; 26 anatomy files (15 full-frame + 11 multi-panel) under public/anatomy/*.png.enc. Diagram routing in ReportEditor.tsx ~lines 4232–4318 picks the right asset by template/subtype. Train AI button now appears whenever currentText.trim() !== (aiOriginal ?? "").trim(), so manual-from-scratch reports are training-eligible. Per-frame OCR LABEL_MAP + SHORT_TO_LABEL extended to 10 new organs (pancreas, bladder wall, prostate, aorta, ivc, pv, isthmus, ys, nb, tcd); SMALL_CALIPER_KEYS fallback for diameter/thickness; mm-unit normalisation in fallback 3 fixed; client/server LABEL_MAP aligned. Print modal Auto-fit shortcut. Bridge v4.8.5 hardens patient matching with full-name + study-date check; v4.8.4 removed cross-patient stealing exception.
3.6May 2, 2026Production launch on Replit Autoscale Asia (2 vCPU / 4 GiB RAM, max 3 machines, scale-to-zero); public URL sonography-assistant.replit.app; recommended monthly spend cap $200 (~₹16 500). Purple "SR Detection" badge added in PatientDetail.tsx ~line 3539 (gated on dicomMeasLoaded && (ocrSource === "sr-ocr" || null)). SR-driven early-stop OCR added via reportPageFound() helper inside Phase A & B loops in PatientDetail.tsx lines ~1355–1425 — typical scan time drops from ~30 s to ~5 s, per-scan compute drops by ~80%. Sharp preprocess, six-worker Tesseract pool clamped to min(6, os.cpus()), PSM3 fast-path and batch size 12 retained.
3.5May 2, 2026Smart print layout — pages 2 and 3 auto-merge when no DICOM images present; fetal charts and anatomy diagram share one page. AI draft is now manual-only: GPT-4o fires only on "Generate Draft" button click, never automatically. Doctor signature added to every print page. Indian radiology (IRIA) style AI prompt — "noted", "s/o", concise numbered findings, EDD line, "Clinical correlation advised" closing. OCR pipeline silently auto-fills measurements from USG screenshots without triggering a draft.
3.4April 2026Documentation refresh: added Softcode logo to the cover; added expanded Document Control with legal entity, website, support email and last-revised date; added explicit Version Control table; added "Approved by" signature block; added clear informational disclaimer. No software behaviour change — all v3.3 engineering, sales and marketing content remains accurate.
3.3Apr 28, 2026Bridge installer creates all four data folders automatically; engineering, sales and marketing notes updated.
3.2April 25, 2026PDF auto-save on finalization to local bridge folder; PNDT Form F local save; multi-frame DICOM support with frame-0 thumbnail; image sheet print with selectable layouts (1×1 to 4×4).
3.1April 18, 2026DICOM SR parser (vendor-agnostic: Samsung, GE, Philips, Mindray, Voluson, SonoScape, Chison, Toshiba/Canon) — measurements auto-fill report editor; DICOM Modality Worklist bridge (C-FIND); HL7 feedback channel; AI cloud sync.
3.0April 12, 2026AI-powered report drafting (GPT-4o); Indian radiology style prompts; anatomy diagram (obstetric); fetal growth charts (BPD, HC, AC, FL); EDD calculator; Doppler measurements; obstetric risk panel.
2.0April 8, 2026DICOM bridge core: USG machine → local PC bridge → cloud; DICOM C-STORE SCP; real-time image streaming to browser; per-patient image viewer with multi-layout print.
1.0April 2, 2026Initial product launch: patient registration, manual report editor, doctor and reception login, role-based access, basic USG reporting workflow, billing and receipts.
3.0April 12, 2026AI-powered report drafting (GPT-4o), anatomy diagram, fetal growth charts, EDD calculator, Doppler, obstetric risk panel. First public release of this Feature Deep Dive guide.
2.0April 8, 2026DICOM bridge core: USG machine → local PC bridge → cloud; DICOM C-STORE SCP; real-time image streaming to browser; per-patient image viewer with multi-layout print.
1.0April 2, 2026Initial product launch: patient registration, manual report editor, doctor and reception login, role-based access, basic USG reporting workflow, billing and receipts.

Approval

Approved for release by
Softcode Engineering Office
_____________________________
Softcode  ·  May 2026
Informational notice
This document is provided for internal use by Softcode engineering, sales and marketing teams and is for informational purposes only. It does not constitute medical, legal, regulatory or financial advice. Statements about competitive positioning, pricing and market opportunity are internal estimates and are not commitments to customers. For specific statutory, regulatory, contractual or compliance questions, consult qualified professionals in the relevant jurisdiction. The latest version of this document supersedes any earlier version.

Softcode  |  USG AI Assist  |  Feature Deep Dive Guide  |  Version 3.9  |  May 2026
Website: www.softcodehq.com  ·  Support: [email protected]
Built for engineers who maintain it · sales who pitch it · marketing who position it
© Softcode 2026 — All rights reserved. This document is confidential and for authorised internal use only.