Journal of Emerging Technologies and Innovative Research · Volume 13, Issue 11 (November-2026)

MediLens AI: An AI-Assisted Medical Laboratory Report Analyzer

Dr.Rohit Kumar, Arnav Tiwari, Anshika, Akarshit Verma, Akash Rawat, Aasna chaudhary
Paper ID: JETIR2611286 · PDF · Full-text page

Abstract. Laboratory reports are usually shared as PDF files with technical test names, varied units and reference intervals that differ between laboratories, which makes them hard for non-specialists to read. This paper presents MediLens AI, an educational web prototype that extracts selectable text from laboratory-report PDFs, identifies test names, values, units and reference intervals with rule-based parsing, compares each value only with the interval printed in the same report, and marks unclear records as “Needs review” instead of guessing. The system runs locally, needs no paid service, and shows the original source line for every record. We evaluated it in three recorded runs on a fictional, developer-written dataset of up to 39 cases (47 expected records) using precision, recall and field-level accuracy, each reported as numerator/denominator. A parsing fix raised record recall from 44/45 to 45/45 with no false records; adding harder document-level cases lowered recall to 45/47 and exposed a trade-off in the document-acceptance safeguard, while two non-laboratory documents were correctly rejected (2/2). A real non-medical PDF that produced false records during manual testing is also analysed. The results describe behaviour on a small fictional dataset only and are not a clinical validation. We discuss the opportunities and challenges of AI-assisted healthcare information processing, including extraction errors, hallucina

Keywords: Healthcare AI, information extraction, laboratory reports, PDF text extraction, reference ranges

I. INTRODUCTION

aboratory reports are among the most common documents that patients receive from healthcare providers, yet they are often difficult Lintervals that differ between laboratories. Many reports are distributed as PDF files whose layout varies from one provider tfor non -specialists to read. A single report can contain dozens of abbreviated test names, results in different units, and reference o another,

which makes automatic processing error-prone.

Artificial intelligence (AI) is increasingly discussed as a way to organise and interpret health data, with clear potential benefits but also serious concerns about reliability, safety and oversight [1], [2]. In this setting, a tool that helps a reader organise and verify the contents of a report is far less risky than a tool that tries to interpret it. We therefore built a prototype around the first goal.This paper presents MediLens AI, an educational web application that extracts text from laboratory-report PDFs, identifies test records, compares each numeric value with the reference interval printed in the same report, and marks unclear records for manual review. It is deliberately not a diagnostic system: it does not label results as “normal” or “abnormal”, does not estimate the probability of any disease, and does not recommend medicines or treatment. The study is guided by one research question: how accurately can a lightweight AI-assisted system extract and explain laboratory report information, and how effectively can it identify missing or po tentially unreliable information?

The main contributions are:

  1. a locally running, rule-based pipeline that converts a laboratory-report PDF into structured records and shows the original source line beside each record;
  2. a conservative status scheme that refuses to compare a value when its unit, interval or format is unclear; and
  3. a reproducible evaluation on fictional data with hand-written ground truth, reported with numerators and denominators across three recorded runs, including the failures found.

Extracting structured data from semi-structured text is a classical information-extraction problem, traditionally solved with hand- written patterns, statistical models, or a combination of both [3]. For a narrow document type such as a laboratory report, rule-based extraction is attractive because its behaviour can be inspected line by line. This matters in healthcare, where a user must be able to check why a value was read in a particular way.

Large language models can summarise and explain medical text fluently, but they can also produce statements that are not supported by the source, a failure mode known as hallucination [4]. In a laboratory report, an invented reference interval or a silently rewritten value could mislead a reader. For this reason, every step of MediLens AI that touches a number is deterministic, and language-model assistance is left as an optional future component limited to explanations.

We do not claim a new extraction technique. The contribution of this work is the integrated, conservative design, the explicit handling of uncertainty, and an honest failure analysis on a small, fully documented dataset.

III. SYSTEM DESIGN AND IMPLEMENTATION

A. Overview MediLens AI is written in Python 3. PyMuPDF [5] extracts text from PDFs, Streamlit [6] provides the web interface, pandas [7] handles tabular data and CSV export, and regular expressions [8] implement the parsing rules. The core application needs no database, login system, external service or paid API key. Uploaded files are processed on the user’s own computer, and analysis results are held only in session memory. Fig. 1 shows the processing pipeline.

Fig. 1. MediLens AI processing pipeline. All steps run locally.
Fig. 1. MediLens AI processing pipeline. All steps run locally. (PDF page 2)

