cobra_db.enums

Module Contents

Classes

ByEnumName

Marker to specify that this enum is stored by it's name in the db

StrEnum

str(object='') -> str

ProjectName

Project name used in metadata as enum to keep it tidy

Modality

Modality of the image.

DataFormat

Format of an image

Laterality

Laterality of the image (0020,0060). Adding "bilateral" for MRIs that contain

View

View of the image.

PregnancyStatus

Pregnancy status of the patient. (0010,21C0).

PatientPosition

Patient Position

PersonalNumberValidity

Describes how valid a Swedish Personal Number is.

class cobra_db.enums.ByEnumName[source]

Marker to specify that this enum is stored by it’s name in the db

class cobra_db.enums.StrEnum[source]

Bases: str, enum.Enum

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

class cobra_db.enums.ProjectName[source]

Bases: StrEnum

Project name used in metadata as enum to keep it tidy

VAIB = 'vaib'
MAMMOAI = 'mammoai'
class cobra_db.enums.Modality[source]

Bases: StrEnum

Modality of the image. See https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.3.html sect_C.7.3.1.1.1

MR = 'MR'
MG = 'MG'
CR = 'CR'
CT = 'CT'
SR = 'SR'
US = 'US'
DX = 'DX'
OTHER = 'OT'
PT = 'PT'
class cobra_db.enums.DataFormat[source]

Bases: StrEnum

Format of an image

DICOM = 'dicom'
JPEG = 'jpeg'
PNG = 'png'
TIFF = 'tiff'
class cobra_db.enums.Laterality[source]

Bases: StrEnum

Laterality of the image (0020,0060). Adding “bilateral” for MRIs that contain both breasts.

LEFT = 'left'
RIGHT = 'right'
BILATERAL = 'bilateral'
classmethod from_image_laterality(image_laterality: str)[source]
classmethod from_nkbc_a_pat_sida(value: Literal[1, 2, 1, 2])[source]

Map the description of a_pat_sida to left or right according to

Parameters:

value – value coming from the NKBC database/csv. Literal[1, 2]

Returns:

instance of this class

class cobra_db.enums.View[source]

Bases: StrEnum

View of the image.

AX = 'axial'
SAG = 'sagittal'
COR = 'coronal'
MLO = 'mediolateral_oblique'
CC = 'craniocaudal'
classmethod from_view_position(view_position: str)[source]
class cobra_db.enums.PregnancyStatus[source]

Bases: StrEnum

Pregnancy status of the patient. (0010,21C0).

NOT_PREGNANT = '0001'
POSSIBLY_PREGNANT = '0002'
DEFINETLY_PREGNANT = '0003'
UNKNOWN = '0004'
class cobra_db.enums.PatientPosition[source]

Bases: StrEnum

Patient Position https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.3.html sect_C.7.3.1.1.2

HFP = 'HFP'
HFS = 'HFS'
HFDR = 'HFDR'
HFDL = 'HFDL'
FFDR = 'FFDR'
FFDL = 'FFDL'
FFP = 'FFP'
FFS = 'FFS'
LFP = 'LFP'
LFS = 'LFS'
RFP = 'RFP'
RFS = 'RFS'
AFDR = 'AFDR'
AFDL = 'AFDL'
PFDR = 'PFDR'
PFDL = 'PFDL'
class cobra_db.enums.PersonalNumberValidity[source]

Bases: enum.IntFlag

Describes how valid a Swedish Personal Number is. As a binary set of flags where 1 means valid. 0b |0 |0 |0 |0

|checksum |date |length |chars

In the end all the flags are interpreted as an integer. For example: 3 would be 0b0011 which means valid chars and length. 6 would be 0b0110 which means valid length and date. 7 would be 0b0111 which means only the checksum is not valid And so on for any number between 0 and 15

NOT_VALID = 0
CHARS = 1
LENGTH = 2
DATE = 4
CHECKSUM = 8
VALID = 15