gradienthealth/dicom-protos

Traverse "path" for hierarchal message creation

suyashkumar opened this issue · 4 comments

Right now, certain attributes in a sequence get repeated in a flat manner for modules like EnhancedCTImage and attributes like ReferencedSeriesSequence. The JSON has a path key that seems to group together hierarchal relationships between attributes. For example, examine the path attributes below:

    {
        "module":"enhanced-ct-image",
        "path":"enhanced-ct-image:00089121",
        "tag":"(0008,9121)",
        "type":"3",
        "linkToStandard":"http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.8.15.2.html#table_C.8-114",
        "description":"<td colspan=\"1\" rowspan=\"1\">\n<p>\nThe Raw data that was used to derive this Image.</p>\n<p>\nOne or more Items are permitted in this Sequence.</p>\n<div>\n<h3>Note</h3>\n<p>\nThe items of in this Sequence may identify raw data that has not been stored or encoded as a DICOM object. This allows recognition that images in different instances have been reconstructed from the same raw data.</p>\n</div>\n</td>",
        "externalReferences":[]
    },
    {
        "module":"enhanced-ct-image",
        "path":"enhanced-ct-image:00089121:0020000d",
        "tag":"(0020,000D)",
        "type":"1",
        "linkToStandard":"http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.8.15.2.html#table_C.8-114",
        "description":"<td colspan=\"1\" rowspan=\"1\">\n<p>\nUnique identifier for the Study</p>\n</td>",
        "externalReferences":[]
    },
    {
        "module":"enhanced-ct-image",
        "path":"enhanced-ct-image:00089121:00081115",
        "tag":"(0008,1115)",
        "type":"1",
        "linkToStandard":"http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.8.15.2.html#table_C.8-114",
        "description":"<td colspan=\"1\" rowspan=\"1\">\n<p>\nSequence of Items where each Item includes the Attributes of a Series containing referenced Composite Object(s).</p>\n<p>\nOne or more Items shall be included in this Sequence</p>\n</td>",
        "externalReferences":[]
    },

may be good to consider a new writing approach that leverages the above path information by storing the path structure in a tree of attributes, then using that tree to know which attributes to "grab off the shelf" to write into a higher order message...we can keep track of which proto messages have already been written and prevent the generator from regenerating those protos as well. This will likely require a refactor.

@Ouwen here's the issue we discussed! Have at it!

Also heads up @Ouwen as discussed, in #9 the change from []Attribute to map[TagKey]*Attribute means that the repeat attribute issue isn't apparent anymore, but is still effectively present and requires use of AddSubAttribute when needed to capture fully.

this was closed in #14!