Papers › Foresight -- Generative Pretrained Transformer (GPT) for Modelling of Patient...

Foresight -- Generative Pretrained Transformer (GPT) for Modelling of Patient Timelines using EHRs

13 Dec 2022arXiv:2212.08072archive 2025-07-28

Zeljko Kraljevic, Dan Bean, Anthony Shek, Rebecca Bendayan, Harry Hemingway, Joshua Au Yeung, Alexander Deng, Alfie Baston, Jack Ross, Esther Idowu, James T Teo, Richard J Dobson

Background: Electronic Health Records hold detailed longitudinal information about each patient's health status and general clinical history, a large portion of which is stored within the unstructured text. Existing approaches focus mostly on structured data and a subset of single-domain outcomes. We explore how temporal modelling of patients from free text and structured data, using deep generative transformers can be used to forecast a wide range of future disorders, substances, procedures or findings. Methods: We present Foresight, a novel transformer-based pipeline that uses named entity recognition and linking tools to convert document text into structured, coded concepts, followed by providing probabilistic forecasts for future medical events such as disorders, substances, procedures and findings. We processed the entire free-text portion from three different hospital datasets totalling 811336 patients covering both physical and mental health. Findings: On tests in two UK hospitals (King's College Hospital, South London and Maudsley) and the US MIMIC-III dataset precision@10 0.68, 0.76 and 0.88 was achieved for forecasting the next disorder in a patient timeline, while precision@10 of 0.80, 0.81 and 0.91 was achieved for forecasting the next biomedical concept. Foresight was also validated on 34 synthetic patient timelines by five clinicians and achieved relevancy of 97% for the top forecasted candidate disorder. As a generative model, it can forecast follow-on biomedical concepts for as many steps as required. Interpretation: Foresight is a general-purpose model for biomedical concept modelling that can be used for real-world risk forecasting, virtual trials and clinical research to study the progression of disorders, simulate interventions and counterfactuals, and educational purposes.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2212.08072")

Code

Syntology Ran 0 of 12 code samples harvested from 1 repository linked to this paper; 12 have no recorded run.

By repository: official repository: 12 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

cogstack/foresight officialmentioned in papermentioned on GitHubApache-2.0 report
CogStack/MedCAT mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

12 samples harvested; 0 ran; 0 honoured the contract we drafted; 12 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

12unverified

Licence: 0 of the 12 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from cogstack/foresight. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

calculate_counts cogstack/foresight/foresight/utils/stream_utils.py official repository unverified Apache-2.0 (permissive) · ac14695298be58fc · report
docs2stream cogstack/foresight/foresight/utils/stream_utils.py official repository unverified Apache-2.0 (permissive) · 35e52a8c531602c4 · report
filter_by_type cogstack/foresight/foresight/datasets/filters.py official repository unverified Apache-2.0 (permissive) · ac9a04968e7acc5d · report
get_all_splits cogstack/foresight/foresight/datasets/utils.py official repository unverified Apache-2.0 (permissive) · f7578191b70a44ca · report
get_children_map cogstack/foresight/foresight/utils/cdb_utils.py official repository unverified Apache-2.0 (permissive) · 2c5b98657b286418 · report
get_duration_separator cogstack/foresight/foresight/datasets/utils.py official repository unverified Apache-2.0 (permissive) · 15764b4be0c5f12f · report
get_entities_for_doc cogstack/foresight/foresight/utils/stream_utils.py official repository unverified Apache-2.0 (permissive) · 3249e2235dcbb16b · report
get_parents_map cogstack/foresight/foresight/utils/cdb_utils.py official repository unverified Apache-2.0 (permissive) · 996a28aa4ca8328e · report
make_example cogstack/foresight/foresight/datasets/utils.py official repository unverified Apache-2.0 (permissive) · 7ef0f00604eab68d · report
metrics_data2df cogstack/foresight/foresight/metrics/next_concept_prediction.py official repository unverified Apache-2.0 (permissive) · 6b31e0ea8a1bb7e8 · report
precision_on_one cogstack/foresight/foresight/metrics/next_concept_prediction.py official repository unverified Apache-2.0 (permissive) · bcd0c6ffe7251ad8 · report
reverse_pt2ch cogstack/foresight/foresight/utils/cdb_utils.py official repository unverified Apache-2.0 (permissive) · e0f388f78415fc22 · report

Tasks

NERNamed Entity RecognitionNamed Entity Recognition (NER)named-entity-recognition

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections