/** * Input model for the vision-rx SHA-256 extension codec (FHIR R4 VisionPrescription). */ export type PrismBase = "up" | "down" | "in" | "out"; export type LensProduct = "lens" | "contact"; export type EyeSide = "right" | "left"; export type DurationUnit = "d" | "wk" | "mo"; export interface Prism { /** Prism diopters in exact 0.25 steps, range 0.25..20.00. */ amount: number; base: PrismBase; } export interface LensDuration { /** Positive integer 1..365. */ value: number; unit: DurationUnit; } export interface LensSpec { product: LensProduct; eye: EyeSide; /** Diopters in exact 0.25 steps, range -25.00..+25.00. */ sphere?: number; /** Diopters in exact 0.25 steps, range -12.00..+12.00. */ cylinder?: number; /** Integer degrees 1..180. */ axis?: number; /** Reading add power in exact 0.25 steps, range +0.25..+5.00. */ add?: number; /** Up to 2 prisms (e.g., horizontal + vertical). */ prism?: Prism[]; /** Contact lens power in exact 0.25 steps, range -25.00..+25.00. */ power?: number; /** Base curve in mm, exact 0.01 mm steps, range 6.00..11.00. */ backCurve?: number; /** Diameter in mm, exact 0.1 mm steps, range 8.0..18.0. */ diameter?: number; /** Replacement schedule (e.g., 1 d, 2 wk, 1 mo). */ duration?: LensDuration; /** <= 32 UTF-8 bytes. */ color?: string; /** <= 64 UTF-8 bytes. */ brand?: string; /** <= 128 UTF-8 bytes (e.g., "High-index 1.67, anti-reflective, photochromic"). */ note?: string; } export interface VisionPatient { /** <= 64 UTF-8 bytes. */ family?: string; /** 1..4 strings, each <= 64 UTF-8 bytes. */ given?: string[]; /** YYYY-MM-DD (1900-01-01..2155-12-31). */ birthDate?: string; } export interface VisionPrescriber { /** <= 64 UTF-8 bytes. */ family?: string; /** 1..4 strings, each <= 64 UTF-8 bytes. */ given?: string[]; /** <= 32 UTF-8 bytes (e.g., "OD", "MD"). */ qualification?: string; /** 10-digit US NPI string. */ npi?: string; } export interface VisionRx { patient: VisionPatient; prescriber?: VisionPrescriber; /** YYYY-MM-DD (1900-01-01..2155-12-31). */ dateWritten: string; /** Optional expiration date YYYY-MM-DD (1..4095 days after dateWritten). */ expires?: string; /** Binocular pupillary distance in 0.5 mm steps, range 45.0..80.0. */ pdMm?: number; /** Monocular right PD in 0.5 mm steps, range 20.0..45.0. */ pdRightMm?: number; /** Monocular left PD in 0.5 mm steps, range 20.0..45.0. */ pdLeftMm?: number; /** 1..4 lens specifications (right/left glasses and/or contacts). */ lensSpecifications: LensSpec[]; }