w3c / hcls-fhir-rdf

Sketching out an RDF representation for FHIR
38 stars 15 forks source link

Amalgam v1.0 -- Overall DICOM RDF serialization plan #148

Open ebremer opened 3 months ago

ebremer commented 3 months ago

I've created an updated version of what I generate to reflect what I believe puts everything together to date.

  1. [ a dcm:null ] when nulls are needed in literal lists (see dcm:00080008)
  2. Removal of VR types when unambiguous. VR is kept in the binary types and BulkDataURIs.
  3. Removal of RDF List when Value Multiplicity is always 1.
  4. How to handle lists with missing elements. See https://github.com/w3c/hcls-fhir-rdf/issues/141https://github.com/w3c/hcls-fhir-rdf/issues/141
  5. All VR mapped to xsd data types
  6. DICOM sequence (SQ) are handled with RDF Lists and use nested blank nodes with any needed dcm tags ( see tag dcm:00291000) See https://github.com/w3c/hcls-fhir-rdf/issues/146
  7. DICOM Private Data Elements. See https://github.com/w3c/hcls-fhir-rdf/issues/145
  8. DICOM InlineBinary and BulkDataURI. See https://github.com/w3c/hcls-fhir-rdf/issues/144
  9. What should the primary subject of the file be? See https://github.com/w3c/hcls-fhir-rdf/issues/142
PREFIX bib: <http://id.loc.gov/ontologies/bibframe/>
PREFIX cry: <http://id.loc.gov/vocabulary/preservation/cryptographicHashFunctions/>
PREFIX dcm: <http://dicom.nema.org/resources/ontology/DCM/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

