ImagingDataCommons/highdicom

Not able to create ContentSequence

erikogabrielsson opened this issue · 2 comments

Hi,
Im using highdicom 0.9.0 to create a SpecimenDescription. When I try to create SpecimenCollection, SpecimenStaining, or SpecimenSampling ContentSequences for a SpecimenPreparationStep:

from highdicom.content import SpecimenCollection, SpecimenStaining, SpecimenSampling
from highdicom.sr.coding import CodedConcept
import highdicom
SpecimenCollection(CodedConcept('P1-03000', 'SRT', 'Excision'))
SpecimenStaining(
        [
            CodedConcept('C-22968', 'SRT', 'hematoxylin stain'),
            CodedConcept('C-22919', 'SRT', 'water soluble eosin stain')
        ]
    )
SpecimenSampling(
        method = CodedConcept('111727', 'SRT', 'Dissection with representative sections submission'),
        parent_specimen_id = 'specimen id',
        parent_specimen_type = CodedConcept('G-8300', 'SRT', 'Tissue specimen')
    )

I get the following error (similar for SpecimenStaining and SpecimenCollection):

AttributeError: Items to be appended to a SpecimenSampling must have an established relationship type.

The same error appears in 0.8.0 but not in 0.7.0.

Thanks for reporting the issue @erikogabrielsson. Unfortunately, this bug slipped in during recent refactoring. Should be fixed with #107.

Fix is available with release v0.9.1 and the new package version is available on pypi: https://pypi.org/project/highdicom/0.9.1