In this article
I built CorneaForge to power OphtaFlow AI, a real-time diagnostic support application running in production, available 24/7 and in beta with physicians at Quinze-Vingts Hospital. It brings examinations, measurements, images, native videos, annotations, and model predictions into one interface for doctors reviewing an examination.
The platform runs on hospital infrastructure. Its services collect MS-39 and Corvis data, extract measurements, generate corneal maps, prepare OCT images for viewing, and serve model predictions. I operate this clinical application alongside the research pipelines and experiments built from its data.
The central engineering problem is keeping those activities connected: preserving the original device files, processing them reliably, and putting useful results in front of physicians while retaining the same source material for research.
Separate storage, processing, and interactive work
MinIO holds original device files and derived images. PostgreSQL stores structured measurements, examination relationships, annotations, and processing state. FastAPI serves the application. Dedicated workers handle indexing, feature computation, model prediction, map generation, and OCT preparation, with systemd supervising each service.
I separated these responsibilities around how the work arrives. Opening an examination needs a quick response. Decoding exports and generating images need background execution, their own progress tracking, and the ability to retry. The application reads completed results while workers continue processing incoming data.
Systemd resource groups and CPU allocations separate interactive work from heavier research processing. The API and integrated AutoMorph worker, for example, run on different CPU sets. That gives each workload an explicit allocation on the shared hospital machine.
Keep the original files available
Every derived result starts with a device file. Retaining that file lets me investigate an unexpected value, improve a parser, or rebuild a map from the same input.
CorneaForge organizes those transformations into three layers:
| Layer | Responsibility | Implementation |
|---|---|---|
| Bronze | Keep and index the original exports | Device files in MinIO and source indexes |
| Silver | Associate examinations with structured measurements | PostgreSQL measurements, annotations, and processing state |
| Gold | Build datasets for a defined study | Parquet research tables queried with DuckDB |
The device’s own identifiers connect files and results to an examination, together with its date and eye. They also provide the basis for handling repeated uploads: a retransmitted export resolves to its existing source identity. This matters during network retries and historical imports alike.
Bring device data into the application
I built separate background services to collect MS-39 data, extract measurements from device files, and generate corneal maps. The application displays those stored results when an examination is opened.
For OCT—the cross-sectional scans of the front of the eye—the system records where each image is stored and how to display it. The viewer decodes and renders images on demand, then caches them for subsequent views.
The Corvis pipeline receives device exports through DICOM and imports their measurements into OphtaFlow AI. Incoming files and imported results remain linked, so I can trace a displayed measurement back to its source.
Make the transformations explicit
Ophthalmic processing combines native device measurements, quantities calculated from exported surfaces, and rendered images. I preserve their origins because each follows a different computation.
A native corneal index carries the device’s analysis. A quantity I compute from surface points carries our fitting and sampling conventions. A colored map adds interpolation and a display scale. Keeping those distinctions in the data makes comparisons and debugging much more direct.
I built the Python calculation engine to work across those representations: spatial statistics on native maps, fitted three-dimensional surfaces, and ray tracing through the anterior and posterior cornea. The optical engine follows light through the measured geometry; the surface-fitting work separates the fitted shape from its residual structure. Their outputs feed the feature-processing pipeline alongside the other calculated indices.
Repeated map generation also creates an optimization opportunity. When polar sample positions stay fixed, I cache the triangle lookups and interpolation weights used to draw Cartesian maps. The next map supplies new values to the same operator. Missing source points enter the cache key because they change the available geometry. I explain that implementation in Cache the geometry, then change the values, and the fitting conventions in From measured points to Zernike coefficients.
The same care applies to processing failures. The MS-39 feature worker distinguishes a temporary read failure, a missing source file, and a parsing error. Each outcome leads to a different response. If a new extraction attempt fails, the worker preserves the last valid features. This keeps a recoverable storage problem from erasing useful results.
Put diagnostic support into the physician’s workflow
I built the routine examination workflow around automatic background prediction. Once an examination’s features are ready, the prediction worker runs the models and stores each result with its examination, prediction task and model version. Entering a patient identifier retrieves the examination and these saved results; opening the record does not need to rerun the models.
In the current workflow, diagnostic results are available less than one minute after an examination finishes. That interval runs from examination completion to the result being available in the physician’s interface.
In the patient view, physicians see corneal measurements and images alongside a suggested diagnosis and disease-specific binary model results. They can record their own diagnosis and report a disagreement in the same workflow. Preparing predictions in the background makes them available for review alongside the rest of the examination.
The live-patient upload workflow accepts a new MS-39 CSV, with optional Corvis measurements. My Python pipeline parses the measurements, calculates the corneal indices and geometric descriptors, generates the maps, and runs XGBoost inference during the request. It returns class probabilities, key measurements and the generated maps for review. This connects a newly supplied examination to a calculated diagnostic prediction.
Model integration also depends on the meaning of the inputs. The ordered features, units, preprocessing, and weights have to work together. For example, a surface residual expressed in micrometers becomes a different input if it is divided by the fitted area. That dependency is why I treat feature computation as part of the model’s implementation.
Turn operational data into an experiment
For each research dataset, I define the population, the unit represented by a row, the selected variables, and the labels. The builders write Parquet tables, and DuckDB handles analytical queries over those snapshots. This moves study-wide scans away from the application’s transactional database.
The existing research snapshot combines MS-39, Corvis, and imported IOLMaster biometry. Its version identifies the build used for an analysis. Choosing an examination, an eye, or a person as the row unit determines how repeated visits and cross-device joins contribute to that study.
From the MS-39 exports retained in Bronze, I assembled a research corpus of 3,663,454 OCT cross-sections, frozen in June 2026. After selecting the pretraining population and applying the quality filter, 3,427,130 images feed my five AS-OCT pretraining experiments. The quality-score histogram and representation measurements explain that selection and the changes measured during training. A fixed image index and recorded source order keep the comparison stable as new hospital data arrive.
I also integrated AutoMorph, the retinal analysis pipeline, as an upload, queue, and download service with its own worker. A separate CLARUS research processing run completed 154 batches, with a manifest recording its outputs. The queue, resource allocation, and output records make these longer computations manageable alongside the interactive application.
January 2027: a broader clinical system
My January 2027 roadmap extends this working platform across corneal and retinal care. The targets are 100+ diseases, fusion of data from five devices, and more than one million examinations processed.
The research foundation is self-supervised learning, starting with JEPA. In Learning without labels, I explain how these objectives teach an encoder to represent image structure before training it for a particular prediction task. My AS-OCT experiments develop that representation from the image corpus already assembled through CorneaForge. The next step is to combine learned image features with measurements from the different devices, bringing complementary information into the same model.
Diagnosis is one task in that plan. I want the same system to support treatment and surgical recommendations, calculated and prefilled surgical input parameters, and predictions of treatment success and postoperative outcomes with their uncertainty. These tasks ask different questions of the same examination: what condition is present, which intervention may help, what parameters an intervention requires, and what range of outcomes to expect. Keeping those questions explicit will let the interface present each output in the part of the workflow where a physician needs it.
That is the connection I am building between production and research. The hospital platform supplies linked examinations, measurements and physician annotations. Self-supervised learning and data fusion develop richer representations from those inputs. Task-specific models then turn those representations into the diagnostic and planning outputs that OphtaFlow AI will present. The January targets define the next stage of that system; the running application provides its operational starting point.
What operating the system changes
Operating OphtaFlow AI connects the engineering to physicians’ examination workflow. I can follow a surprising measurement back to its file, identify the computation that produced it, and decide which step to repeat. The same source records also give my research questions a practical starting point: a training experiment can refer to a fixed dataset while the hospital pipeline continues collecting new examinations.
That connection is the purpose of CorneaForge: turn device data into real-time diagnostic support for physicians through OphtaFlow AI, and into reproducible datasets and experiments for research.
The deployment record documents the services, stored outputs, and successful runtime checks from 1 October 2026. The corpus selection record follows the OCT image counts from the prepared collection to the training dataset.