Download cases/oracle_clinical_one_data_collection/driver.py from JoeYing/ReScopeBench: direct link, hf CLI and curl.
- Browser
- Download file 1.91 kB
-
https://huggingface.co/datasets/JoeYing/ReScopeBench/resolve/main/cases/oracle_clinical_one_data_collection/driver.py
- Command line
-
hf download hf://datasets/JoeYing/ReScopeBench/cases/oracle_clinical_one_data_collection/driver.py
-
curl -L -o driver.py https://huggingface.co/datasets/JoeYing/ReScopeBench/resolve/main/cases/oracle_clinical_one_data_collection/driver.py
1.91 kB
| """Single released task-stream entry point.""" | |
| from copy import deepcopy | |
| from rescopebench.case_validation import ReleasedCase | |
| from .spec import DATA, DATA_TOOLS, DATA_TASKS, DATA_PROMPT, DATA_SCHEDULE | |
| from .runtime import fn_targets, fn_expectations, World | |
| class Driver(ReleasedCase): | |
| case_id = 'oracle_clinical_one_data_collection' | |
| case_version = 'oracle-independent-corrections-evolution-v3' | |
| def __init__(self): | |
| self.tools = deepcopy(DATA_TOOLS) | |
| self.tasks = deepcopy(DATA_TASKS) | |
| self.directory = deepcopy(DATA) | |
| self.prompt = deepcopy(DATA_PROMPT) | |
| self.lifecycle_schedule = deepcopy(DATA_SCHEDULE) | |
| def create_world(self): | |
| return World() | |
| def begin(self, world, task): | |
| if task['position'] == self.lifecycle_schedule['events'][0]['before_task']: | |
| boundary = world.apply_policy_drift('correction-audit-revision-v2') | |
| if boundary['status'] != 'success': | |
| raise RuntimeError('Oracle priority boundary failed') | |
| active = world.activate_task(task['private_task_id'], [{key: row[key] for key in ('record_ref', 'correction_class')} for row in fn_targets(task['private_task_id'])], allowance=17) | |
| return {'status': active['status'], 'event_id': task['event_id'], 'active_artifact_count': active['active_record_count'], 'allowance': active['allowance']} | |
| def call(self, world, name, arguments): | |
| return world.dispatch(name, arguments, 'clinical_data_corrector') | |
| def grade(self, world, task): | |
| return world.grade(fn_expectations(task['private_task_id'])) | |
| def public_grade(self, grade): | |
| components = {f'artifact_{index}': {'correct': int(bool(row.get('complete'))), 'total': 1} for (index, row) in enumerate(grade['artifacts'], 1)} | |
| return {'score': grade['score'], 'public_components': components} | |
| def close(self, world): | |
| world.close() | |