SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2212.08072 · 2022

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

arXiv · PDF · Open in the Atlas

Code that ran

12 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 12 have no contract verdict; 0 failures of our instrument; 0 no recorded run), measured 2026-11-21; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2212.08072.json · badge: /api/ran/2212.08072.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
cogstack/foresight canonical (classifier label)
classifier basis not recorded on the link
12 ran · 0 no recorded run
FunctionStatusWhere it lives
calculate_counts Ran
ran on a synthesized input
cogstack/foresight/foresight/utils/stream_utils.py
code served (permissive licence) · get_code("ac14695298be58fc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned defaultdict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from collections import defaultdict

# Construct test data for calculate_counts function
docs = {
    'doc_1': {
        'entities': {
            'ent_0': {
                'cui': 'C0001',
                'meta_anns': {
                    'status': {'value': 'active'},
                    'confidence': {'value': 0.9}
                }
            },
            'ent_1': {
                'cui': 'C0002',
                'meta_anns': {
                    'status': {'value': 'active'},
                    'confidence': {'value': 0.8}
                }
            }
        }
    },
    'doc_2': {
        'entities': [
            {
                'cui': 'C0001',
                'meta_anns': {
                    'status': {'value': 'active'},
                    'confidence': {'value': 0.85}
                }
            },
            {
                'cui': 'C0003',
                'meta_anns': {
                    'status': {'value': 'inactive'},
                    'confidence': {'value': 0.7}
                }
            }
        ]
    }
}

doc2pt = {
    'doc_1': 'patient_1',
    'doc_2': 'patient_2'
}

pt2cui2cnt = None

meta_requirements = {
    'status': 'active'
}

ARGS = {
    'docs': docs,
    'doc2pt': doc2pt,
    'pt2cui2cnt': pt2cui2cnt,
    'meta_requirements': meta_requirements
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type defaultdict — a defaultdict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a defaultdict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
docs2stream Ran
ran on a synthesized input
cogstack/foresight/foresight/utils/stream_utils.py
code served (permissive licence) · get_code("35e52a8c531602c4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned defaultdict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from collections import defaultdict

# Build minimal valid arguments for docs2stream

# Create docs structure (output of medcat multiprocessing)
docs = {
    'doc1': {
        'entities': {
            'ent1': {
                'cui': 'C0001',
                'meta_anns': {
                    'Presence': {'value': True},
                    'Status': {'value': 'present'},
                    'historical_flag': {'value': False}
                },
                'document_timestamp': 100,
                'tuis': ['T047']
            },
            'ent2': {
                'cui': 'C0002',
                'meta_anns': {
                    'Presence': {'value': True},
                    'Status': {'value': 'present'},
                    'historical_flag': {'value': True}
                },
                'document_timestamp': 200,
                'tuis': ['T048']
            }
        }
    },
    'doc2': {
        'entities': {
            'ent3': {
                'cui': 'C0003',
                'meta_anns': {
                    'Presence': {'value': True},
                    'Status': {'value': 'present'},
                    'historical_flag': {'value': False}
                },
                'document_timestamp': 150,
                'tuis': []
            }
        }
    }
}

# Mapping from doc_id to patient_id
doc2pt = {
    'doc1': 'patient_A',
    'doc2': 'patient_B'
}

# Mapping from patient to cui to count
pt2cui2cnt = {
    'patient_A': {
        'C0001': 5,
        'C0002': 3
    },
    'patient_B': {
        'C0003': 2
    }
}

# Mapping from doc_id to timestamp
doc2time = {
    'doc1': 1000,
    'doc2': 2000
}

# Meta requirements filter
meta_requirements = {
    'Presence': True
}

# Entity type column name
entity_type_column = 'tuis'

# Historical meta field name and value
historical_meta = 'historical_flag'
historical_meta_value = True

# CUIs to skip
skip_cuis = None

# Whether to require timestamp
require_time = True

# Old pt2stream (None means create new)
old_pt2stream = None

ARGS = {
    'docs': docs,
    'doc2pt': doc2pt,
    'pt2cui2cnt': pt2cui2cnt,
    'doc2time': doc2time,
    'meta_requirements': meta_requirements,
    'entity_type_column': entity_type_column,
    'historical_meta': historical_meta,
    'historical_meta_value': historical_meta_value,
    'old_pt2stream': old_pt2stream,
    'skip_cuis': skip_cuis,
    'require_time': require_time
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type defaultdict — a defaultdict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a defaultdict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
filter_by_type Ran
ran on a synthesized input
cogstack/foresight/foresight/datasets/filters.py
code served (permissive licence) · get_code("ac9a04968e7acc5d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Dataset. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from datasets import Dataset

# Create a minimal dataset with the structure expected by filter_by_type
# The function expects a 'stream' column containing lists of dicts with 'token_type' keys
data = {
    'stream': [
        [
            {'token_type': 'KEEP_ME', 'data': 'value1'},
            {'token_type': 'REMOVE_ME', 'data': 'value2'},
            {'token_type': 'KEEP_ME', 'data': 'value3'},
        ],
        [
            {'token_type': 'REMOVE_ME', 'data': 'value4'},
            {'token_type': 'KEEP_ME', 'data': 'value5'},
        ]
    ]
}

dataset = Dataset.from_dict(data)

types_to_keep = ['KEEP_ME']

num_proc = 1

ARGS = {
    'dataset': dataset,
    'types_to_keep': types_to_keep,
    'num_proc': num_proc
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
datasets — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Dataset — a Dataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Dataset output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_all_splits Ran
ran on a synthesized input
cogstack/foresight/foresight/datasets/utils.py
code served (permissive licence) · get_code("f7578191b70a44ca")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import datasets
from datasets import Dataset
import numpy as np

torch.manual_seed(0)

# Create sample data
data = {
    'text': ['hello world', 'foo bar', 'baz qux'],
    'label': [0, 1, 0]
}

# Create a datasets.DatasetDict with train, test, and valid splits
dataset_dict = datasets.DatasetDict({
    'train': Dataset.from_dict({'text': ['hello world', 'foo bar'], 'label': [0, 1]}),
    'test': Dataset.from_dict({'text': ['baz qux'], 'label': [0]}),
    'valid': Dataset.from_dict({'text': ['test'], 'label': [1]})
})

ARGS = {
    'dataset': dataset_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
datasets, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_children_map Ran
ran on a synthesized input
cogstack/foresight/foresight/utils/cdb_utils.py
code served (permissive licence) · get_code("2c5b98657b286418")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

# Construct arguments for get_children_map
# The function takes:
# - cuis: a collection of concept unique identifiers
# - pt2ch: a dict mapping parent concepts to lists of child concepts
# - depth: an integer for recursion depth

# Create a simple hierarchy
# CUI "A" has children ["B", "C"]
# CUI "B" has children ["D"]
# CUI "C" has children ["E"]
# CUI "D" has no children
# CUI "E" has no children

pt2ch = {
    "A": ["B", "C"],
    "B": ["D"],
    "C": ["E"],
    "D": [],
    "E": []
}

cuis = ["A", "B", "C", "D", "E"]

ARGS = {
    "cuis": cuis,
    "pt2ch": pt2ch,
    "depth": 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_duration_separator Ran
ran on a synthesized input
cogstack/foresight/foresight/datasets/utils.py
code served (permissive licence) · get_code("15764b4be0c5f12f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

ARGS = {
    "separator": "d}",
    "start_time": 100.0,
    "current_time": 200.0,
    "bucket_size_seconds": 30.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_entities_for_doc Ran
ran on a synthesized input
cogstack/foresight/foresight/utils/stream_utils.py
code served (permissive licence) · get_code("3249e2235dcbb16b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict_values. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

# The function expects:
# - docs: a dictionary where keys are doc_ids and values are dicts with 'entities' key
# - doc_id: an identifier to look up in the docs dictionary
# 
# The function accesses docs[doc_id]['entities'] and checks if it's a dict,
# calling .values() on it if so, otherwise treating it as an iterable.

# Create a sample docs structure mimicking medcat multiprocessing output
docs = {
    "doc_1": {
        "entities": {
            "ent_0": {"text": "disease", "start": 0, "end": 7},
            "ent_1": {"text": "symptom", "start": 10, "end": 17}
        }
    },
    "doc_2": {
        "entities": [
            {"text": "drug", "start": 5, "end": 9},
            {"text": "dose", "start": 15, "end": 19}
        ]
    }
}

doc_id = "doc_1"

ARGS = {
    "docs": docs,
    "doc_id": doc_id
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict_values — a dict_values output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict_values output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_parents_map Ran
ran on a synthesized input
cogstack/foresight/foresight/utils/cdb_utils.py
code served (permissive licence) · get_code("996a28aa4ca8328e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# Build a small parent-to-children mapping
# Structure: {parent_concept: {child_concept1, child_concept2, ...}, ...}
pt2ch = {
    "C0001": {"C0002", "C0003"},
    "C0002": {"C0004"},
    "C0005": {"C0006", "C0007"},
}

# List of CUIs (concepts) to get parents for
cuis = ["C0002", "C0004", "C0006"]

# depth parameter
depth = 3

ARGS = {
    "cuis": cuis,
    "pt2ch": pt2ch,
    "ch2pt": None,
    "depth": depth,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
make_example Ran
ran on a synthesized input
cogstack/foresight/foresight/datasets/utils.py
code served (permissive licence) · get_code("7ef0f00604eab68d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Construct ent_example with context_representation
ent_example = {
    'context_representation': [0.1, 0.2, 0.3, 0.4]
}

# Construct ARGS dict with all parameters
ARGS = {
    'token': 'hello',
    'ent_example': ent_example,
    'token_type': 'noun',
    'cnt': 1000,
    'time': 1234567890,
    'cntx': [0.5, 0.6, 0.7, 0.8]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
metrics_data2df Ran
ran on a synthesized input
cogstack/foresight/foresight/metrics/next_concept_prediction.py
code served (permissive licence) · get_code("6b31e0ea8a1bb7e8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned DataFrame. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import pandas as pd

ARGS = {
    'metrics_data': {
        'positives': {
            'all': {
                'cui_001': 45,
                'cui_002': 32,
                'cui_003': 18,
            }
        },
        'negatives': {
            'all': {
                'cui_001': 5,
                'cui_002': 8,
                'cui_003': 2,
            }
        },
        'fn_positives': {
            'all': {
                'cui_001': 3,
                'cui_002': 2,
                'cui_003': 1,
            }
        },
        'fn_negatives': {
            'all': {
                'cui_001': 10,
                'cui_002': 15,
                'cui_003': 5,
            }
        },
    },
    'tkn2name': {
        'cui_001': 'disease_alpha',
        'cui_002': 'disease_beta',
        'cui_003': 'disease_gamma',
    },
    'main': 'positives',
    'temporality': 'all',
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
precision_on_one Ran
ran on a synthesized input
cogstack/foresight/foresight/metrics/next_concept_prediction.py
code served (permissive licence) · get_code("bcd0c6ffe7251ad8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Construct predictions - can be either a list or ndarray
# The function uses np.argsort on axis 1 (for list) or axis 2 (for ndarray)
# For list case: list of 2D arrays, each [seq_len, num_classes]
predictions = [
    np.random.rand(5, 8),  # sequence of 5 positions, 8 possible classes
    np.random.rand(6, 8)   # sequence of 6 positions, 8 possible classes
]

# label_ids - list of arrays, each containing concept ids for a sequence
label_ids = [
    np.array([1, 2, 3, 2, 1]),      # 5 labels
    np.array([2, 3, 1, 4, 2, 3])    # 6 labels
]

# concept_id - a single concept to evaluate
concept_id = 2

# old_data - optional dict with tp, fp, fn counts
old_data = None

# topk - number of top predictions to consider
topk = 1

# start - starting position in sequences
start = 0

# time_range - time window for predictions
time_range = 10

# time_data - timing information for each sequence
time_data = [
    np.array([0, 1, 5, 8, 12]),           # 5 time values
    np.array([0, 2, 4, 7, 10, 15])        # 6 time values
]

# min_time_left - minimum time remaining requirement
min_time_left = 3

# shifted_labels - whether labels are shifted
shifted_labels = False

ARGS = {
    'predictions': predictions,
    'label_ids': label_ids,
    'concept_id': concept_id,
    'old_data': old_data,
    'topk': topk,
    'start': start,
    'time_range': time_range,
    'time_data': time_data,
    'min_time_left': min_time_left,
    'shifted_labels': shifted_labels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
reverse_pt2ch Ran
ran on a synthesized input
cogstack/foresight/foresight/utils/cdb_utils.py
code served (permissive licence) · get_code("e0f388f78415fc22")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# Analyze the function: reverse_pt2ch takes a dict where:
# - Keys are "pt" (point/part) values
# - Values are iterables of "ch" (character/chunk) values
# - It builds an inverse mapping: ch -> set of pts

# Create a simple pt2ch dictionary structure
pt2ch = {
    "part_1": ["char_a", "char_b", "char_c"],
    "part_2": ["char_b", "char_d"],
    "part_3": ["char_a", "char_d", "char_e"]
}

ARGS = {
    "pt2ch": pt2ch
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 12 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-21.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2212.08072")
get_code_for_paper("2212.08072")
have("2212.08072")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2212.08072.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2212.08072.svg)](https://syntology.ai/paper/2212.08072)

Connect an agent — have() is free.