Skip to content

Commit 0bd6958

Browse files
committed
enh: add contrast_index
1 parent f1c4999 commit 0bd6958

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

assets/contrast_index.sql

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# table-description:
2+
# This table contains one row per DICOM series that has contrast agent information.
3+
# It captures contrast bolus metadata from CT, MR, PT, XA, and RF imaging modalities,
4+
# including the agent name, ingredient, and administration route. Only series with
5+
# at least one non-null contrast attribute are included. This table can be joined
6+
# with the main idc_index table using the SeriesInstanceUID column.
7+
8+
WITH contrast_data AS (
9+
SELECT
10+
SeriesInstanceUID,
11+
ARRAY_AGG(DISTINCT ContrastBolusAgent IGNORE NULLS) AS ContrastBolusAgent,
12+
ARRAY_AGG(DISTINCT ContrastBolusIngredient IGNORE NULLS) AS ContrastBolusIngredient,
13+
ARRAY_AGG(DISTINCT ContrastBolusRoute IGNORE NULLS) AS ContrastBolusRoute
14+
FROM `bigquery-public-data.idc_v23.dicom_all`
15+
WHERE Modality IN ('CT', 'MR', 'PT', 'XA', 'RF')
16+
GROUP BY SeriesInstanceUID
17+
)
18+
SELECT
19+
# description:
20+
# DICOM SeriesInstanceUID identifier of the imaging series
21+
SeriesInstanceUID,
22+
23+
# description:
24+
# distinct contrast agent names used in the series as defined in DICOM ContrastBolusAgent attribute
25+
ContrastBolusAgent,
26+
27+
# description:
28+
# distinct contrast agent ingredients used in the series as defined in DICOM ContrastBolusIngredient attribute
29+
ContrastBolusIngredient,
30+
31+
# description:
32+
# distinct contrast administration routes used in the series as defined in DICOM ContrastBolusRoute attribute
33+
ContrastBolusRoute
34+
35+
FROM contrast_data
36+
WHERE
37+
ARRAY_LENGTH(ContrastBolusAgent) > 0
38+
OR ARRAY_LENGTH(ContrastBolusIngredient) > 0
39+
OR ARRAY_LENGTH(ContrastBolusRoute) > 0

hatch_build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class IDCBuildHook(BuildHookInterface):
2424
"seg_index.parquet",
2525
"ann_index.parquet",
2626
"ann_group_index.parquet",
27+
"contrast_index.parquet",
2728
}
2829

2930
def _prune_excluded_parquet_files(self) -> None:

src/idc_index_data/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def _load_text(path: Path | None) -> str | None:
9191
"seg_index",
9292
"ann_index",
9393
"ann_group_index",
94+
"contrast_index",
9495
]
9596

9697
INDEX_METADATA: dict[str, dict[str, Path | dict[str, object] | str | None]] = {}

0 commit comments

Comments
 (0)