<urn:sha256:ee1fcf71fecb6a8aee3b1219388cc7ded40a804056a7647674ba1a77b797ae8e>
        rdf:type      dcm:DicomFile;
        dcm:00020001  [ dcm:InlineBinary  "AAE="^^xsd:base64Binary;
                        dcm:vr            "OB"
                      ];
        dcm:00020002  "1.2.840.10008.5.1.4.1.1.12.1";
        dcm:00020003  "1.3.12.2.1107.5.4.3.321890.19960124.162922.29";
        dcm:00020010  "1.2.840.10008.1.2.4.50";
        dcm:00020012  "999.999";
        dcm:00080008  ( "DERIVED" "PRIMARY" [ dcm:null ] "SINGLE A" );
        dcm:00080016  "1.2.840.10008.5.1.4.1.1.12.1";
        dcm:00080018  "1.3.12.2.1107.5.4.3.321890.19960124.162922.29";
        dcm:00080020  "1994-10-13"^^xsd:date;
        dcm:00080030  "14:19:17"^^xsd:time;
        dcm:00080060  "XA";
        dcm:00082110  "01";
        dcm:00082112  [ dcm:00081150  "1.2.840.10008.5.1.4.1.1.12.1";
                        dcm:00081155  "1.3.12.2.1107.5.4.3.321890.19960124.162922.28"
                      ];
        dcm:00090010  ( "CARDIO-SMS 1.0" );
        dcm:00091002  [ dcm:InlineBinary  "AAAAAQAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAABAAAAAAAAAAAAAAADAAAA/wAAAAAAAAB/AAAA/wAAAAEAAAAAAAAAAAAAAAAAAAADAAAACAAAAAEAAAABAAAAAAAAAAAAAAADAAAACC0tLS0tLS0tLS0tLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC0tLS0tLUIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC0tLS0tLS0tAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtLS0tLS0tLQAALS0tLS0tAAAAAAAAAAAAAAAALS0tLS0tLS0AAC0tLS0tLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC0tLS0tLS0tLS0tAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAARAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEQAAAAAxLjMuMTIuMi4xMTA3LjUuNC4zLjEyMzQ1Njc4OTAxMjM0NS4wMDAwMDAwMC4wMDAwMDAuNgAAAAAAAAAAAAAAAAAxLjMuMTIuMi4xMTA3LjUuNC4zLjEyMzQ1Njc4OTAxMjM0NS4wMDAwMDAwMC4wMDAwMDAuOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="^^xsd:base64Binary;
                        dcm:vr            "OB"
                      ];
        dcm:00091003  [ dcm:InlineBinary  "AAAAADAwMDAwMDAwAAAwMDAwMDAAEN5MARDdDgAAAAgwMDAwMDAwMAAAMDAwMDAwAAAAAAAAAAMAAAABSGljb3IgQ2luZQAAAAAAPwAAAB4wMC0wMC0wMAowMDowMDowMApTY2VuZTogIDE0CgAAAgE0khgBQle4XFBEQlxJRE0AAAACAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAAAAAAAAAAAAAAAAAGAAAAABAR+F9AAAAAAAAAAAAAALuAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAP///rv///yCAAAAEf////0AAAC6AAAAoQAAA90AAARkAAAEGAAABvEAAADIAAAS3AAAHh4AAAA7AAAAAAAAAAAAAAAAAAAAAQAAAAEBEN1cAR58ogAAAA4AAAADARDdGgEQ3NgAAAABAAAAAQEQ3kwBNJ9IAAAAAAE0khAAAAABAAAAAAAAAGAAAAAAAAAAAwAAAAAAAAD/AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAABBTUVTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"^^xsd:base64Binary;
                        dcm:vr            "OB"
                      ];
        dcm:00091005  [ dcm:InlineBinary  "AAAPAAAAAGAAAAACAAAEsAAAACgAAAAD"^^xsd:base64Binary;
                        dcm:vr            "OB"
                      ];
        dcm:00100010  [ dcm:Alphabetic  "Rubo DEMO" ];
        dcm:00100020  "556342B";
        dcm:00100030  "1995-10-25"^^xsd:date;
        dcm:00100040  "M";
        dcm:00181063  "33"^^xsd:decimal;
        dcm:00181155  "GR";
        dcm:00181510  "-32"^^xsd:decimal;
        dcm:00181511  "2"^^xsd:decimal;
        dcm:00190010  ( "CARDIO-D.R. 1.0" );
        dcm:00191030  ( "262144"^^xsd:unsignedInt );
        dcm:0020000D  "1.3.12.2.1107.5.4.3.123456789012345.19950922.121803.6";
        dcm:0020000E  "1.3.12.2.1107.5.4.3.123456789012345.19950922.121803.8";
        dcm:00200011  1;
        dcm:00210010  ( "CARDIO-D.R. 1.0" );
        dcm:00211013  ( 15 );
        dcm:00280002  1;
        dcm:00280004  "MONOCHROME2";
        dcm:00280008  96;
        dcm:00280009  ( "00181063" );
        dcm:00280010  512;
        dcm:00280011  512;
        dcm:00280100  8;
        dcm:00280101  8;
        dcm:00280102  7;
        dcm:00280103  0;
        dcm:00281040  "LIN";
        dcm:00281090  "NAT";
        dcm:00286040  ( 20 53 77 );
        dcm:00286100  [ dcm:00286101  "NONE";
                        dcm:00286110  ( 0 )
                      ];
        dcm:00290010  ( "CARDIO-D.R. 1.0" );
        dcm:00291000  ( [ dcm:00290010  ( "CARDIO-D.R. 1.0" );
                          dcm:00291001  ( 5 5 );
                          dcm:00291002  ( 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 );
                          dcm:00291003  ( "0.5"^^xsd:float )
                        ]
                      );
        dcm:50000005  ( 2 );
        dcm:50000010  ( 3840 );
        dcm:50000020  ( "ECG" );
        dcm:50000030  ( "DPPS" "NONE" );
        dcm:50000103  ( 0 );
        dcm:50000110  ( 0 1 );
        dcm:50000112  ( 0 );
        dcm:50000114  ( 40 );
        dcm:50003000  [ dcm:BulkDataURI  <urn:sha256:ee1fcf71fecb6a8aee3b1219388cc7ded40a804056a7647674ba1a77b797ae8e?offset=0&length=7680>;
                        dcm:vr           "OW"
                      ];
        bib:FileSize  "1702398"^^xsd:int;
        cry:sha256    "ee1fcf71fecb6a8aee3b1219388cc7ded40a804056a7647674ba1a77b797ae8e";
        owl:sameAs    <file:///D:/dicom/sample/0002.DCM> .
