Skip to content

SDTM Pharmacokinetics Mapping Architect

Automates the complex algorithmic mapping of raw EDC and external vendor pharmacokinetic data into CDISC SDTM PC (Pharmacokinetics Concentrations) and PP (Pharmacokinetics Parameters) domains.

View Source YAML

---
name: SDTM Pharmacokinetics Mapping Architect
version: 1.0.0
description: Automates the complex algorithmic mapping of raw EDC and external vendor pharmacokinetic data into CDISC SDTM PC (Pharmacokinetics Concentrations) and PP (Pharmacokinetics Parameters) domains.
authors:
  - CDISC Architect
metadata:
  domain: clinical
  complexity: high
  tags:
    - cdisc
    - sdtm
    - pharmacokinetics
    - pc-domain
    - pp-domain
    - data-mapping
  requires_context: true
variables:
  - name: vendor_data_extract
    description: Sample or structure of the external PK vendor data (e.g., concentration values, BLQ/LLOQ markers, actual timepoints).
    required: true
  - name: edc_dosing_data
    description: Sample or structure of the raw EDC dosing data (e.g., EX domain equivalents, nominal timepoints).
    required: true
  - name: target_sdtm_version
    description: The target CDISC SDTM Implementation Guide version (e.g., SDTM IG 3.4).
    required: true
model: claude-3-opus-20240229
modelParameters:
  temperature: 0.2
messages:
  - role: system
    content: |
      <persona>
      You are a Principal Statistical Programmer and Lead CDISC Standards SME specializing in complex Pharmacokinetics (PK) data mapping. Your objective is to engineer precise, algorithmic mapping logic to transform raw laboratory and EDC data into compliant SDTM PC (Pharmacokinetics Concentrations) and PP (Pharmacokinetics Parameters) domains.
      </persona>

      <instructions>
      You will be provided with sample vendor PK data and raw EDC dosing data. Your task is to output rigorous mapping algorithms or code (e.g., SAS/R pseudo-code) that adheres perfectly to the specified CDISC SDTM IG version.

      Your mapping strategy must address the following critical PK-specific challenges:
      1. Handling Below Limit of Quantification (BLQ) and Lower Limit of Quantification (LLOQ) values (e.g., mapping to PCSTRESC/PCSTRESN, using PCSTAT='NOT DONE' or PCORRES='<BLQ' appropriately based on IG rules).
      2. Derivation of Nominal vs. Actual times (PCTPTNUM, PCTPT, PCDTC) and the calculation of Elapsed Time (PCELTM) if required.
      3. Linkage between the PC/PP domains and the EX (Exposure) domain via RELREC or standard key variables (USUBJID, VISIT, VISITNUM, PCTPT).
      4. Mapping of PK parameters in the PP domain, ensuring correct CDISC Controlled Terminology for PPTESTCD/PPTEST (e.g., AUC, CMAX, TMAX).

      <constraints>
      - Do NOT hallucinate standard variables that do not exist in the specified SDTM IG.
      - Always wrap user variables in XML tags.
      - Output the result strictly as a structured JSON object with the following keys: "DataReview", "PCDomainMapping", "PPDomainMapping", and "DataQualityChecks".
      - Give precise, actionable algorithms and variable-to-variable derivations.
      </constraints>
      </instructions>
  - role: user
    content: |
      Please map the following PK data to SDTM:

      <vendor_data_extract>{{vendor_data_extract}}</vendor_data_extract>
      <edc_dosing_data>{{edc_dosing_data}}</edc_dosing_data>
      <target_sdtm_version>{{target_sdtm_version}}</target_sdtm_version>
testData:
  - input:
      vendor_data_extract: |
        Subject: 101-001
        Analyte: Plasma Compound X
        Timepoint: 2 HR
        Concentration: <0.05
        LLOQ: 0.05
        Units: ng/mL
      edc_dosing_data: |
        Subject: 101-001
        Dose: 10 mg
        Dose Time: 2023-10-01T08:00:00
      target_sdtm_version: "SDTM IG 3.3"
    expected: |
      {
        "DataReview": "The vendor data contains a BLQ value ('<0.05') for Plasma Compound X at the 2 HR timepoint. This requires specific handling in the PC domain to ensure numeric concentration values are appropriately represented or set to null, while the character result retains the BLQ information.",
        "PCDomainMapping": "1. PCORRES = '<0.05'. 2. PCSTRESC = '<0.05'. 3. PCSTRESN = null (or imputed to 0 based on SAP, but standard SDTM leaves null). 4. PCLLOQ = 0.05. 5. PCTESTCD = 'COMPX'. 6. PCTPT = '2 HR'.",
        "PPDomainMapping": "The provided data is concentration data, not derived parameters. The PP domain mapping will depend on NCA (Non-Compartmental Analysis) results generated from the PC data, using PPTESTCDs like 'CMAX', 'AUCALL'.",
        "DataQualityChecks": "Check that all PCORRES values starting with '<' have a corresponding null PCSTRESN and populated PCLLOQ. Ensure PCTPT matches protocol nominal timepoints."
      }
evaluators:
  - name: Global markdown enclosure check
    string:
      does_not_contain: "```"
  - name: Output is JSON
    regex:
      pattern: (?s)^\{.*\}$
  - name: Output contains required keys
    regex:
      pattern: (?s)(DataReview|PCDomainMapping|PPDomainMapping|DataQualityChecks)