Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
"efficacy": "efficacy",
"safety": "safety",
"source": "source",
"dedicated_to_women_or_children": "OPTIONSET:crc8b_dedicatedtowomenorchildren",
},
"dim_developer": {
"_source_table": "vin_candidates",
Expand Down
20 changes: 20 additions & 0 deletions tests/e2e/test_silver_to_gold_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,26 @@ def test_dim_disease_has_expected_columns(self, gold_conn):
missing = expected - cols
assert not missing, f"Missing columns: {missing}"

# -- dim_priority --

def test_dim_priority_dedicated_to_women_or_children_is_label(self, gold_conn):
"""`dedicated_to_women_or_children` holds the Two-Options label
("Yes"/"No"), not the raw integer code (0/1). Numeric-only values
would indicate the OPTIONSET resolver was bypassed."""
df = _read_table(gold_conn, "dim_priority")
assert "dedicated_to_women_or_children" in df.columns, (
"dim_priority missing dedicated_to_women_or_children column"
)
non_null = df["dedicated_to_women_or_children"].dropna()
if non_null.empty:
pytest.skip(
"No non-null dedicated_to_women_or_children rows in current data"
)
# The label set is closed: Two-Options always resolves to {Yes, No}.
assert set(non_null.astype(str).unique()) <= {"Yes", "No"}, (
f"Unexpected labels: {set(non_null.astype(str).unique())}"
)

# -- dim_geography --

def test_dim_geography_has_iso_code(self, gold_conn):
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/test_silver_to_gold.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,19 @@ def test_test_format_uses_optionset_resolution(self) -> None:
STAR_SCHEMA_MAP["dim_candidate_core"]["test_format"]
== "OPTIONSET:testformat"
)

def test_dedicated_to_women_or_children_uses_optionset_resolution(
self,
) -> None:
"""`dim_priority.dedicated_to_women_or_children` resolves the
Two-Options code (0/1) to its label (No/Yes) via the OPTIONSET
cache, so the dashboard reads readable strings instead of raw
Dataverse codes — same pattern as `test_format`."""
from igh_data_transform.transformations.silver_to_gold.config.schema_map import ( # noqa: E501
STAR_SCHEMA_MAP,
)

assert (
STAR_SCHEMA_MAP["dim_priority"]["dedicated_to_women_or_children"]
== "OPTIONSET:crc8b_dedicatedtowomenorchildren"
)