mlogan914/sdtm-blueprint-as-a-service
Define SQL Scaffolding Mapping Logic Using Matched Results (CSV)
Open
#42 opened on Jun 29, 2025
documentationgood first issue
Repository metrics
- Stars
- (1 star)
- PR merge metrics
- (Avg merge 6m) (7 merged PRs in 30d)
Description
🧠 Brainstorm: Scaffolding Mapping Rules Using Matched Results
| Layer | What We're Doing | Why It's Simple & Reliable |
|---|---|---|
| Variable Matching | Using the ItemOID (e.g., IT.DM.AGE → AGE) to match against SDTMIG metadata | Stable, structured, and under your control; avoids ambiguity in alias Name values |
| Alias Usage | Using elements only to define scaffolding logic or derivation intent | Flexible and non-invasive — doesn’t interfere with mapping; adds meaning/context |
| Mapping Rules | Inferring mapping type (Direct, Derived, SUPPQUAL, Unmatched) from presence and context of aliases | Cleanly separates system-controlled mapping from user-controlled transformation logic |
Updated Rules
| Rule | Purpose | Implementation Notes |
|---|---|---|
| 1:1 Mapping (no alias) | Direct column mapping | Mapping_Type = "Direct" — safe to scaffold as col AS SDTM_VAR |
| DERIVATION_RULE alias | Indicates a custom derivation | Mapping_Type = "Derived" — insert a -- TODO or call to derivation macro |
| SUPPQUAL alias present | Maps to supplemental qualifier | Mapping_Type = "SUPPQUAL" — scaffold QNAM/QVAL/IDVAR/IDVARVAL/QLABEL block |
| No match found | Could not determine mapping | Mapping_Type = "Unmatched" — needs manual intervention |
Recommended Minimal Conventions for SUPPQUAL ODM Aliases
| Context | Name | Use For |
|---|---|---|
SUPPQUAL.SUPPDM.QNAM |
RACEOTH |
Value of QNAM |
SUPPQUAL.SUPPDM.QVAL |
raceoth |
ODM variable to read from |
SUPPQUAL.SUPPDM.IDVAR |
AESEQ |
IDVAR field name |
SUPPQUAL.SUPPDM.IDVARVAL |
DERIVED |
Trigger to compute it |
SUPPQUAL.SUPPDM.QLABEL |
Other Text |
Label for Define-XML |
Optional Extension
We can allow an additional alias to define the derivation macro name, e.g.:
<Alias Context="SUPPQUAL.SUPPDM.DERIVATION_MACRO" Name="derive_idvarval_ae()" />
So we can scaffold:
{{ derive_idvarval_ae(...) }} AS IDVARVAL