Skip to main content

Dataset-XML to BFF

Mapping status

Dataset-XML v1.0 with Define-XML v2.x support was added for v0.34. The fixtures cover the parser and documented mappings, but not every study or XML generator.

Dataset-XML is first resolved against Define-XML, then passed to the same SDTM semantic mapper used by Dataset-JSON. It creates one BFF individuals record per DM.USUBJID and can synthesize datasets and cohorts.

Transport Resolution​

Dataset-XML / Define-XML sourceNormalized contentBehavior
ClinicalData or ReferenceData StudyOID and MetaDataVersionOIDstudy metadata selectorMust resolve to exactly one Define-XML metadata version
ItemGroupData.ItemGroupOIDSDTM domainMust resolve to one Define-XML ItemGroupDef; one group is accepted per file
ordered ItemGroupDef.ItemRefdomain columnsSupplies column identity and order
referenced ItemDef.NameSDTM variable nameUsed as the normalized row key
referenced ItemDef.DataTypescalar typeInteger, decimal, float, double, and boolean values are coerced; other supported values remain strings
ItemDef.CodeListRef and decoded textsource terminology metadataSupplies the source display for controlled values
Alias Context="nci:ExtCodeID"NCIT identifierResolved by exact identifier lookup to obtain the canonical NCIT display
ItemGroupDataSeqsource row numberMust be present and unique within the file
ItemData.ItemOID and Valuerow valueUnknown or duplicate item identifiers fail; omitted ItemData means missing

Demographics​

After Define-XML resolves the variable names, the following mappings apply. Targets are relative to one BFF individual. Dataset-JSON uses the same mapper.

SDTM sourceBFF targetNotes
DM.USUBJIDidRequired; one DM row per participant
DM.SEXsexMale, female and other use NCIT terms; missing or unrecognized values use unknown
DM.ETHNICethnicityUses terminology resolution described below
DM.COUNTRYgeographicOriginWithout a resolved term, two- or three-letter values receive an ISO3166-1: prefix; other values use a source-derived term
DM.BRTHDTCinfo.phenopacket.dateOfBirthFull dates become midnight UTC; supported timestamps are retained
DM.DTHFL=Y or a supplied DM.DTHDTCinfo.phenopacket.vitalStatus.statusSets DECEASED
DM.DTHDTCinfo.phenopacket.vitalStatus.timeOfDeath.timestampIncluded when the date or timestamp is supported

Diseases And Phenotypic Features​

SDTM sourceBFF targetNotes
MH.MHDECOD, fallback MH.MHTERMdiseases[].diseaseCodeReported MHTERM is preferred for the source label
AE.AEDECOD, fallback AE.AETERMphenotypicFeatures[].featureTypeReported AETERM is preferred for the source label; excluded is false
AE.AESEVphenotypicFeatures[].severityIncluded when supplied
AE.AESTDTCphenotypicFeatures[].onset.timestampSupported date or timestamp
AE.AEENDTCphenotypicFeatures[].resolution.timestampSupported date or timestamp

Measurements​

Each usable laboratory or vital-sign row becomes a measure.

SDTM sourceBFF targetNotes
LB.LBTESTCD, fallback LB.LBTESTmeasures[].assayCodeLBTEST supplies the preferred source label
VS.VSTESTCD, fallback VS.VSTESTmeasures[].assayCodeVSTEST supplies the preferred source label
LB.LBSTRESN or VS.VSSTRESNmeasures[].measurementValue.quantity.valueUsed when numeric
LB.LBSTRESU or VS.VSSTRESUmeasures[].measurementValue.quantity.unitMissing units default to NCIT:C126101 / Not Available
LB.LBSTNRLO/LBSTNRHI or VS.VSSTNRLO/VSSTNRHImeasures[].measurementValue.quantity.referenceRangeBoth bounds must be numeric; uses the measurement unit
LB.LBSTRESC or VS.VSSTRESCmeasures[].measurementValueCategorical term when no numeric result is available; rows without either result are skipped
LB.LBDTC or VS.VSDTCmeasures[].dateDate component only

Treatments And Procedures​

SDTM sourceBFF targetNotes
CM.CMDECOD, fallback CM.CMTRTtreatments[].treatmentCodeCMTRT supplies the preferred source label
EX.EXTRTtreatments[].treatmentCodeExposure treatment
CM.CMROUTE or EX.EXROUTEtreatments[].routeOfAdministrationIncluded when supplied
PR.PRDECOD, fallback PR.PRTRTinterventionsOrProcedures[].procedureCodePRTRT supplies the preferred source label
PR.PRLOCinterventionsOrProcedures[].bodySiteIncluded when supplied
PR.PRSTDTCinterventionsOrProcedures[].dateOfProcedureDate component only

Other fields, including treatment doses and medical-history dates, remain in source provenance rather than being mapped to dedicated BFF fields.

Study Metadata​

These defaults are used when dataset or cohort output is requested.

SourceBFF targetNotes
XML StudyOIDDataset id; cohort idCohort identifier adds -cohort
TS.TSVAL where TS.TSPARMCD=TITLEDataset and cohort nameFalls back to StudyOID
StudyOIDDataset descriptionGenerated description identifying the Dataset-XML study
Built-in valueCohort cohortTypestudy-defined
XML metadata and subject-independent domainsDataset info.datasetXmlOmitted with --no-source-info

Terminology And Provenance​

Mapped rows are retained under info.datasetXml.domains. Transport metadata includes datasetXMLVersion, defineXMLVersion, studyOID, metaDataVersionOID, and the Define reference when supplied. Unmapped subject domains are named in info.datasetXml.unmappedDomains.

Supported NCI identifiers from Define-XML take precedence over mapping-file queries and are always looked up exactly. An optional Mapping V2 file with source.profile: sdtm can supply direct terms or reviewed label queries for other term-bearing fields. When neither source metadata nor the mapping resolves a term, source-derived CDISC: identifiers preserve SDTM field/value identity without claiming an ontology crosswalk.

Use --term-audit to distinguish Define-XML identifiers, direct mapping terms, database matches, and source fallbacks. Use --no-source-info to omit the raw rows. See Terminology Search for the complete resolution contract.

Paired baseline and terminology references show that these outcomes are separate, tested code paths.

See the Dataset-XML guide for commands, required files, and memory behavior.