B. Upload Validation and Text Extraction Before extraction the system checks the file extension, the size limit (10 MB, configurable), the PDF header signature, whether the file can be opened, whether it is password-protected, and whether it contains pages. Text is then extracted page by page. If fewer than 20 characters are found, the document is reported as possibly scanned. Optical character recognition (OCR) is not implemented, and the system says so instead of pretending to have read the document. Every error is shown as a plain message, never as a raw traceback.

C. Record Parsing Each non-empty line is split into tokens. The test name is formed by the leading tokens up to the first token that looks like a result: a number (optionally preceded by <, >, ≤ or ≥), a number written with a comma such as “1,08”, or a qualitative word such as Positive or Negative. A trailing colon is removed from the name. An optional flag marker (H or L) after the result is ignored with a warning. The next token is accepted as a unit only if it matches a strict pattern covering forms such as g/dL, mmol/L, 10^3/µL and %; ordinary words are rejected. The remaining text is kept as the reference text.

A line becomes a record only if it has a recognised unit, a qualitative result, or a test name found in the local dictionary of known tests. Values are stored exactly as printed and converted to numbers only when unambiguous; comma-separated numbers are not converted because the comma may mean a decimal point or a thousands separator.

D. Reference Interval Parsing Reference text is classified into four kinds: a two-sided range (for example 12.0 - 16.0, written with a hyphen, an en dash, “to” or parentheses), a one-sided limit (such as <150 or >40), a qualitative reference (such as Negative), or malformed/none. Reversed ranges, incomplete ranges such as “7 -”, unreadable text, and extra numbers after an interval (for example “(previous 38)”) are marked malformed with a warning. If a unit printed in the interval differs from the result unit, the record is sent to review because no validated unit conversion is available.

E. Status Classification Each record receives one of five statuses:

  1. Within supplied range: a numeric value inside the printed interval (bounds are inclusive for two-sided ranges, while a value equal to an exclusive limit such as “<150” counts as outside), or a qualitative result that matches the reference text;
  2. Below / Above supplied range: a numeric value outside the printed interval;
  3. Needs review: a reliable comparison is not possible, for example because of a missing unit, malformed interval, inequality result, unit mismatch, unreadable value or qualitative mismatch;
  4. Insufficient information: no reference interval was supplied. Missing information is never interpreted as normal. The wording “supplied range” is intentional: the interval belongs to the laboratory that produced the report, not to a universal clinical standard.

F. Document-Level Acceptance After parsing, a document is accepted as a laboratory report only if at least two records carry both a recognised unit and a numeric interval. Otherwise the system reports that no laboratory records were identified. This safeguard was added after a development test in which a non-medical PDF produced false records (Section V-C).

G. Transparency, Explanations and Interface A local dictionary of 14 common tests (with aliases) provides short plain-language explanations of what a test generally measures and why it may appear in a report. Each explanation is followed by a fixed notice that a single value outside an interval does not establish a diagnosis. No explanation mentions medicines, doses or treatment. For every record the interface shows the original source line and any parsing warnings, the full extracted text can be opened for verification, and results can be exported as CSV. The application has five pages (Dashboard, Analyze Report, Report History, Research & Evaluation, About) with session-only history, and includes two fictional demonstration reports: a clean one and one with deliberately incomplete or ambiguous entries. Users are told not to upload identifiable medical information to this experimental prototype.

IV. EVALUATION METHODOLOGY

A. Test Data All data are fictional; no real patient information was used. The dataset has three parts (Table I). (i) Rule-level cases: 34 single-line inputs, of which 29 have a hand-written expected record and 5 are lines that should produce no record (a patient line, a date line, a table header, a page number and an age line). The categories cover clean within/below/above results, boundary values, alternative r ange notations, missing units or intervals, qualitative results, inequality results, one-sided limits, malformed and reversed ranges, extra numbers, unit mismatch, ambiguous comma numbers, flag markers, digits and abbreviations in names, and a colon-separated layout.

  1. End-to-end PDFs: two PDF files generated from fictional data, Report A (8 clean records) and Report B (8 records with incomplete or ambiguous entries), processed from PDF bytes through the whole pipeline. (iii) Document-level cases (Run 3 only): a CV-style text and a shop receipt, each expected to produce zero records, and a short laboratory report with two records of which only one has both a unit and a numeric interval.

Five rule-level cases and two document-level cases are expected to produce no record, so they add no expected records.

B. Ground Truth and Matching For each expected record the authors wrote the test name, result value, inequality sign or qualitative value, unit, interval type and bounds, and status. A predicted record is matched to an expected record by test name (ignoring case and extra spaces), one to one. An unmatched expected record is a missed record; an unmatched predicted record is a false positive.

