SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1908.03971 · 2019

TAPER: Time-Aware Patient EHR Representation

arXiv · PDF · Open in the Atlas

Code that ran

10 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; 1 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 1 failure of our instrument; 2 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/1908.03971.json · badge: /api/ran/1908.03971.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
sajaddarabi/TAPER canonical (classifier label)
classifier basis: census
8 ran · 2 no recorded run
sajaddarabi/TAPER-EHR canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_max_seq_len_text Ran
ran, honoured the contract we drafted
sajaddarabi/TAPER-EHR/gen_text_plus_code_data.py
code served (permissive licence) · get_code("40750aa14e948511")
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 int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
import torch

class MockTokenizer:
    def tokenize(self, text):
        # Simple whitespace tokenization
        return text.split()
    
    def convert_tokens_to_ids(self, tokens):
        # Convert tokens to simple integer IDs
        return [hash(token) % 1000 for token in tokens]

# Create a small dataframe with text samples
df = pd.DataFrame({
    'text': [
        'hello world this is a test',
        'short text',
        'this is a longer sequence with many tokens to test the max length computation'
    ]
})

# Create tokenizer instance
tokenizer = MockTokenizer()

ARGS = {
    'df': df,
    'col': 'text',
    'tokenizer': tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
create_dataset Ran
ran on a synthesized input
sajaddarabi/TAPER/process_text.py
code served (permissive licence) · get_code("210d3f7cced84b5c")
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

# Construct valid arguments for create_dataset function
# The function iterates over keys, accesses data[k] which should be iterable,
# and for each item v, accesses v['text_{}_raw'.format(text_type)]

# Define the data structure
data = {
    'key1': [
        {'text_summary_raw': 'This is the first text. '},
        {'text_summary_raw': 'This is another text. '}
    ],
    'key2': [
        {'text_summary_raw': 'Yet another text. '},
        {'text_summary_raw': 'Final text here. '}
    ]
}

# Define text_type - used to format the dictionary key
text_type = 'summary'

# Define keys - list of keys to iterate over in data
keys = ['key1', 'key2']

ARGS = {
    'data': data,
    'text_type': text_type,
    'keys': keys
}
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
embed_text Ran
ran; our contract draft was wrong, not the code
sajaddarabi/TAPER-EHR/gen_text_plus_code_data.py
code served (permissive licence) · get_code("891498eb4759ee46")
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 Tensor, ndim 2, dtype family float, shape (30, 8) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 torch.nn as nn

torch.manual_seed(0)

# Create a minimal BERT-like model that implements the interface used in embed_text
class MinimalBERT(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding = nn.Embedding(1000, 8)
        self.pooler = nn.Linear(8, 8)
    
    def forward(self, input_ids, attention_mask=None):
        # input_ids shape: (batch_size, seq_length)
        # Returns: (sequence_output, pooled_output)
        x = self.embedding(input_ids)  # (batch_size, seq_length, 8)
        sequence_output = x
        pooled_output = self.pooler(x.mean(dim=1))  # (batch_size, 8)
        return sequence_output, pooled_output

# Set up device (CPU only)
device = torch.device('cpu')

# Create the BERT model
bert = MinimalBERT()
bert.to(device)
bert.eval()

# Create text_codes as a list of token IDs
# Make it long enough to test the loop logic: need > bert_seq_length tokens
bert_seq_length = 512
text_codes = [i % 1000 for i in range(bert_seq_length * 2 + 100)]

# Create the ARGS dictionary
ARGS = {
    'text_codes': text_codes,
    'device': device,
    'bert': bert,
    'bert_seq_length': bert_seq_length,
    'max_seq_len_text': 30
}
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 Tensor, ndim 2, dtype family float, shape (30, 8) — shape (30, 8) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
filt_code Ran
ran on a synthesized input
sajaddarabi/TAPER/kfold.py
code served (permissive licence) · get_code("7280583eb3f0fa92")
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 valid arguments for filt_code function
# The function expects:
# - data: a dict where keys map to values that are iterables of items
#   each item should have indexable access [code_type] that returns an iterable of codes
# - code_type: an index/key to access codes within each item
# - min_: minimum frequency threshold

# Build a sample data structure
# data is a dict mapping to lists of tuples/lists where each tuple has codes at index code_type
data = {
    'sample1': [
        (['code_a', 'code_b', 'code_c'], 'other_data'),
        (['code_a', 'code_d'], 'more_data'),
    ],
    'sample2': [
        (['code_b', 'code_c', 'code_c'], 'stuff'),
        (['code_e'], 'more_stuff'),
    ],
    'sample3': [
        (['code_a', 'code_f'], 'data'),
        (['code_g'], 'info'),
    ],
}

# code_type is the index where codes are stored (0 in our tuples)
code_type = 0

# min_ is the minimum frequency threshold
min_ = 2

ARGS = {
    'data': data,
    'code_type': code_type,
    'min_': min_,
}
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
multiclass_loss Ran
ran on a synthesized input
sajaddarabi/TAPER/model/loss.py
code served (permissive licence) · get_code("d308579daae4b96f")
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 Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 torch.nn as nn

torch.manual_seed(0)

# For multiclass_loss function:
# - output: logits tensor, shape (batch_size, num_classes)
# - target: target labels tensor, shape (batch_size, num_classes) for BCEWithLogitsLoss

batch_size = 2
num_classes = 4

output = torch.randn(batch_size, num_classes)
target = torch.randint(0, 2, (batch_size, num_classes)).float()

ARGS = {
    "output": output,
    "target": target,
}
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 Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
nll_loss Ran
ran on a synthesized input
sajaddarabi/TAPER/model/loss.py
code served (permissive licence) · get_code("8ee89582184d0fd2")
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 Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 torch.nn.functional as F

torch.manual_seed(0)

# NLL loss expects:
# - output: log probabilities, shape (N, C) or can be squeezed to 1D
# - target: class indices, shape (N,) or can be squeezed to 1D

# Create a batch of 2 samples with 4 classes
# output should be log probabilities
output = torch.log_softmax(torch.randn(2, 4), dim=1)

# target should be class indices (0-3 for 4 classes)
target = torch.tensor([1, 3])

ARGS = {
    "output": output,
    "target": target,
}
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 Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
pr_auc Ran
ran on a synthesized input
sajaddarabi/TAPER/model/metric.py
code served (permissive licence) · get_code("554b2190314a2cea")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 torch.nn as nn

torch.manual_seed(0)

# Create small tensors for output and target
# output: model predictions (batch_size=2, num_classes=4)
output = torch.randn(2, 4)

# target: ground truth labels (batch_size=2)
target = torch.randint(0, 4, (2,))

ARGS = {
    "output": output,
    "target": target
}
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 float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
ret_filtered_code Ran
ran on a synthesized input
sajaddarabi/TAPER/kfold.py
code served (permissive licence) · get_code("b7156db6c87e50d5")
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 set. 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

torch.manual_seed(0)

codes = ['a', 'b', 'c', 'd', 'a', 'b']
filt = {'a', 'c'}

ARGS = {
    'codes': codes,
    'filt': filt
}
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 set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
roc_auc Ran
ran on a synthesized input
sajaddarabi/TAPER/model/metric.py
code served (permissive licence) · get_code("265006dce0cb544d")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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)

# Create small tensors for output and target
# output: model predictions (logits or probabilities)
# target: ground truth binary labels
output = torch.randn(2, 4)  # batch_size=2, num_samples/features=4
target = torch.randint(0, 2, (2, 4)).float()  # binary labels

ARGS = {
    "output": output,
    "target": target,
}
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 float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
roc_auc_1 Ran
ran on a synthesized input
sajaddarabi/TAPER/model/metric.py
code served (permissive licence) · get_code("18537ca71d5519ca")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 sklearn.metrics import roc_curve, auc

torch.manual_seed(0)

# Create sample output (predicted probabilities/scores)
# Should be 1D array of continuous values
output = np.array([0.1, 0.4, 0.35, 0.8, 0.9, 0.2])

# Create sample target (binary labels)
# Should be 1D array of binary values
target = np.array([0, 0, 1, 1, 1, 0])

ARGS = {
    "output": output,
    "target": target,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
mse_loss Not yet run
unverified (harvested, no recorded run)
sajaddarabi/TAPER/model/loss.py
code served (permissive licence) · get_code("523c0753413864a2")
How it ran

no invocation recorded.

preprocess_corpus Not yet run
unverified (harvested, no recorded run)
sajaddarabi/TAPER/process_text.py
code served (permissive licence) · get_code("51f53d8a7255cb07")
How it ran

no invocation recorded.

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

Effective representation learning of electronic health records is a challenging task and is becoming more important as the availability of such data is becoming pervasive. The data contained in these records are irregular and contain multiple modalities such as notes, and medical codes. They are preempted by medical conditions the patient may have, and are typically jotted down by medical staff. Accompanying codes are notes containing valuable information about patients beyond the structured information contained in electronic health records. We use transformer networks and the recently proposed BERT language model to embed these data streams into a unified vector representation. The presented approach effectively encodes a patient's visit data into a single distributed representation, which can be used for downstream tasks. Our model demonstrates superior performance and generalization on mortality, readmission and length of stay tasks using the publicly available MIMIC-III ICU dataset. Code avaialble at https://github.com/sajaddarabi/TAPER-EHR

For agents

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

get_harvested_code_for_paper("1908.03971")
get_code_for_paper("1908.03971")
have("1908.03971")

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

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

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

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

Connect an agent — have() is free.