Repository navigation
Technical Proposal
Project name: hphvision
Meaning: hph stands for hiperhealth
Primary platform: React Native
Architecture: TypeScript monorepo
Published npm packages:
@hiperhealth/hphvision-core
@hiperhealth/hphvision-mobile
hphvision is a mobile health project for guided smartphone-based vision screening and eyeglass-prescription estimation.
The project will provide a React Native app that can guide a patient through visual acuity and refraction-related tests using the smartphone screen, voice prompts, speech recognition, and a printable cardboard support/visor generated according to the patient’s cellphone dimensions.
The goal is not to immediately replace a complete optometrist or ophthalmologist exam. The first goal is to provide a technically rigorous, validated, low-cost screening and prescription-estimation workflow that can support:
- remote vision screening,
- low-resource environments,
- self-monitoring,
- tele-optometry workflows,
- prescription renewal support,
- clinician review.
Scientific literature already supports the feasibility of smartphone-based visual acuity testing and related mobile vision-screening workflows. Validated tools such as Peek Acuity have shown accurate and repeatable visual-acuity measurements, and recent studies have explored smartphone-based refraction methods and mass screening in low-resource settings.
hphvision should become a reusable platform for smartphone-assisted eye screening.
The system should allow a patient to:
- identify their smartphone model,
- generate a printable PDF cardboard template adapted to that phone,
- assemble a simple phone support or visor,
- run guided vision tests,
- answer using voice or touch,
- receive a structured screening result,
- export a clinician-friendly report.
The app should be positioned as:
A smartphone-based guided vision-screening and prescription-estimation platform, supported by a dynamically generated cardboard visor template customized to the user’s phone dimensions.
Smartphone-based visual acuity testing has already been validated in research contexts. The Peek Acuity study in JAMA Ophthalmology showed that a smartphone visual-acuity test could provide accurate and repeatable acuity measurements consistent with accepted test-retest variability for logMAR-style charts.
The same study compared Peek Acuity with ETDRS and Snellen-style testing, reporting strong correlations and small mean differences in controlled settings.
A 2024 review in Eye reported that many scientifically evaluated mobile apps can mimic traditional paper-based visual-function tests, while also noting that clinicians must verify app validity before clinical adoption because incorrect visual-function recording can have serious consequences.
A 2022 systematic review and meta-analysis in JMIR mHealth and uHealth concluded that mobile visual-acuity apps can play an important role in identifying visual impairment by professionals and nonprofessionals, including self-testing contexts, while also recommending further research with larger samples and longer follow-up.
Recent work has explored smartphone-based refraction. A 2024 Journal of Optometry article proposed using smartphone blue-light stimuli to detect changes in visual acuity and spherical refraction, reporting a small mean difference between smartphone-based spherical over-refraction and clinical measurement in the tested setting.
A 2024 rural screening pilot also reported the use of smartphone apps for visual acuity, refractive error, and ocular alignment screening by nonprofessional personnel. The authors concluded that smartphone apps have potential for mass vision screening and low-cost vision care in geographically remote or resource-constrained areas.
The MVP should include:
- patient onboarding,
- safety triage,
- device detection,
- manual and semi-automatic phone dimension calibration,
- dynamic cardboard-template PDF generation,
- visual-acuity testing,
- guided subjective refraction estimation,
- voice-guided testing,
- touch fallback,
- results PDF generation,
- clinician-review export.
The first version should not claim to replace a full eye exam.
The MVP should not include:
- autonomous diagnosis of ocular disease,
- retina/fundus imaging,
- glaucoma screening,
- diabetic retinopathy screening,
- pediatric autonomous prescription generation,
- fully automated camera-based prescription estimation,
- progressive/multifocal lens recommendation,
- final prescription without clinician review.
The app should collect:
- age range,
- current glasses/contact lens use,
- whether the user already has a prescription,
- reason for testing,
- device model,
- preferred language,
- voice interaction preference.
Before starting any test, the app should screen for red flags:
- sudden vision loss,
- eye pain,
- flashes or floaters,
- double vision,
- recent eye trauma,
- severe redness,
- known glaucoma,
- diabetes-related eye disease risk,
- recent eye surgery.
If red flags are present, the app should stop the self-test flow and recommend professional evaluation.
The app should identify the phone model and determine the dimensions required for the cardboard template.
Because mobile operating systems do not reliably expose full physical chassis dimensions, the app should combine:
- automatic model detection,
- a device-profile database,
- user confirmation,
- manual fallback,
- optional camera-based calibration with a reference object.
The app should generate a printable PDF template according to the cellphone dimensions.
The generated template should help the user create a simple cardboard visor/support that holds the smartphone in a stable and reproducible position.
The user places the phone in the support and follows voice-guided instructions.
The app presents visual stimuli and asks questions such as:
- “Which direction is the E facing?”
- “Is option one or option two clearer?”
- “Is it better, worse, or the same?”
- “Can you read this symbol?”
The user can respond by voice or touch.
The app generates:
- visual acuity result,
- estimated refractive error,
- confidence score,
- test-quality warnings,
- recommendation,
- PDF report.
The cardboard template is a central feature of hphvision.
Its role is to reduce variability in:
- eye-to-screen distance,
- phone angle,
- head position,
- hand tremor,
- one-eye-at-a-time occlusion,
- lighting interference.
This is important because smartphone vision testing depends heavily on controlled geometry and repeatability.
The app should generate a PDF template adapted to:
- phone width,
- phone height,
- phone thickness,
- screen center,
- bezel/notch/punch-hole position,
- required eye-to-screen distance,
- cardboard thickness,
- page format.
Supported PDF formats:
A4
US Letter
Optional future exports:
SVG
DXF
PNG preview
The generated template should include:
- phone holder slot,
- fold lines,
- cut lines,
- glue tabs,
- forehead support,
- nose cutout,
- eye window,
- monocular occlusion flap,
- alignment markers,
- calibration ruler,
- 50 mm print-scale verification square,
- phone fit-check outline,
- assembly instructions.
The template should be generated from parametric geometry.
Instead of storing static templates, hphvision-core should define a geometry engine that produces vector paths from phone and template parameters.
Example inputs:
type PhoneGeometry = {
modelName: string;
bodyWidthMm: number;
bodyHeightMm: number;
thicknessMm: number;
screenWidthMm?: number;
screenHeightMm?: number;
screenOffsetXmm?: number;
screenOffsetYmm?: number;
};
type TemplateOptions = {
pageSize: "A4" | "LETTER";
cardboardThicknessMm: number;
eyeToScreenDistanceMm: number;
includeAssemblyInstructions: boolean;
};Example output:
type TemplateDocument = {
pages: TemplatePage[];
calibrationMarks: CalibrationMark[];
instructions: AssemblyInstruction[];
metadata: TemplateMetadata;
};The app can then render the result as PDF.
The visual acuity module should use logMAR-inspired testing.
Recommended optotypes:
- Tumbling E,
- Landolt C.
These are preferable because they do not require literacy and can be answered with direction-based responses.
The app should:
- randomize optotype orientation,
- test one eye at a time,
- include practice trials,
- track wrong answers,
- estimate acuity threshold,
- calculate logMAR-style results,
- measure reliability.
The first version should use guided subjective refraction estimation.
This is more realistic than trying to infer prescription purely from the camera.
The workflow should estimate:
- spherical equivalent,
- sphere,
- cylinder range,
- axis range,
- confidence score.
The app should present controlled stimuli and iteratively ask:
Is this better, worse, or the same?
or:
Which is clearer: option one or option two?
Astigmatism testing may use:
- clock dial patterns,
- fan chart patterns,
- line-orientation comparison,
- simplified Jackson-cross-cylinder-inspired interactions.
The MVP should provide an estimated cylinder and axis range, not necessarily a final clinical-grade prescription.
Each test session should produce a reliability score based on:
- repeated answer consistency,
- response time,
- voice confidence,
- distance stability,
- phone tilt,
- ambient light,
- completion rate,
- contradictory answers.
Voice interaction is important because the user may have the phone inside the cardboard support and may not be able to tap easily.
The app should use voice for both:
- asking questions,
- receiving answers.
The supported vocabulary should be intentionally small:
better
worse
same
one
two
left
right
up
down
repeat
stop
I don't know
This should be implemented as constrained command recognition, not open-ended dictation.
The app should use text-to-speech to guide the user:
- “Cover your left eye.”
- “Look at the symbol.”
- “Say better, worse, or same.”
- “Please repeat.”
- “Test complete.”
The app should support:
- native speech recognition,
- confidence thresholds,
- noise handling,
- fallback to touch input,
- accessibility mode,
- multilingual command mapping.
Every recognized answer should be confirmed visually or audibly.
The React Native app should be implemented in TypeScript.
Recommended modules:
onboarding
triage
device-calibration
template-generation
voice-assistant
acuity-test
refraction-test
results
reporting
settings
The app should use a state-machine-based test flow because vision testing has many branching steps.
Suggested state-machine domains:
onboardingFlow
templateFlow
acuityFlow
refractionFlow
reportFlow
This makes the test protocol easier to validate, debug, and reproduce.
The project should use a monorepo.
Repository name:
hphvision
Suggested structure:
hphvision/
├── package.json
├── pnpm-workspace.yaml
├── turbo.json
├── tsconfig.base.json
├── packages/
│ ├── hphvision-core/
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── acuity/
│ │ │ ├── refraction/
│ │ │ ├── device-profile/
│ │ │ ├── template-generator/
│ │ │ ├── pdf/
│ │ │ ├── reports/
│ │ │ ├── validation/
│ │ │ └── index.ts
│ │ └── tests/
│ │
│ └── hphvision-mobile/
│ ├── package.json
│ ├── app.json
│ ├── src/
│ │ ├── screens/
│ │ ├── modules/
│ │ ├── voice/
│ │ ├── calibration/
│ │ ├── testing-flow/
│ │ ├── reporting/
│ │ └── App.tsx
│ └── tests/
│
├── docs/
│ ├── clinical-validation.md
│ ├── template-spec.md
│ ├── architecture.md
│ └── regulatory-notes.md
│
└── examples/
├── generate-template/
├── run-acuity-test/
└── run-refraction-flow/
The monorepo should publish two independent npm packages.
Package name:
@hiperhealth/hphvision-core
Purpose:
- visual acuity algorithms,
- refraction workflow logic,
- test state machines,
- device-profile models,
- template geometry generation,
- PDF/SVG generation primitives,
- report data models,
- validation utilities,
- shared TypeScript types.
This package should not depend on React Native UI.
It should be reusable from:
- the mobile app,
- a web app,
- a backend service,
- validation notebooks,
- clinician dashboards,
- automated test pipelines.
Example package metadata:
{
"name": "@hiperhealth/hphvision-core",
"version": "0.0.0-development",
"private": false,
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": ["dist"]
}Package name:
@hiperhealth/hphvision-mobile
Purpose:
- React Native app,
- screens,
- voice integration,
- camera/sensor integration,
- local storage,
- template export UI,
- test execution UI,
- results display,
- report sharing.
The mobile package depends on the core package:
@hiperhealth/hphvision-mobile
↓
@hiperhealth/hphvision-core
Example package metadata:
{
"name": "@hiperhealth/hphvision-mobile",
"version": "0.0.0-development",
"private": false,
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": ["dist"]
}Recommended tooling:
pnpm workspaces
Turborepo
TypeScript
React Native
Vitest or Jest
React Native Testing Library
ESLint
Prettier
semantic-release
multi-semantic-release
GitHub Actions
Root package.json example:
{
"private": true,
"scripts": {
"check": "turbo run lint typecheck test",
"build": "turbo run build",
"release": "npx multi-semantic-release"
},
"devDependencies": {
"multi-semantic-release": "^3.0.0",
"semantic-release": "^24.0.0",
"turbo": "^2.0.0",
"typescript": "^5.0.0"
}
}The project should use semantic-release through npx from a CI release job.
Because the repository contains two independently published packages, the recommended setup is:
npx multi-semantic-releaseThis allows package-level releases for:
@hiperhealth/hphvision-core
@hiperhealth/hphvision-mobile
The project should follow Conventional Commits:
feat(core): add logMAR acuity scoring
fix(template): correct phone slot tolerance
feat(mobile): add voice-guided better/worse flow
docs: add clinical validation plan
Version mapping:
fix: patch release
feat: minor release
BREAKING CHANGE: major release
Example GitHub Actions workflow:
name: Release
on:
push:
branches:
- main
jobs:
release:
name: Release packages
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run checks
run: pnpm run check
- name: Build packages
run: pnpm run build
- name: Release packages
run: npx multi-semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}The core package should evolve more conservatively because it contains clinically sensitive algorithms, scoring logic, template geometry, and validation utilities.
The mobile app package may evolve faster because UI and UX will likely require frequent iteration.
Independent package releases allow this separation.
type DeviceProfile = {
id: string;
manufacturer: string;
modelName: string;
modelNumber?: string;
bodyWidthMm: number;
bodyHeightMm: number;
thicknessMm: number;
screenWidthPx: number;
screenHeightPx: number;
pixelDensity: number;
screenWidthMm?: number;
screenHeightMm?: number;
activeDisplayOffsetXmm?: number;
activeDisplayOffsetYmm?: number;
notchMask?: NotchMask;
templateFamily: string;
};type TestSession = {
id: string;
createdAt: string;
deviceProfile: DeviceProfile;
templateVersion?: string;
patientContext: {
ageRange?: string;
currentGlasses?: boolean;
previousPrescription?: boolean;
};
environment: {
ambientLightLux?: number;
screenBrightness?: number;
distanceConfidence?: number;
tiltConfidence?: number;
};
acuityResult?: AcuityResult;
refractionResult?: RefractionResult;
reliabilityScore: number;
warnings: string[];
};type RefractionResult = {
rightEye?: EyeRefractionEstimate;
leftEye?: EyeRefractionEstimate;
binocular?: EyeRefractionEstimate;
confidence: number;
recommendation: ResultRecommendation;
};
type EyeRefractionEstimate = {
sphere?: number;
cylinder?: number;
axis?: number;
sphericalEquivalent?: number;
confidenceInterval?: {
sphere?: [number, number];
cylinder?: [number, number];
axis?: [number, number];
};
};The app should generate two types of PDF.
Includes:
- cut lines,
- fold lines,
- glue tabs,
- phone holder,
- calibration square,
- assembly instructions,
- phone model,
- template version.
Includes:
- patient/session metadata,
- device used,
- whether template/visor was used,
- visual acuity results,
- refraction estimate,
- reliability score,
- warnings,
- clinician review recommendation.
The report should clearly state:
This result is a screening and estimation output. It is not a complete eye health examination.
Test:
- PDF scale accuracy,
- phone fit accuracy,
- template assembly repeatability,
- screen brightness handling,
- voice recognition accuracy,
- test flow consistency,
- offline behavior.
Evaluate:
- whether users can assemble the cardboard visor,
- whether users understand voice instructions,
- whether older users can complete the test,
- whether touch fallback is sufficient,
- test completion time,
- user confidence.
Compare app results against stan