ebremer commented 2 months ago

Here is a new version that changes the file name to the SOP Instance UID, and uses 0008,1190 for alternate locations for the SOP Instance (https://github.com/w3c/hcls-fhir-rdf/issues/142). Also changed, that the VR is kept for private (odd) tags (https://github.com/w3c/hcls-fhir-rdf/issues/145)

PREFIX dcm: <https://halcyon.is/dicom/ns/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

<urn:oid:1.3.12.2.1107.5.4.3.321890.19960124.162922.29>
        rdf:type      dcm:SOPInstance;
        dcm:00020001  [ dcm:InlineBinary  "AAE="^^xsd:base64Binary;
                        dcm:vr            "OB"
                      ];
        dcm:00020002  "1.2.840.10008.5.1.4.1.1.12.1";
        dcm:00020003  "1.3.12.2.1107.5.4.3.321890.19960124.162922.29";
        dcm:00020010  "1.2.840.10008.1.2.4.50";
        dcm:00020012  "999.999";
        dcm:00080008  ( "DERIVED" "PRIMARY" "SINGLE PLANE" "SINGLE A" );
        dcm:00080016  "1.2.840.10008.5.1.4.1.1.12.1";
        dcm:00080018  "1.3.12.2.1107.5.4.3.321890.19960124.162922.29";
        dcm:00080020  "1994-10-13"^^xsd:date;
        dcm:00080030  "14:19:17"^^xsd:time;
        dcm:00080060  "XA";
        dcm:00081190  "file:///D:/dicom/sample/0002.DCM";
        dcm:00082110  "01";
        dcm:00082112  [ dcm:00081150  "1.2.840.10008.5.1.4.1.1.12.1";
                        dcm:00081155  "1.3.12.2.1107.5.4.3.321890.19960124.162922.28"
                      ];
        dcm:00090010  [ dcm:Value  ( "CARDIO-SMS 1.0" );
                        dcm:vr     "LO"
                      ];
        dcm:00091002  [ dcm:InlineBinary  "AAAAAQAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAABAAAAAAAAAAAAAAADAAAA/wAAAAAAAAB/AAAA/wAAAAEAAAAAAAAAAAAAAAAAAAADAAAACAAAAAEAAAABAAAAAAAAAAAAAAADAAAACC0tLS0tLS0tLS0tLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC0tLS0tLUIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC0tLS0tLS0tAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtLS0tLS0tLQAALS0tLS0tAAAAAAAAAAAAAAAALS0tLS0tLS0AAC0tLS0tLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC0tLS0tLS0tLS0tAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAARAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEQAAAAAxLjMuMTIuMi4xMTA3LjUuNC4zLjEyMzQ1Njc4OTAxMjM0NS4wMDAwMDAwMC4wMDAwMDAuNgAAAAAAAAAAAAAAAAAxLjMuMTIuMi4xMTA3LjUuNC4zLjEyMzQ1Njc4OTAxMjM0NS4wMDAwMDAwMC4wMDAwMDAuOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="^^xsd:base64Binary;
                        dcm:vr            "OB"
                      ];
        dcm:00091003  [ dcm:InlineBinary  "AAAAADAwMDAwMDAwAAAwMDAwMDAAEN5MARDdDgAAAAgwMDAwMDAwMAAAMDAwMDAwAAAAAAAAAAMAAAABSGljb3IgQ2luZQAAAAAAPwAAAB4wMC0wMC0wMAowMDowMDowMApTY2VuZTogIDE0CgAAAgE0khgBQle4XFBEQlxJRE0AAAACAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAAAAAAAAAAAAAAAAAGAAAAABAR+F9AAAAAAAAAAAAAALuAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAP///rv///yCAAAAEf////0AAAC6AAAAoQAAA90AAARkAAAEGAAABvEAAADIAAAS3AAAHh4AAAA7AAAAAAAAAAAAAAAAAAAAAQAAAAEBEN1cAR58ogAAAA4AAAADARDdGgEQ3NgAAAABAAAAAQEQ3kwBNJ9IAAAAAAE0khAAAAABAAAAAAAAAGAAAAAAAAAAAwAAAAAAAAD/AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAABBTUVTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"^^xsd:base64Binary;
                        dcm:vr            "OB"
                      ];
        dcm:00091005  [ dcm:InlineBinary  "AAAPAAAAAGAAAAACAAAEsAAAACgAAAAD"^^xsd:base64Binary;
                        dcm:vr            "OB"
                      ];
        dcm:00100010  [ dcm:Alphabetic  "Rubo DEMO" ];
        dcm:00100020  "556342B";
        dcm:00100030  "1995-10-25"^^xsd:date;
        dcm:00100040  "M";
        dcm:00181063  "33"^^xsd:decimal;
        dcm:00181155  "GR";
        dcm:00181510  "-32"^^xsd:decimal;
        dcm:00181511  "2"^^xsd:decimal;
        dcm:00190010  [ dcm:Value  ( "CARDIO-D.R. 1.0" );
                        dcm:vr     "LO"
                      ];
        dcm:00191030  [ dcm:Value  ( "262144"^^xsd:unsignedInt );
                        dcm:vr     "UL"
                      ];
        dcm:0020000D  [ dcm:Value  ( "1.3.12.2.1107.5.4.3.123456789012345.19950922.121803.6" );
                        dcm:vr     "UI"
                      ];
        dcm:0020000E  [ dcm:Value  ( "1.3.12.2.1107.5.4.3.123456789012345.19950922.121803.8" );
                        dcm:vr     "UI"
                      ];
        dcm:00200011  1;
        dcm:00210010  [ dcm:Value  ( "CARDIO-D.R. 1.0" );
                        dcm:vr     "LO"
                      ];
        dcm:00211013  [ dcm:Value  ( 15 );
                        dcm:vr     "IS"
                      ];
        dcm:00280002  1;
        dcm:00280004  "MONOCHROME2";
        dcm:00280008  96;
        dcm:00280009  ( "00181063" );
        dcm:00280010  512;
        dcm:00280011  512;
        dcm:00280100  8;
        dcm:00280101  8;
        dcm:00280102  7;
        dcm:00280103  0;
        dcm:00281040  "LIN";
        dcm:00281090  "NAT";
        dcm:00286040  ( 20 53 77 );
        dcm:00286100  [ dcm:00286101  "NONE";
                        dcm:00286110  ( 0 )
                      ];
        dcm:00290010  [ dcm:Value  ( "CARDIO-D.R. 1.0" );
                        dcm:vr     "LO"
                      ];
        dcm:00291000  [ dcm:Value  ( [ dcm:00290010  [ dcm:Value  ( "CARDIO-D.R. 1.0" );
                                                       dcm:vr     "LO"
                                                     ];
                                       dcm:00291001  [ dcm:Value  ( 5 5 );
                                                       dcm:vr     "US"
                                                     ];
                                       dcm:00291002  [ dcm:Value  ( 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 );
                                                       dcm:vr     "US"
                                                     ];
                                       dcm:00291003  [ dcm:Value  ( "0.5"^^xsd:float );
                                                       dcm:vr     "FL"
                                                     ]
                                     ]
                                   );
                        dcm:vr     "SQ"
                      ];
        dcm:50000005  ( 2 );
        dcm:50000010  ( 3840 );
        dcm:50000020  ( "ECG" );
        dcm:50000030  ( "DPPS" "NONE" );
        dcm:50000103  ( 0 );
        dcm:50000110  ( 0 1 );
        dcm:50000112  ( 0 );
        dcm:50000114  ( 40 );
        dcm:50003000  [ dcm:BulkDataURI  <file:/C:/Users/erich/AppData/Local/Temp/blk8069536285080632981.tmp?offset=0&length=7680>;
                        dcm:vr           "OW"
                      ] .