C. Metrics Following standard classification measures [9], record precision is matched records divided by predicted records, and record recall is matched records divided by expected records. The remaining metrics are computed over matched records only: numeric value accuracy (parsed number and inequality sign both equal the expected ones, among records with a numeric expected result); unit preservation (unit text exactly equal to the expected unit, where an expected missing unit must stay empty); reference interval accuracy (interval type and both bounds equal); classification accuracy (status equals the expected status); missing-information detection (among records expected to be Needs review or Insufficient information, the system gave one of those two statuses); false review flags (among records not expected to need review, the system flagged them anyway; lower is better); and non-laboratory document rejection (among documents expected to produce zero records, the system produced zero). Every metric is reported as numerator/denominator.

D. Evaluation Runs Three runs were recorded and saved as CSV and JSON files. Run 1 is the first formal run. Run 2 follows a fix for test names that end with a colon. Run 3 adds the document-level cases and uses the same parser as Run 2. The expected values were never edited to make a run pass.

V. RESULTS AND ANALYSIS

A. Overall Results Table II gives the results of the three runs. In Run 1, record precision was 44/44 and recall 44/45 (97.8%); every field-level metric was 100% on matched records, and the single failure was a missed record. In Run 2, recall rose to 45/45 with precision 45/45 and no failing comparison. In Run 3, recall fell to 45/47 (95.7%) because the harder cases revealed two missed records, while both n on- laboratory documents were rejected (2/2). Because the parser was unchanged between Runs 2 and 3, the drop reflects a harder test set, not a worse system.

TABLE II. METRICS FOR THE THREE EVALUATION RUNS (NUMERATOR/DENOMINATOR)
Metric Run 1 Run 2 Run 3
Record precision44/4445/4545/45
Record recall44/45 (97.8%)45/4545/47 (95.7%)
Numeric value accuracy39/3940/4040/40

Ratios without a percentage equal 100%. Field-level metrics use matched records only.

B. Failure 1: Colon-Separated Test Names In Run 1 the line “Hemoglobin: 13.8 g/dL 12.0 - 16.0” produced no record, because names containing a colon were rejected to avoid reading header lines such as “Patient: …” as tests. The fix removes only a trailing colon from the name; a colon inside a name is still rejected. After the fix, recall was 45/45, no false record appeared, and the five non-record lines were still ignored.

C. Failure 2: False Records on a Non-Medical PDF During manual testing, a seven-page résumé PDF, which is unrelated to medicine, was uploaded. The first version of the parser produced seven false “records” (for example address and employment-period lines), because it accepted any word as a unit and treated any trailing text as a reference interval. None of the seven was parsed cleanly. This failure was found by manual testing bef ore the formal evaluation existed. It shows a general weakness of developer-written test sets: they tend to cover the cases the developers already imagined.

Three changes followed: a strict unit pattern, a rule that trailing text alone is not evidence of a laboratory row, and the document-level acceptance check of Section III-F. All three formal runs were executed after these changes, so we have no measured before-and-after figure for them. To keep the problem under test, a synthetic CV-style text and a receipt were added in Run 3, and both were rejected (2/2).

D. Failure 3: Short Genuine Reports Are Rejected The short laboratory report in Run 3 has only one record with both a unit and a numeric interval, so the document check rejects it and both of its records are missed. This is the cost of the safeguard in Section III-F: it protects against false records on non-medical documents but loses some genuine short reports. The user then sees a “no laboratory records identified” message and can still read the extracted text. We regard this as the safer of the two errors for an educational tool. The threshold of two was chosen by the developers and has not been tuned; tuning it on three documents would not be meaningful.

E. Threats to Validity The dataset is small, fictional, and written by the same people who wrote the parser, so the results are not an independent validation. The PDFs were generated by a script and have a clean text layer, which makes extraction easier than in real reports. Field-level metrics use matched records only, so the 100% values in Run 3 do not describe the two missed records. Denominators differ between metrics. Expected statuses follow the project’s own comparison rules, not clinical judgement. No confidence intervals are given, and the results should not be generalised to real reports with multi-line rows, multi-column tables or scanned pages.

VI. DISCUSSION: OPPORTUNITIES AND CHALLENGES

