Write the pharmacokinetic analysis pipeline for a phase 1 single-ascending-dose programme from LIMS and CRF exports of two bioanalytical laboratories; it is run on further study packages with known individual parameters.
harbor run -t reactive-labs/pk-dose-escalationharbor download reactive-labs/pk-dose-escalationYou are Mirela Okafor, pharmacometrician in Clinical Pharmacology & Pharmacometrics at Tidewell Clinical Research. Tidewell runs the phase 1 single-ascending-dose studies of CFT-2291 for Calloway Ferris Therapeutics at its Saltmarsh Quay unit. Today is Monday 14 September 2026. Tomas Halloran, head of the group, wrote this morning:
Three packages are final in Data Management as of Friday: 101, 102 and 104. Calloway Ferris want the individual parameters, ka and the dose-proportionality call for all three by the end of the month, and they have two more SAD studies booked into the unit for Q4, so I do not want this done by hand again. Please write the analysis as one script that takes a study package and writes the results file, under PKAP v2.0. Jelena will run it on the qualification series before we are allowed to use it on anything that goes to the sponsor.
In /app/inputs:
packages/CFT2291-101, packages/CFT2291-102, packages/CFT2291-104: the three study packages. Each holds
the Assaybook LIMS export of plasma concentrations (*_LIMS_PK_results.xlsx), the EDC extracts for dosing,
PK sample collection, demographics and adverse events (*_EX.csv, *_PC.csv, *_DM.csv, *_AE.csv), the
unblinded randomisation list, the protocol deviation log and package_manifest.json.docs/: the PK analysis plan PKAP-2291 v2.0, the method validation and data documents of the two bioanalytical
laboratories, the pharmacy manual extract, the export specification ES-014 and the e-mail thread with Tomas,
QA and the bioanalytical project manager.legacy/: the script the previous analyst used for the interim reviews of study 101, and his handover notes./app/output/pk_analyze.py, run as
python3 /app/output/pk_analyze.py <study_package_dir> <out.json>
It reads one study package in the format of the three in hand and writes one JSON object:
| Key | Content |
|---|---|
study |
study number from the manifest (not scored) |
subjects |
object keyed by subject number (string, e.g. "1003"), with exactly the subjects of the PKAP section 5 PK set |
subjects[id].auc_inf |
AUCinf, ng.h/mL of CFT-2291 free base |
subjects[id].cmax |
Cmax, ng/mL of CFT-2291 free base |
subjects[id].t_half |
terminal half-life, h |
subjects[id].cl_f |
CL/F, L/h, as defined in PKAP section 7 |
subjects[id].vz_f |
Vz/F, L, as defined in PKAP section 7 |
ka |
first-order absorption rate constant of the PKAP section 8 model, 1/h, geometric mean over the PK set |
beta_auc, beta_cmax |
power-model exponents for AUCinf and Cmax, PKAP section 9.1 |
beta_auc_ci90 |
[lower, upper], the two-sided 90% confidence interval of beta_auc, PKAP section 9.1 |
dose_proportionality |
the section 9.2 conclusion for AUCinf: "proportional", "not_proportional" or "inconclusive" |
The script runs with Python 3.12, numpy, scipy, pandas and openpyxl, on one CPU core with 3 GB of memory and no
network, and must finish a package within 60 seconds. It is run as another user from a copy of
/app/output: it may load helper files that you put in /app/output (found relative to __file__), but
/app/inputs is not there when it runs.
/app/output/results/CFT2291-101.json, CFT2291-102.json and CFT2291-104.json: the script's output for
the three packages in hand.
QA runs your script on the qualification series: further study packages from the same unit, laboratories and
export format, generated from the PKAP section 8 model so that every subject's parameters are known. They cover what
the plan and the laboratory documents provide for, on other dose ladders and laboratory allocations than the three
studies in hand. Your output is compared with the generating values: each subject's AUCinf, CL/F, terminal
half-life and Vz/F as they follow from that subject's model parameters and dose, Cmax as the peak of the subject's
concentration-time curve, ka as the geometric mean of the subjects' absorption rate constants, and the section 9
exponents and conclusion as computed from the generating AUCinf and Cmax values. The three packages in hand were
checked by Biostatistics in the same way and your result files are compared likewise.
Each package scores up to 100 points:
| Item | Points | Full credit within |
|---|---|---|
| AUCinf | 30 | 10% |
| Cmax | 10 | 12% |
| terminal half-life | 15 | 15% |
| CL/F | 10 | 10% |
| Vz/F | 5 | 18% |
subjects holds exactly the PK set (no subject missing, none extra) |
10 | exact |
ka |
5 | 15% |
beta_auc |
7 | 0.03 (absolute) |
beta_cmax |
3 | 0.03 (absolute) |
dose_proportionality with beta_auc_ci90 |
5 | each confidence limit within 0.03 (absolute) |
A value earns full credit within the stated error, falling linearly to nothing at twice that error. For the five per-subject parameters, the credit is averaged over the subjects of the true PK set (a missing subject or a non-positive or non-numeric value counts as zero); the parameter earns nothing while that average is 0.30 or less, its full points when the average is at least 0.96, and a linear share of its points in between; a subject's Cmax, half-life, CL/F and Vz/F credit is first multiplied by that subject's AUCinf credit. The five study-level items below them in the table are multiplied by the package's AUCinf fraction (its share of the AUCinf points), so they count only as far as the exposures are right. The conclusion earns credit only if it is the section 9.2 conclusion for the confidence interval you report; its credit is then the lower of the two limits' credits. A package on which the script fails, runs out of time or writes no readable JSON scores zero. The final score is 80% the mean over the qualification packages and 20% the mean over the three result files.