The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
Error code: DatasetGenerationCastError
Exception: DatasetGenerationCastError
Message: An error occurred while generating the dataset
All the data files must have the same columns, but at some point there are 2 new columns ({'IID', 'Image_Path'}) and 5 missing columns ({'Relation', 'Head_Name', 'Tail', 'Head', 'Tail_Name'}).
This happened while the csv dataset builder was generating data using
hf://datasets/xcwangpsu/MedMKG/image_mapping.csv (at revision c040874ff8b291c1c8b4fc44125a1af4987718ed)
Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1871, in _prepare_split_single
writer.write_table(table)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/arrow_writer.py", line 643, in write_table
pa_table = table_cast(pa_table, self._schema)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2293, in table_cast
return cast_table_to_schema(table, schema)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2241, in cast_table_to_schema
raise CastError(
datasets.table.CastError: Couldn't cast
IID: string
Image_Path: string
-- schema metadata --
pandas: '{"index_columns": [{"kind": "range", "name": null, "start": 0, "' + 489
to
{'Head': Value(dtype='string', id=None), 'Relation': Value(dtype='string', id=None), 'Tail': Value(dtype='string', id=None), 'Head_Name': Value(dtype='string', id=None), 'Tail_Name': Value(dtype='string', id=None)}
because column names don't match
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1433, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1050, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 925, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1001, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1742, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1873, in _prepare_split_single
raise DatasetGenerationCastError.from_cast_error(
datasets.exceptions.DatasetGenerationCastError: An error occurred while generating the dataset
All the data files must have the same columns, but at some point there are 2 new columns ({'IID', 'Image_Path'}) and 5 missing columns ({'Relation', 'Head_Name', 'Tail', 'Head', 'Tail_Name'}).
This happened while the csv dataset builder was generating data using
hf://datasets/xcwangpsu/MedMKG/image_mapping.csv (at revision c040874ff8b291c1c8b4fc44125a1af4987718ed)
Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
Head
string | Relation
string | Tail
string | Head_Name
string | Tail_Name
string |
|---|---|---|---|---|
C0000726
|
part_of
|
C0005423
|
Abdominal structure (body structure)
|
Biliary apparatus
|
C0000726
|
part_of
|
C0016976
|
Abdominal structure (body structure)
|
Gallenblase
|
C0000726
|
part_of
|
C0023884
|
Abdominal structure (body structure)
|
Gastrointestinal Tract, Liver
|
C0000726
|
part_of
|
C0030274
|
Abdominal structure (body structure)
|
Structure of pancreas
|
C0000726
|
part_of
|
C0037993
|
Abdominal structure (body structure)
|
Lien
|
C0000726
|
part_of
|
C0227613
|
Abdominal structure (body structure)
|
Right kidney structure
|
C0000726
|
part_of
|
C0227614
|
Abdominal structure (body structure)
|
Left kidney structure
|
C0000726
|
part_of
|
C0230168
|
Abdominal structure (body structure)
|
Space of abdominal compartment
|
C0000726
|
has_part
|
C0460005
|
Abdominal structure (body structure)
|
trunk [body]
|
C0000726
|
sib_in_part_of
|
C0333343
|
Abdominal structure (body structure)
|
Body cavity structure (body structure)
|
C0000726
|
entry_combination_of
|
C0034573
|
Abdominal structure (body structure)
|
x-ray of abdomen (procedure)
|
C0000726
|
related_part
|
C0024090
|
Abdominal structure (body structure)
|
Dorsum of abdomen
|
C0000726
|
related_part
|
C0230165
|
Abdominal structure (body structure)
|
Upper region of abdomen
|
C0000726
|
related_part
|
C0230166
|
Abdominal structure (body structure)
|
Lower region of abdomen
|
C0000726
|
related_part
|
C0230177
|
Abdominal structure (body structure)
|
Structure of right upper quadrant of abdomen (body structure)
|
C0000726
|
related_part
|
C0230179
|
Abdominal structure (body structure)
|
Structure of left upper quadrant of abdomen (body structure)
|
C0000726
|
regional_part_of
|
C0931963
|
Abdominal structure (body structure)
|
Abdominal front
|
C0000726
|
related_part
|
C0931963
|
Abdominal structure (body structure)
|
Abdominal front
|
C0000726
|
isa
|
C0030797
|
Abdominal structure (body structure)
|
Structure of pelvic region, unspecified
|
C0000726
|
isa
|
C0230166
|
Abdominal structure (body structure)
|
Lower region of abdomen
|
C0000726
|
isa
|
C0230168
|
Abdominal structure (body structure)
|
Space of abdominal compartment
|
C0000726
|
has_procedure_site
|
C0008320
|
Abdominal structure (body structure)
|
surgical removal of the gallbladder
|
C0000726
|
has_finding_site
|
C0019284
|
Abdominal structure (body structure)
|
diaphragmatic hernia (diagnosis)
|
C0000726
|
has_direct_procedure_site
|
C0023038
|
Abdominal structure (body structure)
|
laparotomy procedure
|
C0000726
|
has_direct_procedure_site
|
C0031150
|
Abdominal structure (body structure)
|
Laparoscopy (GI only)
|
C0000726
|
has_procedure_site
|
C0031150
|
Abdominal structure (body structure)
|
Laparoscopy (GI only)
|
C0000726
|
has_direct_procedure_site
|
C0034573
|
Abdominal structure (body structure)
|
x-ray of abdomen (procedure)
|
C0000726
|
has_procedure_site
|
C0034573
|
Abdominal structure (body structure)
|
x-ray of abdomen (procedure)
|
C0000726
|
has_procedure_site
|
C0198482
|
Abdominal structure (body structure)
|
abdominal surgery
|
C0000726
|
has_finding_site
|
C0235833
|
Abdominal structure (body structure)
|
DIH
|
C0000726
|
has_finding_site
|
C0267665
|
Abdominal structure (body structure)
|
intestinal hernia (diagnosis)
|
C0000726
|
has_finding_site
|
C0267725
|
Abdominal structure (body structure)
|
thoracic stomach (diagnosis)
|
C0000726
|
has_direct_procedure_site
|
C0341073
|
Abdominal structure (body structure)
|
Cholecystostomy, percutaneous, complete procedure, including imaging guidance, catheter placement, cholecystogram when performed, and radiological supervision and interpretation
|
C0000726
|
has_procedure_site
|
C0341073
|
Abdominal structure (body structure)
|
Cholecystostomy, percutaneous, complete procedure, including imaging guidance, catheter placement, cholecystogram when performed, and radiological supervision and interpretation
|
C0000726
|
has_direct_procedure_site
|
C0412620
|
Abdominal structure (body structure)
|
CT scan - abdominal
|
C0000726
|
has_procedure_site
|
C0412620
|
Abdominal structure (body structure)
|
CT scan - abdominal
|
C0000726
|
has_direct_procedure_site
|
C0412693
|
Abdominal structure (body structure)
|
abdominal MRI
|
C0000726
|
has_finding_site
|
C0740577
|
Abdominal structure (body structure)
|
pain; abdomen, acute abdomen
|
C0000726
|
has_direct_procedure_site
|
C2711454
|
Abdominal structure (body structure)
|
Imaging of abdomen (procedure)
|
C0000726
|
has_finding_site
|
C3489393
|
Abdominal structure (body structure)
|
hiatal hernia (diagnosis)
|
C0000726
|
isa
|
C0931963
|
Abdominal structure (body structure)
|
Abdominal front
|
C0003947
|
associated_with
|
C0003949
|
Asbestos (substance)
|
asbestosis (diagnosis)
|
C0003947
|
related_to
|
C0206062
|
Asbestos (substance)
|
Diffuse parenchymal lung disease
|
C0003947
|
mapped_from
|
C0003949
|
Asbestos (substance)
|
asbestosis (diagnosis)
|
C0003947
|
has_causative_agent
|
C0003949
|
Asbestos (substance)
|
asbestosis (diagnosis)
|
C0003948
|
associated_with
|
C0003949
|
Exposure to asbestos (event)
|
asbestosis (diagnosis)
|
C0003949
|
mapped_to
|
C0003947
|
asbestosis (diagnosis)
|
Asbestos (substance)
|
C0003949
|
associated_with
|
C0003947
|
asbestosis (diagnosis)
|
Asbestos (substance)
|
C0003949
|
location_of
|
C0024109
|
asbestosis (diagnosis)
|
Structure of lungs, unspecified
|
C0003949
|
associated_with
|
C0003948
|
asbestosis (diagnosis)
|
Exposure to asbestos (event)
|
C0003949
|
used_for
|
C0032273
|
asbestosis (diagnosis)
|
pneumoconiosis (diagnosis)
|
C0003949
|
inverse_isa
|
C0032273
|
asbestosis (diagnosis)
|
pneumoconiosis (diagnosis)
|
C0003949
|
is_associated_anatomic_site_of
|
C0024109
|
asbestosis (diagnosis)
|
Structure of lungs, unspecified
|
C0003949
|
is_associated_anatomic_site_of
|
C0230139
|
asbestosis (diagnosis)
|
Cavity of thorax
|
C0003949
|
causative_agent_of
|
C0003947
|
asbestosis (diagnosis)
|
Asbestos (substance)
|
C0003949
|
associated_morphology_of
|
C0021368
|
asbestosis (diagnosis)
|
INFLAMM
|
C0003949
|
finding_site_of
|
C0024109
|
asbestosis (diagnosis)
|
Structure of lungs, unspecified
|
C0003949
|
inverse_isa
|
C1285162
|
asbestosis (diagnosis)
|
degenerative disease
|
C0003956
|
part_of
|
C0549113
|
Ascending aorta structure (body structure)
|
Supra-aortic valve area
|
C0003956
|
branch_of
|
C1261316
|
Ascending aorta structure (body structure)
|
Right coronary artery structure (body structure)
|
C0003956
|
sib_in_branch_of
|
C0024496
|
Ascending aorta structure (body structure)
|
Main bronchus structure
|
C0003956
|
sib_in_branch_of
|
C0032718
|
Ascending aorta structure (body structure)
|
Portal vein structure (body structure)
|
C0003956
|
sib_in_branch_of
|
C0034052
|
Ascending aorta structure (body structure)
|
Pulmonary arterial subtree
|
C0003956
|
sib_in_branch_of
|
C0040578
|
Ascending aorta structure (body structure)
|
Trachea/Tracheal
|
C0003956
|
sib_in_branch_of
|
C1522460
|
Ascending aorta structure (body structure)
|
Aorta thoracica
|
C0003956
|
anteroinferior_to
|
C0225897
|
Ascending aorta structure (body structure)
|
Ventriculus cordis sinister
|
C0003956
|
continuous_with
|
C0225897
|
Ascending aorta structure (body structure)
|
Ventriculus cordis sinister
|
C0003956
|
direct_left_of
|
C0225897
|
Ascending aorta structure (body structure)
|
Ventriculus cordis sinister
|
C0003956
|
regional_part_of
|
C0549113
|
Ascending aorta structure (body structure)
|
Supra-aortic valve area
|
C0003956
|
isa
|
C0549113
|
Ascending aorta structure (body structure)
|
Supra-aortic valve area
|
C0003956
|
inverse_isa
|
C1522460
|
Ascending aorta structure (body structure)
|
Aorta thoracica
|
C0003956
|
has_finding_site
|
C0345049
|
Ascending aorta structure (body structure)
|
Dilation of the ascending aorta
|
C0003962
|
co-occurs_with
|
C0014867
|
ascites was discovered
|
esophageal varice
|
C0003962
|
ssc
|
C0015967
|
ascites was discovered
|
rndx hyperthermia
|
C0003962
|
clinically_associated_with
|
C0018418
|
ascites was discovered
|
Gynecomastia (disorder)
|
C0003962
|
clinically_associated_with
|
C0018802
|
ascites was discovered
|
congestive heart failure (diagnosis)
|
C0003962
|
clinically_associated_with
|
C0019209
|
ascites was discovered
|
hepatomegaly (physical finding)
|
C0003962
|
ssc
|
C0019209
|
ascites was discovered
|
hepatomegaly (physical finding)
|
C0003962
|
clinically_associated_with
|
C0022346
|
ascites was discovered
|
Jaundice (disorder)
|
C0003962
|
ssc
|
C0022346
|
ascites was discovered
|
Jaundice (disorder)
|
C0003962
|
clinically_associated_with
|
C0022661
|
ascites was discovered
|
End stage renal failure (disorder)
|
C0003962
|
clinically_associated_with
|
C0023890
|
ascites was discovered
|
hepatic cirrhosis (diagnosis)
|
C0003962
|
co-occurs_with
|
C0023890
|
ascites was discovered
|
hepatic cirrhosis (diagnosis)
|
C0003962
|
ssc
|
C0023890
|
ascites was discovered
|
hepatic cirrhosis (diagnosis)
|
C0003962
|
clinically_associated_with
|
C0029408
|
ascites was discovered
|
Osteoarthritis (M15-M19)
|
C0003962
|
clinically_associated_with
|
C0032227
|
ascites was discovered
|
pleural effusion (diagnosis)
|
C0003962
|
clinically_associated_with
|
C0039070
|
ascites was discovered
|
[D]: [fainting] or [collapse] (disorder)
|
C0003962
|
clinically_associated_with
|
C0278061
|
ascites was discovered
|
Altered mental status (finding)
|
C0003962
|
ssc
|
C0347944
|
ascites was discovered
|
mass of pelvic region
|
C0003962
|
location_of
|
C1704247
|
ascites was discovered
|
Peritoneal cavity structure (body structure)
|
C0003962
|
associated_finding_of
|
C1457887
|
ascites was discovered
|
Symptom (administrative concept)
|
C0003962
|
finding_site_of
|
C1704247
|
ascites was discovered
|
Peritoneal cavity structure (body structure)
|
C0003962
|
disease_may_have_finding
|
C2239176
|
ascites was discovered
|
liver cell cancer
|
C0004030
|
clinically_associated_with
|
C0041296
|
aspergillose
|
Tuberculosis (A15-A19)
|
C0004030
|
associated_with
|
C0004034
|
aspergillose
|
aspergillus fungus
|
C0004030
|
isa
|
C0004031
|
aspergillose
|
allergic lung reaction to the fungus aspergillus
|
C0004030
|
isa
|
C0276651
|
aspergillose
|
aspergilloma (diagnosis)
|
C0004030
|
inverse_isa
|
C0026946
|
aspergillose
|
Mycotic disease
|
C0004030
|
mapped_to
|
C0276651
|
aspergillose
|
aspergilloma (diagnosis)
|
C0004030
|
classifies
|
C0026946
|
aspergillose
|
Mycotic disease
|
MedMKG: Medical Multimodal Knowledge Graph
We introduce MedMKG, a Medical Multimodal Knowledge Graph that seamlessly fuses clinical concepts with medical images.
MedMKG is constructed via a multi-stage pipeline that accurately identifies and disambiguates medical concepts while extracting their interrelations.
To ensure the conciseness of the resulting graph, we further employ a pruning strategy based on our novel Neighbor-aware Filtering (NaF) algorithm.
π Provided Files
This repository contains:
knowledge_graph.csvβ biomedical triplets: Head, Relation, Tail, Head_Name, Tail_Nameimage_mapping.csvβ image ID to relative path mappings
Note: The images themselves are not included. Users must download MIMIC-CXR-JPG separately and specify their local path.
π¦ About MIMIC-CXR-JPG
MIMIC-CXR-JPG is a large publicly available dataset of chest radiographs in JPEG format, sourced from the Beth Israel Deaconess Medical Center in Boston.
- URL: https://physionet.org/content/mimic-cxr-jpg/2.1.0/
- Total uncompressed size: 570.3 GB
Access Instructions
To use the image data, you must request access and agree to the data use agreement, which includes:
- You will not share the data.
- You will not attempt to reidentify individuals.
- Any publication using the data will make the relevant code available.
Download options:
Google BigQuery access
Google Cloud Storage Browser access
Command-line download:
wget -r -N -c -np --user your_username --ask-password https://physionet.org/files/mimic-cxr-jpg/2.1.0/
π§ Usage Example
Below is a demo script to load and link the knowledge graph with your local image data:
from huggingface_hub import hf_hub_download
import pandas as pd
kg_path = hf_hub_download(repo_id="xcwangpsu/MedMKG", filename="MedMKG.csv", repo_type="dataset")
mapping_path = hf_hub_download(repo_id="xcwangpsu/MedMKG", filename="image_mapping.csv", repo_type="dataset")
# Load CSVs
kg_df = pd.read_csv(kg_path)
mapping_df = pd.read_csv(mapping_path)
# Local path to downloaded MIMIC-CXR images
local_root = "/path/to/your/mimic-cxr-jpg"
# Map image IDs to full paths
iid_to_path = {
row["IID"]: f"{local_root}/{row['Image_Path']}"
for _, row in mapping_df.iterrows()
}
# Merge image path info into KG
kg_df["Head_Path"] = kg_df["Head"].map(iid_to_path)
kg_df["Tail_Path"] = kg_df["Tail"].map(iid_to_path)
print(kg_df.head())
- Downloads last month
- 22