-- DBMS: snowflake
create or replace TABLE DICOM_PIVOT (
	"PatientID" VARCHAR(16777216),
	"BodyPartExamined" VARCHAR(16777216),
	"SeriesInstanceUID" VARCHAR(16777216),
	"SliceThickness" FLOAT,
	"SeriesNumber" VARCHAR(16777216),
	"SeriesDescription" VARCHAR(16777216),
	"StudyInstanceUID" VARCHAR(16777216),
	"StudyDescription" VARCHAR(16777216),
	"StudyDate" DATE,
	"SOPInstanceUID" VARCHAR(16777216),
	"Modality" VARCHAR(16777216),
	"SOPClassUID" VARCHAR(16777216),
	"collection_id" VARCHAR(16777216),
	"AnatomicRegionSequence" VARCHAR(16777216),
	"FrameOfReferenceUID" VARCHAR(16777216),
	"crdc_study_uuid" VARCHAR(16777216),
	"crdc_series_uuid" VARCHAR(16777216),
	"crdc_instance_uuid" VARCHAR(16777216),
	"Program" VARCHAR(16777216),
	"tcia_tumorLocation" VARCHAR(16777216),
	"source_DOI" VARCHAR(16777216),
	"tcia_species" VARCHAR(16777216),
	"license_short_name" VARCHAR(16777216),
	"Manufacturer" VARCHAR(16777216),
	"ManufacturerModelName" VARCHAR(16777216),
	"instance_size" NUMBER(38,0),
	"analysis_results_id" VARCHAR(16777216),
	"SamplesPerPixel" NUMBER(38,0),
	"CancerType" VARCHAR(16777216),
	"Apparent_Diffusion_Coefficient" NUMBER(38,9),
	"Internal_structure" VARCHAR(16777216),
	"Sphericity" VARCHAR(16777216),
	"Calcification" VARCHAR(16777216),
	"Lobular_Pattern" VARCHAR(16777216),
	"Spiculation" VARCHAR(16777216),
	"Margin" VARCHAR(16777216),
	"Texture" VARCHAR(16777216),
	"Subtlety_score" VARCHAR(16777216),
	"Malignancy" VARCHAR(16777216),
	"Volume" NUMBER(38,9),
	"Diameter" NUMBER(38,9),
	"Surface_area_of_mesh" NUMBER(38,9),
	"Sphericity_quant" NUMBER(38,9),
	"Volume_of_Mesh" NUMBER(38,9),
	"illuminationType" VARCHAR(16777216),
	"primaryAnatomicStructure" VARCHAR(16777216),
	"ObjectiveLensPower" NUMBER(38,0),
	"min_PixelSpacing" FLOAT,
	"max_TotalPixelMatrixColumns" NUMBER(38,0),
	"max_TotalPixelMatrixRows" NUMBER(38,0),
	"SegmentedPropertyCategoryCodeSequence" VARCHAR(16777216),
	"SegmentedPropertyTypeCodeSequence" VARCHAR(16777216),
	"SegmentNumber" NUMBER(38,0),
	"SegmentAlgorithmType" VARCHAR(16777216),
	"AdditionalPatientHistory" VARCHAR(16777216),
	"Allergies" VARCHAR(16777216),
	"ImageType" VARCHAR(16777216),
	"LastMenstrualDate" DATE,
	"MedicalAlerts" VARCHAR(16777216),
	"EthnicGroup" VARCHAR(16777216),
	"Occupation" VARCHAR(16777216),
	"PatientAge" VARCHAR(16777216),
	"PatientSex" VARCHAR(16777216),
	"PatientComments" VARCHAR(16777216),
	"PatientSize" VARCHAR(16777216),
	"PatientWeight" VARCHAR(16777216),
	"PregnancyStatus" NUMBER(38,0),
	"ReasonForStudy" VARCHAR(16777216),
	"RequestedProcedureComments" VARCHAR(16777216),
	"SmokingStatus" VARCHAR(16777216),
	"SeriesDate" DATE,
	"access" VARCHAR(16777216),
	"gcs_url" VARCHAR(16777216),
	"aws_url" VARCHAR(16777216),
	"gcs_bucket" VARCHAR(16777216),
	"aws_bucket" VARCHAR(16777216)
);