A. Opportunities Readability. Converting a PDF into a structured table with short plain-language explanations makes technical content easier to scan. Verifiability. Showing the original source line beside each value lets the user check the extraction instead of trusting it. Detection of incomplete data. On the fictional set, all 17 matched records that were expected to be flagged (for example a missing unit or interval, or a malformed interval) were flagged and not compared silently. Privacy by design. Processing is local and the core system needs no external service. Education. The prototype demonstrates, in a small and inspectable form, how information extraction can support healthcare communication.

B. Challenges Format variability. The colon layout and the résumé failure show how easily a rule set breaks outside the layouts it was written for. Multi-line rows, split tables and scanned pages remain unsupported. Precision–recall trade-off. The document check illustrates that a stricter safeguard removes false records but also rejects some real ones. Units and ambiguity. Comma numbers and unit mismatches cannot be resolved without validated conversion rules, so the system defers to manual review. Laboratory-specific intervals. Intervals depend on the laboratory and the patient, so the system can only compare with the printed interval and cannot judge whether it suits a particular person. Over-interpretation. A result “above supplied range” may be misread as disease, and an in-range result may be misread as a guarantee of health; neutral wording and notices reduce but cannot remove this risk. Hallucination. If a language model is added later, it must not invent intervals or alter extracted values [4]. Privacy. Real reports contain personal identifiers; local processing helps, but this prototype makes no claim of advanced privacy protection and should be used only with fictional or de-identified files.

C. Human Oversight The design assumes a human reader remains responsible for interpretation. Ambiguity leads to “Needs review”, the source text is always available, and the application gives no diagnosis or treatment advice. Users are directed to qualified healthcare professionals for any medical decision.

VII. LIMITATIONS AND FUTURE WORK

MediLens AI is an academic prototype. It has not been clinically validated, does not diagnose medical conditions, and does not replace healthcare professionals. Automated extraction may be incorrect, and reference-range comparisons are informational only. The current implementation is a rule-based baseline: it uses classical symbolic information extraction rather than a learned model. Planned improvements are:

  1. evaluation by independent annotators on de-identified real reports, with appropriate ethical approval;
  2. OCR support for scanned documents;
  3. layout-aware parsing that uses word positions to handle multi-column tables and multi-line rows;
  4. validated unit conversion, and a tuned document-acceptance rule;
  5. optional language-model explanations that are grounded in the extracted record and cannot change values or intervals; and
  6. a usability study with non-specialist readers.

VIII. CONCLUSION

MediLens AI shows that a lightweight, locally running, rule-based pipeline can turn text-based laboratory-report PDFs into structured, verifiable records and can flag unclear cases instead of guessing. On a small fictional dataset, a parsing fix raised record recall from 44/45 to 45/45, harder document-level tests lowered it to 45/47 and exposed a real trade-off, and non-laboratory documents were rejected 2/2. These figures describe the prototype’s behaviour on its own test set and are not a claim of clinical accuracy. The most useful findings were the failures, which led to concrete design changes and to a clearer view of what must be tested next.

ACKNOWLEDGMENT

The authors thank Mr. Rohit Kumar and Haridwar University for their guidance and support. All laboratory data used in this work are fictional.

REFERENCES

  1. A. Rajkomar, J. Dean, and I. Kohane, “Machine learning in medicine,” N. Engl. J. Med., vol. 380, no. 14, pp. 1347–1358, 2019.
  2. E. J. Topol, “High-performance medicine: the convergence of human and artificial intelligence,” Nat. Med., vol. 25, no. 1, pp. 44–56, 2019.
  3. S. Sarawagi, “Information extraction,” Found. Trends Databases, vol. 1, no. 3, pp. 261–377, 2008.
  4. Z. Ji et al., “Survey of hallucination in natural language generation,” ACM Comput. Surv., vol. 55, no. 12, art. 248, 2023.
  5. Artifex Software, “PyMuPDF documentation.” [Online]. Available: https://pymupdf.readthedocs.io
  6. Streamlit, “Streamlit documentation.” [Online]. Available: https://docs.streamlit.io
  7. W. McKinney, “Data structures for statistical computing in Python,” in Proc. 9th Python in Science Conf., 2010, pp. 56–61.
  8. Python Software Foundation, “re — Regular expression operations,” Python 3 documentation. [Online]. Available: https://docs.python.org/3/library/re.html
  9. M. Sokolova and G. Lapalme, “A systematic analysis of performance measures for classification tasks,” Inf. Process. Manage., vol. 45, no. 4, pp. 427–437, 2009.

© The Author(s). Published by Journal of Emerging Technologies and Innovative Research under the Creative Commons Attribution 4.0 International License (CC BY 4.0). Converted automatically from the published PDF; the PDF is the version of record.