File tree Expand file tree Collapse file tree 3 files changed +4
-14
lines changed
Expand file tree Collapse file tree 3 files changed +4
-14
lines changed Original file line number Diff line number Diff line change 1212 Diagnosis ,
1313 DiagnosisConfirmType ,
1414 ImageType ,
15- LesionId ,
1615 MelClass ,
1716 MelMitoticIndex ,
1817 MelThickMm ,
1918 MelType ,
2019 NevusType ,
21- PatientId ,
2220 Sex ,
2321)
2422
6260 ("mel_mitotic_index" , MelMitoticIndex ),
6361 ("anatom_site_general" , AnatomSiteGeneral ),
6462 ("color_tint" , ColorTint ),
65- ("patient_id" , PatientId ),
66- ("lesion_id" , LesionId ),
63+ ("patient_id" , str ),
64+ ("lesion_id" , str ),
6765]:
6866 FIELD_REGISTRY [field ] = {
6967 "validator" : validator ,
Original file line number Diff line number Diff line change 44import re
55from typing import Optional , Union
66
7- from pydantic .types import constr
8-
97
108class BaseStr (str ):
119 @classmethod
@@ -323,7 +321,3 @@ def validate(cls, value: str) -> Optional[str]:
323321
324322class AcquisitionDay (int ):
325323 pass
326-
327-
328- PatientId = constr (pattern = r"^IP_[0-9]{7}$" )
329- LesionId = constr (pattern = r"^IL_[0-9]{7}$" )
Original file line number Diff line number Diff line change 2525 DiagnosisConfirmTypeEnum ,
2626 DiagnosisEnum ,
2727 ImageTypeEnum ,
28- LesionId ,
2928 MelClassEnum ,
3029 MelMitoticIndexEnum ,
3130 MelThickMm ,
3231 MelTypeEnum ,
3332 NevusTypeEnum ,
34- PatientId ,
3533 Sex ,
3634)
3735
@@ -74,8 +72,8 @@ class MetadataRow(BaseModel):
7472 ] = None
7573 melanocytic : Optional [bool ] = None
7674 # these can be passed as ints, floats, etc from pandas so they need to be coerced to strings
77- patient_id : Optional [Annotated [PatientId , BeforeValidator (lambda x : str (x ))]] = None
78- lesion_id : Optional [Annotated [LesionId , BeforeValidator (lambda x : str (x ))]] = None
75+ patient_id : Optional [Annotated [str , BeforeValidator (lambda x : str (x ))]] = None
76+ lesion_id : Optional [Annotated [str , BeforeValidator (lambda x : str (x ))]] = None
7977 acquisition_day : Optional [int ] = None
8078 marker_pen : Optional [bool ] = None
8179 hairy : Optional [bool ] = None
You can’t perform that action at this time.
0 commit comments