Skip to content

Dataset

trialdesignbench.dataset

Import curated intake JSON into the canonical, versioned dataset format.

Layout written by import_intake:

<dataset_dir>/
  dataset.json          DatasetManifest
  <task_id>/
    task.json           TaskRecord (agent-visible)
    document.md         protocol/SAP text, when available
    rubrics.json        RubricSet (hidden from the agent)

DatasetError

Bases: ValueError

Raised when intake data or a dataset directory is invalid.

attach_document(dataset_dir, task_id, document, *, source=None)

Add or replace a task's source document and refresh digests.

check_dataset(dataset_dir)

Return every problem found. An empty list means the dataset is usable.

convert_prompts(sub)

Split intake prompts into agent-visible questions and hidden rubrics.

find_document(documents_dir, sub)

Locate <task_id>.md, <trial_id>.md, or <intake stem>.md.

import_intake(intake_files, out, *, documents_dir=None, username=None, dataset_version=DEFAULT_DATASET_VERSION, publicly_indexed=None, force=False)

Import intake files into a canonical dataset directory.

load_dataset(dataset_dir, task_ids=None)

Load the manifest and (task, rubrics) pairs, optionally a subset.

load_manifest(dataset_dir)

Load a dataset.json.

load_rubrics(path)

Load a rubrics.json.

load_task(task_dir)

Load a task.json.

read_intake(path)

Read and minimally validate one curated intake JSON file.

select_submissions(submissions, username=None)

Pick one submission per task: latest submittedAt, or the given user's.

task_id_from_trial_id(trial_id)

Filesystem- and registry-safe slug for a trial identifier.

10.1200_jco-24-01818 -> 10-1200-jco-24-01818. A leading URL scheme and doi.org/ are dropped so DOI spellings map to the same slug.

write_manifest(out, *, dataset_version)

Recompute task digests and write dataset.json.