validate.data_io.build_capsule#
Build one PatientRecord per patient and attach them to a DataCapsule.
Combines patient discovery with the per-patient CSV inputs (plan_structures_csv, predictors_csv, outcomes_csv; see data_import for their formats). Values only known once a patient’s data is loaded (dose index, computed predictors, NTCP) are initialized to None.
Functions
|
Read the analysis settings and build every patient's record. |
|
Build a single patient's PatientRecord. |
|
Build one PatientRecord per patient, using dataCapsule's cohort-level defaults where needed. |
- validate.data_io.build_capsule.buildCapsule(analysisPath, errorLog=None)[source]#
Read the analysis settings and build every patient’s record.
- Parameters:
analysisPath (str) – path to the analysis settings file.
errorLog (validate.logs.ErrorLog or None) – see buildPatientRecords.
- Returns:
DataCapsule – analysis-level settings with patients filled in.
- validate.data_io.build_capsule.buildPatientRecords(dataCapsule, errorLog=None)[source]#
Build one PatientRecord per patient, using dataCapsule’s cohort-level defaults where needed.
- Parameters:
dataCapsule (DataCapsule) – analysis-level settings.
errorLog (validate.logs.ErrorLog or None) – if given, a patient whose record can’t be built (e.g. empty folder, unresolvable file pattern, non-numeric CSV cell) is written to it and skipped, so the rest of the cohort continues. If None, the error is raised.
- Returns:
list of PatientRecord, sorted by pt_id.
- validate.data_io.build_capsule.buildPatientRecord(ptId, dataDir, recipes, planRow=None, predictorsRow=None, outcomesRow=None)[source]#
Build a single patient’s PatientRecord.
- Parameters:
ptId (str) – patient ID.
dataDir (str or None) – patient folder; None when starting from predictors.
recipes (dict) – analysis-level structure recipes (DataCapsule.structures).
planRow (pandas.Series or None) – this patient’s row from plan_structures_csv, predictors_csv and outcomes_csv, or None.
predictorsRow (pandas.Series or None) – this patient’s row from plan_structures_csv, predictors_csv and outcomes_csv, or None.
outcomesRow (pandas.Series or None) – this patient’s row from plan_structures_csv, predictors_csv and outcomes_csv, or None.
- Returns:
PatientRecord