{
  "id": "sdtm-mapping-spec-draft-from-crf",
  "title": "SDTM mapping spec draft from CRF pages: CDISCPILOT01 (xanomeline TTS in Alzheimer's disease)",
  "study": {
    "name": "CDISCPILOT01, CDISC SDTM/ADaM Pilot Project (Lilly protocol H2Q-MC-LZZT); annotated blank CRF and Define-XML",
    "source_url": "https://github.com/cdisc-org/sdtm-adam-pilot-project",
    "licence_note": "Data and documents belong to the CDISC SDTM/ADaM Pilot Project (CDISC). Used here as short quoted excerpts with attribution to CDISC, unmodified, under the Terms of Use in the repository README, which prohibit modifying the Data and distributing it without attribution to CDISC. Source files: sdtm_blankcrf.pdf (157 pages; CRF PDF pages 7, 8 and 16 used) and sdtm_define.xml (answer key, opened only after the good output was saved). The CRF text layer is copyright Eli Lilly and Co. 2006 as printed on the form. Study dates are fictional and the data were repurposed from a real Lilly study."
  },
  "task": "Draft an SDTM mapping specification (CRF field, SDTM variable, origin, controlled terminology, derivation, CRF page) from three CRF pages, and list what the pages do not settle.",
  "time_to_try_minutes": {
    "minutes": 25,
    "label": "estimate, not measured: about 5 to paste and run, 20 to check against your own annotated CRF and define file"
  },
  "good": {
    "input_excerpt": "Note: this is the raw PDF text layer of CDISC's annotated blank CRF, left exactly as extracted. Annotation fragments (STUDYID, VSTESTCD, VSORRESU, 'when ...') are printed over the form and interleave, so the text order is scrambled in places. '?' stands for an unprintable check-box glyph. Three pages only, so the example fits one screen; a real spec covers all 157 pages.\n\n[CRF PDF p. 7 (Visit 1, page 1 of 14)]\nH2Q-MC-LZZT STUDYID\nwhen\nPATIENT ANSDTUVDIYSIDIT= IDENTIFICATION\n\"CDISCPIL\nOT01\"\nNot Entered In Database\nPatient initials ______ ______ _____\nFirst Middle Last\n--STDTC --DTC\nVisit date _____[S/_V_S_T_D_/T_C___[_AEDTC\nMM , DD YY ,\nDSSTDTC] CMDTC\nINFORMED CONwShEenNT ,\nVISITNUM DMDTC\n=\"1\" , Not Entered In Database\nDate patient and caregiver signed tShCeDcoTnCs,ent document _____/_____/_____\nQSDTC,\nMM DD YY\nVSDTC,\nDEMOGRAPHICS DSDTC,\nMHDTC]\nwhen\nNot Entered In DatVaIbSaIsTeN\nDate of birth _____/_____/_____ UM=\"1\"\nMM DD YY\nSEX Sex ?F Female ?M Male\n? RACE Origin CA Caucasian (European, Mediterranean, Middle Eastern)\n? African Descent (Negro, Black)\nAF\n?EA East/Southeast Asian (Burmese, Chinese, Japanese, Korean, Mongolian, Vietnamese)\n?AS Western Asian (Pakistani, Indian Sub-continent)\n?HP Hispanic (Mexican-American, Mexico, Central and South America)\n?O Other (Mixed-racial parentage, American Indian, Eskimo)\n\n[CRF PDF p. 16 (Visit 1, page 9 of 14)]\nH2Q-MC-LZZT\nWEIGHT\nVSTESTCD\nINFORMATIOwNhNeOn T OBTAINED Not Entered In Database\nVSTESTCD\nMeasure with s=h\"WoeEsIGofHf.TR\" ound up or down to the nearest tenth kilogram or tenth pound.\nWeight __V_S_O__R_R_E_S. ___ kg Kilogram lb Pound\nwhen\nVSTESTC VSORRESU\nD=\"WEIGH\nT\" when\nVSTESTCD\n=\"WEIGHT\"\nHEIGHT VSTESTCD Not Entered In Database\nwhen\nINFORMATIONVSNTOETSTOCBDTAINED\n=\"HEIGHT\"\nMeasure with shoes off. Round up or down to the nearest tenth inch or tenth centimeter.\nVSORRES cm Centimeter in Inch\nHeight _w_h_e_n__ ___ . ___\nVSORRESU\nVSTESTC\nD=\"HEIGH when\nT\"\nVSTESTCD\n=\"HEIGHT\"\nVITAL SIGNS : HEART RATE AND BLOOD PRESSURE\nINFORMATION NOT OBTAINED Not Entered In Database\nNOTE: Blood pressure and pulse must be taken after the\npatient has been lying down for 5 minutes\nPosition (supine) and after standing for 1 minute (standing)\nSU = Supine and 3 minutes.\nVSTPTNUM ST = Standing\nVSTPT VSPOS\nVSTESTCD\n(DNDE)\nwheHneart Blood Pressure\nReference Timing PositionVSTREaSteTCD (mmHg)\n=\"P(UbLpSmE) \" Systolic/Diastolic\nTime Code\n0. 5 minutes 815 SU VSORRESU /\nST\nST wVhSeOn RRES VSTESTCD\nVwShOenRRESU\n1. 1 minute 816 VwShTeEnSTCD= / wVVhSSeTOnERSRTECSD\n\"PVUSTLSEES\"TC V=wS\"hDTeIEAnSBTPC\" D\n=V\"DSTIAEBSPT\"C\n2. \"D=\"PULVSwVSEShOeTnERSRTECSDU/ D=\"DIABP\"\n3 minutes 817\nwVVhSSeTOnERSRTCESD\nV=w\"SShTYeEnSSBTPC\"D\n=V\"SSYTSEBSPT\"C\nD=\"SYSBP\n[CRF PDF p. 8 (Visit 1, page 2 of 14)]\nH2Q-MC-LZZT\nEDUCATION\nSCTESTCD SCORRES\nwhen Number of years of education completed w_h_e_n__\nSCTESTCD= SCyeTaErsSTC\n\"YEARSEDU DS=C\"OYRERARESU\n\" SwEhDenU\"\nSCTESTCD\nHABITS : SMOKING\n=\"YEARSED\nINFORMATION NOT OBTAINED Not EUn\"tered In Database\nEnter the average current daily use\n0 = None\nL = Less than one (eg, cigar or pipe smoker\nwho smokes only 1 or 2x a week)\n1, 2, 3, etc = Whole numbers ONLY\nNumber of cigarettes N_o_t_E_n_t_ered In Database\nNumber of cigars N_o_t _E_n_t_ered In Database\nNumber of pipesful N_o_t_E_n_t_ered In Database\nEnter the number of years (past or current) patient Not Entered In Database\nhas smoked. If patient has never smoked, enter 0. ______\nyears\n(If the patient has NEVER smoked or is still smoking, Not Entered In Database\nleave the following question blank.)\n_____/_____\nEnter the month and year that the patient quit smoking.\nMM YY\nHABITS : ALCOHOL\nINFORMATION NOT OBTAINED Not Entered In Database\nEnter the average current weekly consumption\n0 = None\nL = Less than one\n1, 2, 3, etc = Whole numbers ONLY\nNumber of beers or wine coolers/spritzers _N_o_t_E_n_tered In Database\nNumber of glasses of wine N__o_t _E_n_tered In Database\nNumber of drinks containing distilled spirits N__o_t _E_n_tered In Database",
    "input_excerpt_words": 538,
    "prompt": "You are helping a clinical programmer draft an SDTM mapping specification from case report form (CRF) pages. Use ONLY the CRF text above plus your knowledge of the CDISC SDTM Implementation Guide. Produce a mapping table with these columns: CRF field (as printed) | SDTM domain.variable | Origin (CRF / Assigned / Derived) | Controlled terminology or format | Derivation or comment | CRF page. The text layer contains annotation fragments printed over the form; use them where legible, but do not trust a fragment you cannot read in full. Where the pages do not settle something (a variable, a codelist, a unit rule, which domain a field belongs in), do not guess: list it in a final section \"Open questions for the data manager\", numbered, each tied to a CRF page. Do not invent codelist values, visit numbers, or domains that the pages do not support. Mark anything you add from general SDTM knowledge as \"suggestion\".",
    "output": "# Draft SDTM mapping specification: Visit 1, CRF PDF pp. 7, 8 and 16 (H2Q-MC-LZZT)\n\n**Reading notes**\n- Annotation text overlaps the form and is scrambled in several places. A fragment I could read in full is quoted as read. A fragment I could only partly read is marked \"partial\". I do not rely on a partial fragment.\n- The CRF prints \"Not Entered In Database\" beside many items. I take it to mean the item is on the paper CRF but not in the clinical database. Whether such items are mapped at all is Open question 1.\n- Everything labelled \"suggestion\" comes from general SDTM knowledge, not from the pages.\n- The pages give no SDTM variable for USUBJID, SUBJID, SITEID, DOMAIN, --SEQ, VISIT or --TEST. I do not fill those in.\n\n## Mapping table\n\n### PDF p. 7 (Visit 1, page 1 of 14)\n\n| CRF field (as printed) | SDTM domain.variable | Origin | CT / format | Derivation or comment | CRF page |\n|---|---|---|---|---|---|\n| Header \"H2Q-MC-LZZT\" with annotation \"STUDYID\" and fragment \"CDISCPILOT01\" | STUDYID (all domains) | Assigned | Literal \"CDISCPILOT01\" (fragment read in full) | The printed H2Q-MC-LZZT is the sponsor protocol number, and the fragment gives a different STUDYID value. See Q2. | 7 |\n| Patient initials (First / Middle / Last) | None | n/a | n/a | Marked \"Not Entered In Database\". No variable is annotated. Suggestion: do not map. | 7 |\n| Patient and site identifiers | None legible. The \"PATIENT ... IDENTIFICATION\" heading is interleaved with another fragment (partial). | n/a | n/a | See Q3. | 7 |\n| Visit date (MM/DD/YY) | SV.SVSTDTC. A fragment reads \"SVSTDTC\" (partial). The same date is also routed to other --DTC variables, as in the next row. | CRF | ISO 8601. The CRF format is MM/DD/YY. | Convert to YYYY-MM-DD. The two-digit year needs a century rule (Q4). | 7 |\n| (Visit date annotation list) | The fragments read AEDTC, CMDTC, DMDTC, DSSTDTC, DSDTC, QSDTC, VSDTC, MHDTC and SCDTC (partial, in scrambled order). | CRF | ISO 8601 | The list is not fully legible. Suggestion: AE and CM have no standard --DTC variable, since they use --STDTC. See Q4. | 7 |\n| (no printed label) | VISITNUM | Assigned | \"1\" (fragment VISITNUM=\"1\" appears more than once, legible) | The \"when VISITNUM=1\" wording suggests the demographics and consent items apply only at Visit 1. | 7 |\n| Date patient and caregiver signed the consent document (MM/DD/YY) | Domain unresolved. Candidates: DS.DSSTDTC or DM.RFICDTC (suggestion). A \"DSSTDTC\" and an \"SCDTC\" fragment sit nearby, but I cannot tie either to this field. | CRF | ISO 8601 | One date covers both patient and caregiver. Suggestion for DS: DSDECOD \"INFORMED CONSENT OBTAINED\", with a protocol-milestone category. See Q5. | 7 |\n| Date of birth (MM/DD/YY) | DM.BRTHDTC (suggestion) | CRF | ISO 8601 | A \"Not Entered In Database\" label sits in the demographics block and may apply to this field (Q1). Suggestion: derive DM.AGE from BRTHDTC and RFSTDTC only if DOB is in the database. | 7 |\n| Sex: \"F Female\", \"M Male\" | DM.SEX | CRF | F, M (printed codes). Suggestion: these match the CDISC SEX codelist. | Direct. | 7 |\n| Race \"Origin\": CA Caucasian (European, Mediterranean, Middle Eastern); AF African Descent (Negro, Black); EA East/Southeast Asian; AS Western Asian (Pakistani, Indian Sub-continent); HP Hispanic (Mexican-American, Mexico, Central and South America); O Other (Mixed-racial parentage, American Indian, Eskimo) | DM.RACE (suggestion). The HP option may belong in DM.ETHNIC instead (Q6). | CRF | The 2-letter codes are CRF codes only. Do not copy them into RACE. | The pages give no SDTM term for each option, so I have not proposed any. Whether the form allows more than one box is not shown (Q6). | 7 |\n\n### PDF p. 8 (Visit 1, page 2 of 14)\n\n| CRF field (as printed) | SDTM domain.variable | Origin | CT / format | Derivation or comment | CRF page |\n|---|---|---|---|---|---|\n| Number of years of education completed | SC.SCORRES | CRF | Numeric, in years | Annotation reads SCTESTCD=\"YEARSEDU\" (read in full), so the domain is SC. SCORRESU is annotated, but the value is only partly legible. Suggestion: \"YEARS\". SCTEST label: suggestion \"Years of Education\". | 8 |\n| (SCTESTCD) | SC.SCTESTCD | Assigned | \"YEARSEDU\" | A sponsor-defined test code. I did not check it against the CDISC codelist. | 8 |\n| HABITS: SMOKING, \"Information not obtained\" | Suggestion: SU.SUSTAT = \"NOT DONE\" | CRF | n/a | Marked \"Not Entered In Database\". No domain is annotated (Q7). | 8 |\n| Number of cigarettes, cigars, pipesful (average current daily use) | Suggestion: SU (SUTRT = CIGARETTES, CIGARS, PIPE; SUDOSE; SUDOSFRQ = per day) | CRF | 0 = None; L = Less than one; 1, 2, 3... whole numbers | Each item is marked \"Not Entered In Database\". \"L\" is not numeric, so the rule for SUDOSE/SUORRES needs agreeing (Q7). | 8 |\n| Number of years (past or current) patient has smoked; enter 0 if never smoked | Suggestion: SU.SUDUR | CRF | Suggestion: ISO 8601 duration, \"P#Y\" | Marked \"Not Entered In Database\". 0 means never smoked. | 8 |\n| Month and year that the patient quit smoking (MM/YY) | Suggestion: SU.SUENDTC | CRF | ISO 8601 partial date, YYYY-MM | Marked \"Not Entered In Database\". The form says to leave it blank if the patient never smoked or still smokes. The century is open (Q4). | 8 |\n| HABITS: ALCOHOL, \"Information not obtained\" | Suggestion: SU.SUSTAT = \"NOT DONE\" | CRF | n/a | Marked \"Not Entered In Database\". | 8 |\n| Number of beers or wine coolers/spritzers; glasses of wine; drinks containing distilled spirits (average current weekly consumption) | Suggestion: SU (SUTRT = ALCOHOL, with SUDOSE and SUDOSFRQ = per week) | CRF | 0 = None; L = Less than one; whole numbers | All three are marked \"Not Entered In Database\". Whether the three types become three records or one is open (Q7). | 8 |\n\n### PDF p. 16 (Visit 1, page 9 of 14)\n\n| CRF field (as printed) | SDTM domain.variable | Origin | CT / format | Derivation or comment | CRF page |\n|---|---|---|---|---|---|\n| Weight, \"Information not obtained\" | Suggestion: VS.VSSTAT = \"NOT DONE\" | CRF | n/a | Marked \"Not Entered In Database\" (Q1). | 16 |\n| Weight (__ __ __ . __) | VS.VSORRES | CRF | Numeric, rounded to the nearest tenth. The width is not shown. | Annotation: VSTESTCD=\"WEIGHT\" (read in full). | 16 |\n| Weight unit: kg Kilogram, lb Pound | VS.VSORRESU | CRF | The printed codes are \"kg\" and \"lb\". Whether these match the CDISC UNIT terms is Q8. | The unit is chosen per record. Suggestion: standardize to kg in VSSTRESN and VSSTRESU, converting lb. | 16 |\n| (VSTESTCD) | VS.VSTESTCD | Assigned | \"WEIGHT\" | Suggestion: VSTEST \"Weight\". | 16 |\n| Height, \"Information not obtained\" | Suggestion: VS.VSSTAT = \"NOT DONE\" | CRF | n/a | Marked \"Not Entered In Database\". | 16 |\n| Height (__ __ __ . __) | VS.VSORRES | CRF | Numeric, rounded to the nearest tenth. The format shown is `___ . ___`. | Annotation: VSTESTCD=\"HEIGHT\" (read in full). Measured with shoes off. | 16 |\n| Height unit: cm Centimeter, in Inch | VS.VSORRESU | CRF | The printed codes are \"cm\" and \"in\". See Q8. | Suggestion: standardize to cm. | 16 |\n| (VSTESTCD) | VS.VSTESTCD | Assigned | \"HEIGHT\" | Suggestion: VSTEST \"Height\". | 16 |\n| Vital signs table: Reference Timing, Position, Time Code | VS.VSPOS, VS.VSTPT, VS.VSTPTNUM (annotated; fragment names read) | CRF / Assigned | Position codes printed: SU = Supine, ST = Standing. | The rows pair as follows, based on line order in the scrambled text: 5 minutes with code 815 and SU, 1 minute with 816 and ST, 3 minutes with 817 and ST. The VSPOS terms are not given (Q9). | 16 |\n| Time Code 815 / 816 / 817 | VS.VSTPTNUM | Assigned | 815, 816, 817 | This follows the row pairing above. The VSTPT wording is not given (Q9). | 16 |\n| Heart Rate | VS.VSORRES with VSTESTCD \"PULSE\" | CRF | Numeric | A fragment resembling `\"PULSE\"` is only partly legible. The unit is also partly legible (a \"bpm\"-like fragment). Not relied on (Q10). | 16 |\n| Blood Pressure (mmHg), Systolic/Diastolic | VS.VSORRES with VSTESTCD \"SYSBP\" and \"DIABP\" | CRF | Numeric. The unit \"mmHg\" is printed in the column header. | The fragments \"SYSBP\" and \"DIABP\" are legible. One slash-separated entry makes two VS records per position and timepoint. VSORRESU = \"mmHg\" follows the printed header (Q8). | 16 |\n| Vital signs, \"Information not obtained\" | Suggestion: VS.VSSTAT = \"NOT DONE\" | CRF | n/a | Marked \"Not Entered In Database\". | 16 |\n| (visit date for VS) | VS.VSDTC | CRF | ISO 8601 | Taken from the p. 7 visit date. The VSDTC fragment is partial (p. 7). | 16 |\n\n## Open questions for the data manager\n\n1. **p. 7, 8, 16.** The CRF prints \"Not Entered In Database\" on initials, the \"Information not obtained\" boxes, every smoking and alcohol item, and the demographics block. Is the date of birth itself flagged, or only the block? Should these items be omitted from SDTM, or mapped from another source?\n2. **p. 7.** Is STUDYID \"CDISCPILOT01\" (from the fragment) or \"H2Q-MC-LZZT\" (the printed protocol number)? Where does the other value go, for example DM.SPONSOR or a protocol field?\n3. **p. 7.** The patient and site identification fields and their annotations are not legible. What are the SUBJID, SITEID and USUBJID derivations?\n4. **p. 7, 8.** The visit-date annotation list is scrambled, and it includes AEDTC and CMDTC, which are not standard IG variables. Confirm the exact target list. The CRF uses two-digit years (YY), so what century rule applies?\n5. **p. 7.** Which domain and variable hold the consent date: DS.DSSTDTC, DM.RFICDTC, or SC? I cannot tell which of the nearby DSSTDTC and SCDTC fragments applies. Which DSCAT and DSDECOD apply?\n6. **p. 7.** What is the SDTM mapping for each of the six race options? Does HP (Hispanic) go to ETHNIC rather than RACE? Can more than one option be ticked? Is the \"Origin\" label relevant?\n7. **p. 8.** Which domain holds smoking and alcohol: SU, MH, or SC? How should the code \"L\" (less than one) be stored in a numeric result? How should the beer, wine and spirits items be split into records?\n8. **p. 16.** Which unit terms should VSORRESU use for the printed kg, lb, cm, in and mmHg? Is conversion to standard units (VSSTRESU) required, and to which units?\n9. **p. 16.** Do VSPOS terms and VSTPT text exist for 815, 816 and 817? Is my pairing of 815 with SU and 5 minutes, 816 with ST and 1 minute, and 817 with ST and 3 minutes correct? The standing times 1 and 3 minutes should be confirmed against the note text.\n10. **p. 16.** What are the exact VSTESTCD and VSORRESU annotations for heart rate? The fragments are only partly legible.\n11. **p. 16, 7.** The pages show VISITNUM=\"1\" only on p. 7 and label p. 16 \"Visit 1\". May I assign VISITNUM = 1 to the p. 16 and p. 8 records, and what is the VISIT label?",
    "trim_note": "The output is the full cold run, copied verbatim and not trimmed. The input excerpt is the raw text layer of CRF PDF pages 7, 8 and 16 with only the page header and footer blocks removed; fragments are left exactly as extracted.",
    "contamination_note": "The good output came from a separate subagent that saw only the excerpt and the prompt and was told to use no tools. The answer key (sdtm_define.xml) was opened only after the output was saved to a scratch file. The CRF text layer already contains CDISC's SDTM annotations, so the model was partly reading the answer from the form, as a programmer with an annotated CRF would. No SDTMIG text was supplied."
  },
  "bad": {
    "input": "Write an SDTM mapping spec for the CRF of an Alzheimer's trial.",
    "output": "# SDTM Mapping Specification: Alzheimer's Disease Trial\n\n## 1. Overview\nThis specification maps the case report form (CRF) data of the Alzheimer's disease study to CDISC SDTM (SDTMIG v3.2). Source CRF data are captured in EDC and delivered as raw datasets.\n\n## 2. Domains\n| Domain | Description | Source CRF |\n|---|---|---|\n| DM | Demographics | Demographics form |\n| AE | Adverse Events | Adverse Events form |\n| CM | Concomitant Medications | Con Med form |\n| EX | Exposure | Study Drug Administration form |\n| VS | Vital Signs | Vital Signs form |\n| LB | Laboratory Test Results | Central lab transfer |\n| MH | Medical History | Medical History form |\n| DS | Disposition | Disposition form |\n| QS | Questionnaires | ADAS-Cog, CIBIC+, MMSE, ADCS-ADL |\n| EG | ECG Test Results | ECG form |\n\n## 3. DM mapping\n| SDTM Variable | Label | Source | Derivation |\n|---|---|---|---|\n| STUDYID | Study Identifier | Protocol | Constant |\n| DOMAIN | Domain Abbreviation | | \"DM\" |\n| USUBJID | Unique Subject Identifier | STUDYID + SITEID + SUBJID | Concatenate with \"-\" |\n| SUBJID | Subject Identifier for the Study | Subject ID | Direct |\n| RFSTDTC | Subject Reference Start Date/Time | First dose date | Earliest EX.EXSTDTC |\n| RFENDTC | Subject Reference End Date/Time | Last dose date | Latest EX.EXENDTC |\n| SITEID | Study Site Identifier | Site number | Direct |\n| BRTHDTC | Date/Time of Birth | Date of birth | ISO 8601 |\n| AGE | Age | Age at screening | Direct or (RFSTDTC - BRTHDTC)/365.25 |\n| AGEU | Age Units | | \"YEARS\" |\n| SEX | Sex | Sex | M/F |\n| RACE | Race | Race | Controlled terminology |\n| ETHNIC | Ethnicity | Ethnicity | Controlled terminology |\n| ARM | Description of Planned Arm | Randomization | Map to \"Placebo\" or \"Xanomeline\" |\n| ARMCD | Planned Arm Code | Randomization | PBO / XAN |\n| COUNTRY | Country | Site country | ISO 3166 alpha-3 |\n\n## 4. AE mapping\n| SDTM Variable | Source | Derivation |\n|---|---|---|\n| AETERM | Reported adverse event term | Direct |\n| AEDECOD | | MedDRA preferred term |\n| AEBODSYS | | MedDRA system organ class |\n| AESTDTC | AE start date | ISO 8601 |\n| AEENDTC | AE end date | ISO 8601 |\n| AESEV | Severity | MILD / MODERATE / SEVERE |\n| AESER | Serious? | Y/N |\n| AEREL | Relationship to study drug | Direct |\n| AEOUT | Outcome | Controlled terminology |\n| AEACN | Action taken | Controlled terminology |\n\n## 5. QS mapping\nQSTESTCD and QSTEST per instrument (ADAS-Cog items, CIBIC+, MMSE). QSORRES from the CRF value, QSSTRESC and QSSTRESN standardized, VISIT and VISITNUM from the visit schedule.\n\n## 6. General conventions\n- All dates converted to ISO 8601.\n- Controlled terminology per current CDISC CT release.\n- --SEQ assigned sequentially within USUBJID.\n- Baseline flag derived as last non-missing value prior to first dose.\n- Define-XML 2.0 will be produced from this specification.",
    "what_went_wrong": [
      "It invented a CRF: Demographics, Con Med, Disposition and ECG forms, an ECG domain (EG) that this study never tabulated, and 'ADCS-ADL' where the study used DAD.",
      "It filled the gaps with textbook defaults: date of birth to BRTHDTC, two arms (PBO, XAN) where the study has Screen Failure, Placebo, Low and High dose, and a pre-dose baseline rule where define.xml uses a visit rule.",
      "It cited no CRF page, gave no controlled terms for the vital signs, and said nothing about visit numbers, units or time points.",
      "It reads as finished: ten domains and conventions, no open questions. Nothing tells the reviewer which rows are guesses.",
      "Some rows are right by habit (RFSTDTC and RFENDTC from exposure, MedDRA for AE terms, ISO 3166 country), which makes the wrong ones harder to spot."
    ]
  },
  "what_changed": [
    "Pasted the actual CRF text with page numbers instead of describing the trial in one line.",
    "Named the six columns wanted, including origin and CRF page, so each row can be checked against the form.",
    "Told the model to use annotation fragments only where legible and not to trust partial ones.",
    "Told the model to list unsettled items as numbered open questions tied to a page, not to guess codelists, visits or domains.",
    "Asked for anything added from general SDTM knowledge to be labelled as a suggestion."
  ],
  "check_before_trust": [
    "Open the annotated CRF and your own define file and compare every variable name and origin. The model read scrambled annotation text and can misread it.",
    "Check every codelist value (race, units, position, time point, test codes) against the CDISC controlled terminology release you are using. None was supplied here.",
    "Confirm that each 'suggestion' row is a domain your study actually builds. Here the SU suggestion for smoking and alcohol did not exist in the real define file.",
    "Do not accept a variable the form does not feed. Date of birth was flagged 'not entered in database' and the real DM has no BRTHDTC.",
    "Treat the open-questions list as the agenda for the data manager. In this run most real gaps (VISIT labels, USUBJID rule, VSPOS terms) were answered only in the define file.",
    "Run a few real records through your mapping code on dummy data before using the spec; this example did not execute anything."
  ],
  "verification": {
    "answer_key": "sdtm_define.xml (CDISC SDTM/ADaM Pilot Project, Define-XML for the SDTM datasets), read only after the cold answer was saved: DM, SC and VS ItemGroupDefs and ItemDefs, and the codelists SEX, RACE, ETHNIC, VSPOS, VSTPT, VSTPTNUM, VSUNIT, SCUNIT, SCCAT, ND, VISITNUM, VISIT, ARM, ARMCD, AEDICT, QSCAT. Order followed: the bad output was written first from the one-line input before any source was opened; the CRF text was then extracted; the good output is a cold run that saw only the excerpt and the prompt; the answer key was then opened. No independent second verifier was used, so the verdicts rest on one reading of define.xml.",
    "rows": [
      {
        "output": "good",
        "claim": "STUDYID is the literal CDISCPILOT01, taken from a legible annotation fragment; origin Assigned",
        "verdict": "partly correct",
        "cite": "define.xml DM.STUDYID: Origin 'CRF Page 7'. Value CDISCPILOT01 is correct; the origin label differs (Assigned vs CRF page 7)."
      },
      {
        "output": "good",
        "claim": "Open question 2: printed H2Q-MC-LZZT is the sponsor protocol number, so which is STUDYID",
        "verdict": "correct, real gap",
        "cite": "CRF p. 7 prints H2Q-MC-LZZT; define.xml uses CDISCPILOT01. The CRF alone does not say where the other value goes."
      },
      {
        "output": "good",
        "claim": "Patient initials are not mapped",
        "verdict": "correct",
        "cite": "No initials variable in any define.xml domain."
      },
      {
        "output": "good",
        "claim": "Visit date maps to SV.SVSTDTC (marked partial)",
        "verdict": "partly correct",
        "cite": "define.xml SV.SVSTDTC is Origin 'Derived' (earliest date data were collected for the visit), not a direct CRF field. DM.DMDTC, SC.SCDTC and VS.VSDTC take the CRF date."
      },
      {
        "output": "good",
        "claim": "AEDTC and CMDTC in the visit-date annotation list are not standard IG variables",
        "verdict": "correct",
        "cite": "define.xml has AE.AESTDTC and CM.CMSTDTC (CRF pp. 121-123, 124-126) and no AEDTC or CMDTC."
      },
      {
        "output": "good",
        "claim": "VISITNUM is Assigned, value 1",
        "verdict": "partly correct",
        "cite": "define.xml VISITNUM codelist: 1 = 'SCREENING 1'. Value correct; define lists VISITNUM origin as CRF pages."
      },
      {
        "output": "good",
        "claim": "Consent date: candidates DS.DSSTDTC or DM.RFICDTC",
        "verdict": "partly correct",
        "cite": "define.xml DM.RFICDTC is Origin 'Derived' with comment 'Date of informed consent was not entered in database'. DS.DSSTDTC comes from CRF pp. 106 and 139, not p. 7. So the date is not mapped from this page."
      },
      {
        "output": "good",
        "claim": "Date of birth maps to DM.BRTHDTC; AGE derived from it if DOB is in the database",
        "verdict": "wrong",
        "cite": "define.xml DM has no BRTHDTC. AGE is Derived 'at start of study drug (RFSTDTC)'. The hedge about 'Not Entered In Database' was right, the suggested variable was not used."
      },
      {
        "output": "good",
        "claim": "Sex maps to DM.SEX with codes F and M",
        "verdict": "correct",
        "cite": "define.xml SEX codelist: F, M, U. Origin CRF page 7."
      },
      {
        "output": "good",
        "claim": "Race maps to DM.RACE; Hispanic may belong in ETHNIC; the 2-letter CRF codes are not copied",
        "verdict": "correct",
        "cite": "define.xml DM.ETHNIC is Derived: 'HISPANIC OR LATINO' if Origin = Hispanic, otherwise 'NOT HISPANIC OR LATINO'. RACE codelist has four terms (WHITE, BLACK OR AFRICAN AMERICAN, AMERICAN INDIAN OR ALASKA NATIVE, ASIAN). The cold run proposed no term mapping, so it was not wrong, but it was not complete."
      },
      {
        "output": "good",
        "claim": "Years of education maps to SC.SCORRES, in years, SCTESTCD 'YEARSEDU' (from an annotation fragment)",
        "verdict": "partly correct",
        "cite": "define.xml: SC domain, SCORRES and SCORRESU Origin 'CRF Page 8', SCUNIT codelist = YEARS. But the SCTESTCD value is EDLEVEL (label 'EDUCATION LEVEL'), SCCAT = EDUCATION is Assigned, and the cold run did not mention SCCAT. The CRF annotation and define.xml disagree on the test code; not resolved here."
      },
      {
        "output": "good",
        "claim": "Smoking and alcohol items go to an SU domain (suggestion); Q7 asks SU, MH or SC",
        "verdict": "not in source",
        "cite": "define.xml has no SU domain and no smoking, alcohol or caffeine variables. These CRF items appear not to have been tabulated. The question was reasonable; the suggested domain did not exist in this study."
      },
      {
        "output": "good",
        "claim": "Weight to VS.VSORRES with VSTESTCD WEIGHT; height to VS.VSORRES with HEIGHT",
        "verdict": "correct",
        "cite": "define.xml VS.VSTESTCD value list: DIABP, HEIGHT, PULSE, SYSBP, TEMP, WEIGHT. VSORRES Origin CRF pages 16 onward."
      },
      {
        "output": "good",
        "claim": "VSORRESU uses the printed unit; suggestion to standardize to kg and cm; Q8 asks whether printed codes match controlled terms",
        "verdict": "partly correct",
        "cite": "define.xml VSUNIT codelist: kg, cm, LB, IN, mmHg, BEATS/MIN, C, F. The case differences (lb vs LB, in vs IN) justify Q8. VSSTRESU is 'Assigned ... defined per parameter'; define.xml does not state a conversion rule, so the kg and cm suggestion is not confirmed."
      },
      {
        "output": "good",
        "claim": "Heart rate maps to VSTESTCD PULSE and BP to SYSBP and DIABP, one entry giving two records",
        "verdict": "correct",
        "cite": "define.xml VS.VSTESTCD value list has PULSE, SYSBP and DIABP as separate tests. Units BEATS/MIN and mmHg are in VSUNIT."
      },
      {
        "output": "good",
        "claim": "Rows pair 815 with 5 minutes supine, 816 with 1 minute standing, 817 with 3 minutes standing",
        "verdict": "correct",
        "cite": "define.xml VSTPTNUM: 815 = AFTER LYING DOWN FOR 5 MINUTES, 816 = AFTER STANDING FOR 1 MINUTE, 817 = AFTER STANDING FOR 3 MINUTES. VSPOS terms are STANDING and SUPINE."
      },
      {
        "output": "good",
        "claim": "Open question 9: the VSPOS and VSTPT terms are not on the page",
        "verdict": "correct, real gap",
        "cite": "The exact VSTPT wording and the spelled-out VSPOS terms are only in define.xml (codelists VSPOS, VSTPT)."
      },
      {
        "output": "good",
        "claim": "'Information not obtained' boxes map to VSSTAT = NOT DONE",
        "verdict": "correct",
        "cite": "define.xml VS.VSSTAT, codelist ND = NOT DONE, Origin CRF pages."
      },
      {
        "output": "good",
        "claim": "VSDTC comes from the visit date",
        "verdict": "correct",
        "cite": "define.xml VS.VSDTC Origin CRF pages 16 onward; the p. 7 annotation lists VSDTC against the visit date."
      },
      {
        "output": "good",
        "claim": "Open question 11: whether VISITNUM = 1 applies to p. 8 and p. 16, and what VISIT is",
        "verdict": "correct, real gap",
        "cite": "define.xml VISITNUM 1 = SCREENING 1; VISIT value 'SCREENING 1'. Neither is printed on the pages."
      },
      {
        "output": "good",
        "claim": "Open question 3: SUBJID, SITEID and USUBJID derivations are not legible",
        "verdict": "correct, real gap",
        "cite": "define.xml: SUBJID Origin CRF Page 7; SITEID Assigned; USUBJID Derived, 'Concatenation of STUDYID, DM.SITEID and DM.SUBJID'. See the unresolved length note in errors_found."
      },
      {
        "output": "good",
        "claim": "Open question 4: two-digit years need a century rule",
        "verdict": "not in source",
        "cite": "Neither the CRF pages nor define.xml states a rule."
      },
      {
        "output": "bad",
        "claim": "Domain list DM, AE, CM, EX, VS, LB, MH, DS, QS, EG",
        "verdict": "partly correct",
        "cite": "define.xml has DM, AE, CM, EX, VS, LB, MH, DS, QS plus SC, SV, SE and trial design domains. EG does not exist; SC and SV are missing from the bad list."
      },
      {
        "output": "bad",
        "claim": "STUDYID is a protocol constant",
        "verdict": "partly correct",
        "cite": "define.xml: Origin 'CRF Page 7', value CDISCPILOT01."
      },
      {
        "output": "bad",
        "claim": "USUBJID = STUDYID + SITEID + SUBJID joined with '-'",
        "verdict": "partly correct",
        "cite": "define.xml comment: concatenation of STUDYID, SITEID and SUBJID. The separator is not stated."
      },
      {
        "output": "bad",
        "claim": "RFSTDTC and RFENDTC from the first and last exposure",
        "verdict": "correct",
        "cite": "define.xml DM.RFSTDTC and RFENDTC: derived from EX."
      },
      {
        "output": "bad",
        "claim": "BRTHDTC from date of birth; AGE from BRTHDTC",
        "verdict": "wrong",
        "cite": "define.xml DM has no BRTHDTC; AGE is derived at RFSTDTC."
      },
      {
        "output": "bad",
        "claim": "ARM and ARMCD map to Placebo or Xanomeline, PBO or XAN",
        "verdict": "wrong",
        "cite": "define.xml ARMCD: Scrnfail, Pbo, Xan_Lo, Xan_Hi; ARM: Screen Failure, Placebo, Xanomeline Low Dose, Xanomeline High Dose."
      },
      {
        "output": "bad",
        "claim": "COUNTRY from the site country, ISO 3166 alpha-3",
        "verdict": "correct",
        "cite": "define.xml DM.COUNTRY: Derived from site information; codelist USA."
      },
      {
        "output": "bad",
        "claim": "AEDECOD and AEBODSYS from MedDRA",
        "verdict": "correct",
        "cite": "define.xml AEDICT: MEDDRA version 8.0. The CRF p. 122 text mentions a COSTART class term, which the bad run could not have known."
      },
      {
        "output": "bad",
        "claim": "QS holds ADAS-Cog, CIBIC+, MMSE, ADCS-ADL",
        "verdict": "partly correct",
        "cite": "define.xml QSCAT includes Alzheimer's Disease Assessment Scale, CIBIC+, Mini-Mental State, DAD, NPI-X and Modified Hachinski. ADCS-ADL is not among them (the study used DAD)."
      },
      {
        "output": "bad",
        "claim": "Baseline flag is the last non-missing value before first dose",
        "verdict": "wrong",
        "cite": "define.xml VS.VSBLFL: 'If VISIT = BASELINE then VSBLFL = Y' (a visit rule, not a pre-dose rule)."
      },
      {
        "output": "bad",
        "claim": "No open questions; SC, SV, vital-sign terms and units are not addressed",
        "verdict": "not in source",
        "cite": "The bad output has no SC or SV domain, no controlled terms or units for VS, and no list of what it did not know. Nothing flags that the DOB and consent date are not in the database."
      }
    ],
    "errors_found": [
      "The cold run's SU suggestion (smoking, alcohol) does not exist in this study: define.xml has no SU domain. The cold run did flag the items as 'Not Entered In Database' and asked which domain to use, but still wrote a suggested SU mapping.",
      "The cold run suggested DM.BRTHDTC. define.xml has no BRTHDTC. It hedged, but a programmer copying the table would add a variable the study never built.",
      "Test code mismatch: the CRF annotation fragment reads YEARSEDU, define.xml uses EDLEVEL. The cold run followed the CRF text correctly; the discrepancy is between two CDISC files and is not resolved here.",
      "Most open questions (VSPOS terms, VSTPT wording, VISIT labels, SUBJID, SITEID, USUBJID) are real gaps in the three pages: the answer exists only in define.xml. This is the intended use of the open-questions section, but it means the cold run could not finish the VS and DM mapping from the pages alone.",
      "The cold run took 'Not Entered In Database' to mean not in the clinical database. define.xml supports this for DOB and consent date (RFICDTC comment) and there is no SU domain; it was not independently checked for every flagged item (initials, caffeine, alcohol).",
      "CONTAMINATION AND LIMITS: (1) The cold run was a general-purpose subagent told not to use tools; the tool list could not be removed, so no-tools rests on the instruction. The harness reported one tool use for that agent, which was not inspected. (2) The CRF text layer carries CDISC annotations, so the CRF is already partly annotated with SDTM names; the task was easier than mapping from a clean paper CRF. (3) The prompt allows SDTMIG knowledge, but no SDTMIG excerpt was pasted (the matrix expects the user to paste one), so the cold run used the model's own SDTMIG knowledge, whose version cannot be checked. (4) The builder had read the CRF pages (including annotations) before the cold run, but did not open define.xml until the cold answer was saved, and wrote the bad output before opening any source. (5) Three Visit 1 pages only: nothing here shows how derived domains (SV, SE) would be specified.",
      "Unresolved source inconsistency: define.xml says USUBJID is the concatenation of STUDYID, SITEID and SUBJID but gives USUBJID length 11 and STUDYID length 12, so a literal concatenation cannot fit. Not checked against the .xpt files.",
      "Not verified at all: the bad output's other variable lists (AE severity, AEREL, DS, LB, CM, EX) were not checked against define.xml."
    ],
    "summary": "The cold run made no wrong statement about what the three pages show and invented no codelist values. Of its 22 checked rows and questions, 13 were correct (including 4 real gaps whose answers are only in define.xml), 6 partly correct on origin or test code, 1 wrong (BRTHDTC) and 2 not in the source (the SU domain, the century rule). The SCTESTCD it read from the CRF (YEARSEDU) differs from define.xml (EDLEVEL). The bad output got the domain list roughly right by habit, but invented an EG domain, a two-arm design, an ADCS-ADL scale and a baseline rule, cited no pages and flagged nothing."
  },
  "run": {
    "generated_by": "Claude (Anthropic), run as a subagent on 2026-10-20",
    "not_tested_in": "Microsoft 365 Copilot"
  }
}