INSERT INTO "IDC"."IDC_V17"."DICOM_PIVOT" (StudyDescription, Program, BodyPartExamined, Manufacturer, Occupation, Modality, source_DOI, PatientWeight, crdc_instance_uuid, max_TotalPixelMatrixRows, RequestedProcedureComments, PatientAge, min_PixelSpacing, SmokingStatus, tcia_species, gcs_bucket, Surface_area_of_mesh, instance_size, license_short_name, Malignancy, illuminationType, aws_url, Diameter, SeriesDescription, SOPInstanceUID, SegmentedPropertyTypeCodeSequence, Margin, gcs_url, collection_id, Internal_structure, SeriesNumber, EthnicGroup, AdditionalPatientHistory, Sphericity, crdc_study_uuid, FrameOfReferenceUID, MedicalAlerts, SliceThickness, SeriesInstanceUID, SeriesDate, PregnancyStatus, Apparent_Diffusion_Coefficient, SegmentedPropertyCategoryCodeSequence, access, Calcification, Sphericity_quant, PatientSex, StudyInstanceUID, aws_bucket, PatientSize, CancerType, crdc_series_uuid, ManufacturerModelName, Subtlety_score, tcia_tumorLocation, SegmentAlgorithmType, ImageType, Volume, Volume_of_Mesh, analysis_results_id, Allergies, PatientID, StudyDate, SegmentNumber, Lobular_Pattern, PatientComments, LastMenstrualDate, Spiculation, SamplesPerPixel, primaryAnatomicStructure, Texture, AnatomicRegionSequence, max_TotalPixelMatrixColumns, ObjectiveLensPower, SOPClassUID, ReasonForStudy) VALUES ('MR HEAD W AND WO IV CONTRAST TUMOR NEW', 'Community', 'HEADNECK', 'SIEMENS', NULL, 'MR', '10.7937/TCIA.709X-DN49', '94.8008173893', '98d5d298-1116-4671-b17a-5cf46018606c', 128, NULL, '076Y', 1.7, 'UNKNOWN', 'Human', 'public-datasets-idc', NULL, 36948, 'CC BY 4.0', NULL, NULL, 's3://idc-open-data/7a1027f4-b835-4a2f-962e-6993fda9dc87/98d5d298-1116-4671-b17a-5cf46018606c.dcm', NULL, 'ep2d_perf BOLUS_TERA', '1.3.6.1.4.1.14519.5.2.1.201644798538859159720916103279874451632', NULL, NULL, 'gs://public-datasets-idc/7a1027f4-b835-4a2f-962e-6993fda9dc87/98d5d298-1116-4671-b17a-5cf46018606c.dcm', 'upenn_gbm', NULL, '14', 'Non-Hispanic Non', NULL, NULL, '254422c4-1f0c-4840-b56f-6e5f75dde6aa', NULL, '', 5.0, '1.3.6.1.4.1.14519.5.2.1.185195136958159502142654387221547856729', '2011-09-03', 4, NULL, NULL, 'Public', NULL, NULL, 'M', '1.3.6.1.4.1.14519.5.2.1.92084504364921012205012538829705733768', 'idc-open-data', '1.7018034058333', 'Glioblastoma', '7a1027f4-b835-4a2f-962e-6993fda9dc87', 'TrioTim', NULL, 'Brain', NULL, 'ORIGINAL, PRIMARY, PERFUSION, NONE, ND, NORM', NULL, NULL, NULL, '', 'UPENN-GBM-00513', '2011-09-03', NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, 128, NULL, '1.2.840.10008.5.1.4.1.1.4', NULL), ('MR HEAD W AND WO IV CONTRAST TUMOR NEW', 'Community', 'HEADNECK', 'SIEMENS', NULL, 'MR', '10.7937/TCIA.709X-DN49', '72.1211960043', '7f843bd1-7d9f-44d8-8a4f-5b37b5afbcd6', 128, NULL, '032Y', 1.7, 'UNKNOWN', 'Human', 'public-datasets-idc', NULL, 36970, 'CC BY 4.0', NULL, NULL, 's3://idc-open-data/bcb1d33e-fec6-4905-a1e1-65f9a274d763/7f843bd1-7d9f-44d8-8a4f-5b37b5afbcd6.dcm', NULL, 'ep2d_perf BOLUS_TERA', '1.3.6.1.4.1.14519.5.2.1.284648789561114483507224549503882513471', NULL, NULL, 'gs://public-datasets-idc/bcb1d33e-fec6-4905-a1e1-65f9a274d763/7f843bd1-7d9f-44d8-8a4f-5b37b5afbcd6.dcm', 'upenn_gbm', NULL, '13', 'Non-Hispanic Non', NULL, NULL, '41758ed0-b78b-4159-91c6-1eb17d192a8f', NULL, '', 4.0, '1.3.6.1.4.1.14519.5.2.1.285201929497843344185967283825964169195', '2012-01-03', 4, NULL, NULL, 'Public', NULL, NULL, 'M', '1.3.6.1.4.1.14519.5.2.1.285969882316463253344322862464631605069', 'idc-open-data', '1.8034036091667', 'Glioblastoma', 'bcb1d33e-fec6-4905-a1e1-65f9a274d763', 'syngo.via.VB10A', NULL, 'Brain', NULL, 'ORIGINAL, PRIMARY, PERFUSION, NONE, ND, NORM', NULL, NULL, NULL, '', 'UPENN-GBM-00519', '2012-01-03', NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, 128, NULL, '1.2.840.10008.5.1.4.1.1.4', NULL), ('BrainTumor', 'Community', 'HEADNECK', 'SIEMENS', NULL, 'MR', '10.7937/TCIA.709X-DN49', '54.8846837517', '8536746e-bc18-414f-8e97-958f03849cec', 128, NULL, '037Y', 1.7, 'UNKNOWN', 'Human', 'public-datasets-idc', NULL, 36916, 'CC BY 4.0', NULL, NULL, 's3://idc-open-data/87a63ccb-6b76-4376-b6ca-5b148d1d5c36/8536746e-bc18-414f-8e97-958f03849cec.dcm', NULL, 'ep2d_perf BOLUS_TERA', '1.3.6.1.4.1.14519.5.2.1.64715764737679289365432093996341540549', NULL, NULL, 'gs://public-datasets-idc/87a63ccb-6b76-4376-b6ca-5b148d1d5c36/8536746e-bc18-414f-8e97-958f03849cec.dcm', 'upenn_gbm', NULL, '13', 'Non-Hispanic Non', NULL, NULL, 'fb35f503-02f2-4937-a3fa-4b6b6951a96e', NULL, '', 4.0, '1.3.6.1.4.1.14519.5.2.1.75622442647298518363100372261560810525', '2011-08-01', 4, NULL, NULL, 'Public', NULL, NULL, 'F', '1.3.6.1.4.1.14519.5.2.1.16570277643982576751137554563747012374', 'idc-open-data', NULL, 'Glioblastoma', '87a63ccb-6b76-4376-b6ca-5b148d1d5c36', 'TrioTim', NULL, 'Brain', NULL, 'ORIGINAL, PRIMARY, PERFUSION, NONE, ND, NORM', NULL, NULL, NULL, '', 'UPENN-GBM-00416', '2011-08-01', NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, 128, NULL, '1.2.840.10008.5.1.4.1.1.4', NULL), ('BrainTumor', 'Community', 'HEADNECK', 'SIEMENS', NULL, 'MR', '10.7937/TCIA.709X-DN49', '81.646636986', '7a191a3d-9918-4613-95ce-547e709d4b5f', 128, NULL, '020Y', 1.7, 'UNKNOWN', 'Human', 'public-datasets-idc', NULL, 37022, 'CC BY 4.0', NULL, NULL, 's3://idc-open-data/68ff9309-81e1-4490-8b3a-877bd10ce0ab/7a191a3d-9918-4613-95ce-547e709d4b5f.dcm', NULL, 'ep2d_perf BOLUS_TERA', '1.3.6.1.4.1.14519.5.2.1.114859382544420303794672772499243450451', NULL, NULL, 'gs://public-datasets-idc/68ff9309-81e1-4490-8b3a-877bd10ce0ab/7a191a3d-9918-4613-95ce-547e709d4b5f.dcm', 'upenn_gbm', NULL, '13', 'Non-Hispanic Non', NULL, NULL, '9e4915ca-39a7-4cdc-b711-6943ac2797d5', NULL, '', 3.5, '1.3.6.1.4.1.14519.5.2.1.135489908748676184571973467902447917371', '2011-10-21', 4, NULL, NULL, 'Public', NULL, NULL, 'F', '1.3.6.1.4.1.14519.5.2.1.152520037553718269187855913202992933964', 'idc-open-data', '1.5748031516667', 'Glioblastoma', '68ff9309-81e1-4490-8b3a-877bd10ce0ab', 'TrioTim', NULL, 'Brain', NULL, 'ORIGINAL, PRIMARY, PERFUSION, NONE, ND, NORM', NULL, NULL, NULL, '', 'UPENN-GBM-00473', '2011-10-21', NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, 128, NULL, '1.2.840.10008.5.1.4.1.1.4', NULL), ('BrainTumor', 'Community', 'HEADNECK', 'SIEMENS', NULL, 'MR', '10.7937/TCIA.709X-DN49', '102.9654810879', 'f55c7665-ada0-44d9-9807-d59d05abe880', 128, NULL, '038Y', 1.7, 'UNKNOWN', 'Human', 'public-datasets-idc', NULL, 36962, 'CC BY 4.0', NULL, NULL, 's3://idc-open-data/37beb078-f534-43bb-bb52-c7d1f830b7fd/f55c7665-ada0-44d9-9807-d59d05abe880.dcm', NULL, 'ep2d_perf BOLUS_TERA', '1.3.6.1.4.1.14519.5.2.1.308657597317534610205545200298236188919', NULL, NULL, 'gs://public-datasets-idc/37beb078-f534-43bb-bb52-c7d1f830b7fd/f55c7665-ada0-44d9-9807-d59d05abe880.dcm', 'upenn_gbm', NULL, '13', 'Non-Hispanic Non', NULL, NULL, '72645c1e-3a0f-4cc7-a307-2115f4c580b2', NULL, '', 3.0, '1.3.6.1.4.1.14519.5.2.1.152910459779232363967902946401636166563', '2011-11-26', 4, NULL, NULL, 'Public', NULL, NULL, 'M', '1.3.6.1.4.1.14519.5.2.1.304279265306776379494650249168307485581', 'idc-open-data', '1.8796037616667', 'Glioblastoma', '37beb078-f534-43bb-bb52-c7d1f830b7fd', 'TrioTim', NULL, 'Brain', NULL, 'ORIGINAL, PRIMARY, PERFUSION, NONE, ND, NORM', NULL, NULL, NULL, '', 'UPENN-GBM-00459', '2011-11-26', NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, 128, NULL, '1.2.840.10008.5.1.4.1.1.4', NULL);