1919
2020import java .util .Collections ;
2121import java .util .EnumMap ;
22+ import java .util .EnumSet ;
2223import java .util .Map ;
24+ import java .util .Set ;
25+
26+ import org .apache .commons .lang3 .StringUtils ;
2327
2428import de .symeda .sormas .api .Disease ;
2529import de .symeda .sormas .api .i18n .I18nProperties ;
@@ -67,6 +71,7 @@ public enum SampleMaterial {
6771 Disease .CRYPTOSPORIDIOSIS ,
6872 Disease .MALARIA ,
6973 Disease .DENGUE }, hide = true )
74+ @ Deprecated
7075 THROAT_ASPIRATE ,
7176
7277 @ Diseases (value = {
@@ -78,6 +83,7 @@ public enum SampleMaterial {
7883 Disease .CRYPTOSPORIDIOSIS ,
7984 Disease .MALARIA ,
8085 Disease .DENGUE }, hide = true )
86+ @ Deprecated
8187 NASAL_SWAB ,
8288
8389 @ Diseases (value = {
@@ -160,6 +166,7 @@ public enum SampleMaterial {
160166 Disease .CRYPTOSPORIDIOSIS ,
161167 Disease .MALARIA ,
162168 Disease .DENGUE }, hide = true )
169+ @ Deprecated
163170 CORNEA_PM ,
164171
165172 @ Diseases (value = {
@@ -181,6 +188,7 @@ public enum SampleMaterial {
181188 Disease .CRYPTOSPORIDIOSIS ,
182189 Disease .MALARIA ,
183190 Disease .DENGUE }, hide = true )
191+ @ Deprecated
184192 URINE_PM ,
185193
186194 @ Diseases (value = {
@@ -198,6 +206,7 @@ public enum SampleMaterial {
198206 @ Diseases ({
199207 Disease .GIARDIASIS ,
200208 Disease .CRYPTOSPORIDIOSIS })
209+ @ Deprecated
201210 BIOPSY ,
202211
203212 @ Diseases (value = {
@@ -286,10 +295,12 @@ public enum SampleMaterial {
286295
287296 @ Diseases (value = {
288297 Disease .RESPIRATORY_SYNCYTIAL_VIRUS })
298+ @ Deprecated
289299 NASOPHARYNGEAL_LAVAGE ,
290300
291301 @ Diseases (value = {
292302 Disease .RESPIRATORY_SYNCYTIAL_VIRUS })
303+ @ Deprecated
293304 OROPHARYNGEAL_SWAB ,
294305
295306 @ Diseases (value = {
@@ -333,10 +344,12 @@ public enum SampleMaterial {
333344
334345 @ Diseases (value = {
335346 Disease .CRYPTOSPORIDIOSIS })
347+ @ Deprecated
336348 INTESTINAL_FLUID ,
337349
338350 @ Diseases (value = {
339351 Disease .GIARDIASIS })
352+ @ Deprecated
340353 DUODENUM_FLUID ,
341354
342355 @ Diseases ({
@@ -345,6 +358,7 @@ public enum SampleMaterial {
345358
346359 @ Diseases ({
347360 Disease .SALMONELLOSIS })
361+ @ Deprecated
348362 BONE_AND_JOINT ,
349363
350364 @ Diseases ({
@@ -365,6 +379,7 @@ public enum SampleMaterial {
365379
366380 @ Diseases ({
367381 Disease .SALMONELLOSIS })
382+ @ Deprecated
368383 LOWER_RESPIRATORY_TRACT ,
369384
370385 @ Diseases ({
@@ -381,61 +396,124 @@ public enum SampleMaterial {
381396
382397 @ Diseases ({
383398 Disease .SALMONELLOSIS })
399+ @ Deprecated
384400 SOFT_TISSUE ,
385401
386402 @ Diseases ({
387403 Disease .SALMONELLOSIS })
388404 WOUND ,
389405
406+ ABSCESS_SWAB ,
407+
408+ BONE ,
409+
410+ BONE_MARROW ,
411+
412+ CONJUNCTIVAL_SWAB ,
413+
414+ MIDDLE_EAR_FLUID ,
415+
416+ PLASMA ,
417+
418+ SWAB_UNSPECIFIED ,
419+
420+ TEARS ,
421+
422+ UNKNOWN ,
423+
424+ @ Deprecated
390425 OTHER ;
391426
392427 /**
393- * SNOMED-CT codes for sample materials. Reference data per the v1.1 Salmonellosis spec
394- * (Lux requirement Salmonella v1.1.docx, sample list table). Optional: returns null
395- * when no canonical code is mapped .
428+ * SNOMED-CT codes for sample materials, aligned with the upgraded specimen list of
429+ * issue #13560 (SNOMED-CT 2025-07-01 release). Returns null when no canonical code is mapped
430+ * (e.g. UNKNOWN, OTHER, and deprecated values without a current equivalent) .
396431 */
397432 private static final Map <SampleMaterial , String > SNOMED_CODES ;
398433 static {
399434 EnumMap <SampleMaterial , String > map = new EnumMap <>(SampleMaterial .class );
435+ map .put (ABSCESS_SWAB , "258497007" );
436+ map .put (AMNIOTIC_FLUID , "119373006" );
437+ map .put (ANTERIOR_NARES_SWAB , "697989009" );
400438 map .put (ASPIRATE , "119295008" );
401- map .put (BRONCHOALVEOLAR_LAVAGE , "258607008" );
402439 map .put (BLOOD , "119297000" );
403- map .put (BONE_AND_JOINT , "258539005" );
404- map .put (CATHETER_EXIT_SITE , "16227651000119102" );
405- map .put (CRUST , "1332490003" );
440+ map .put (BONE , "258417006" );
441+ map .put (BONE_MARROW , "119359002" );
442+ map .put (BRAIN_TISSUE , "256865009" );
443+ map .put (BRONCHOALVEOLAR_LAVAGE , "258607008" );
444+ map .put (CATHETER_EXIT_SITE , "16227651000119100" );
406445 map .put (CEREBROSPINAL_FLUID , "258450006" );
446+ map .put (CLINICAL_SAMPLE , "123038009" );
447+ map .put (CONJUNCTIVAL_SWAB , "258498002" );
448+ map .put (CRUST , "1332490003" );
407449 map .put (DRY_BLOOD , "440500007" );
408- map .put (EDTA_WHOLE_BLOOD , "57921000052103" );
450+ map .put (EDTA_WHOLE_BLOOD , "258580003" );
451+ map .put (ENDOTRACHEAL_ASPIRATE , "119307008" );
409452 map .put (EYE , "119399004" );
410453 map .put (STOOL , "119339001" );
411- map .put (GENITAL_SWAB , "258508008" );
412454 map .put (GASTRIC_FLUID , "258459007" );
413- map .put (LOWER_RESPIRATORY_TRACT , "258606004 " );
414- map .put (TISSUE , "399492000 " );
415- map .put (WOUND , "119365002 " );
455+ map .put (GENITAL_SWAB , "258508008 " );
456+ map .put (MIDDLE_EAR_FLUID , "258466008 " );
457+ map .put (NP_ASPIRATE , "429931000124105 " );
416458 map .put (NP_SWAB , "258500001" );
417- map .put (OROPHARYNGEAL_SWAB , "461911000124106" );
459+ map .put (NUCHAL_SKIN_BIOPSY , "309066003" );
460+ map .put (OP_ASPIRATE , "258412000" );
461+ map .put (THROAT_SWAB , "258529004" );
462+ map .put (PERITONEAL_FLUID , "168139001" );
463+ map .put (PLASMA , "50863008" );
418464 map .put (PLEURAL_FLUID , "418564007" );
419- map .put (PUS , "119323008 " );
465+ map .put (PUS , "258502009 " );
420466 map .put (RECTAL_SWAB , "258528007" );
421467 map .put (SALIVA , "119342007" );
422- map .put (SEMEN , "119347001 " );
468+ map .put (SEMEN , "734846002 " );
423469 map .put (SERA , "119364003" );
424- map .put (SKIN , "608969007" );
425- map .put (SOFT_TISSUE , "309072003" );
470+ map .put (SKIN , "119325001" );
426471 map .put (SPUTUM , "119334006" );
427- map .put (SYNOVIAL_FLUID , "119332005" );
472+ map .put (SWAB_UNSPECIFIED , "257261003" );
473+ map .put (SYNOVIAL_FLUID , "264380007" );
474+ map .put (TEARS , "122594008" );
475+ map .put (TISSUE , "119376003" );
428476 map .put (URINE , "122575003" );
477+ map .put (WOUND , "119365002" );
429478 SNOMED_CODES = Collections .unmodifiableMap (map );
430479 }
431480
481+ /**
482+ * Sample materials retired by issue #13560. Kept in the enum (and marked {@link Deprecated}) so
483+ * historical records still de-serialize and render, but hidden from the create-sample dropdown for
484+ * new samples. This set is the runtime index used by {@link #isDeprecated()}; it must stay in sync
485+ * with the {@code @Deprecated} constants above.
486+ */
487+ private static final Set <SampleMaterial > DEPRECATED_MATERIALS = Collections .unmodifiableSet (
488+ EnumSet .of (
489+ URINE_PM ,
490+ CORNEA_PM ,
491+ NASAL_SWAB ,
492+ NASOPHARYNGEAL_LAVAGE ,
493+ OROPHARYNGEAL_SWAB ,
494+ THROAT_ASPIRATE ,
495+ INTESTINAL_FLUID ,
496+ DUODENUM_FLUID ,
497+ LOWER_RESPIRATORY_TRACT ,
498+ SOFT_TISSUE ,
499+ BONE_AND_JOINT ,
500+ BIOPSY ,
501+ OTHER ));
502+
432503 /**
433504 * @return SNOMED-CT code for this sample material, or {@code null} if no canonical code is mapped.
434505 */
435506 public String getSnomedCode () {
436507 return SNOMED_CODES .get (this );
437508 }
438509
510+ /**
511+ * @return {@code true} if this material is retired and should not be offered for new samples.
512+ */
513+ public boolean isDeprecated () {
514+ return DEPRECATED_MATERIALS .contains (this );
515+ }
516+
439517 @ Override
440518 public String toString () {
441519 return I18nProperties .getEnumCaption (this );
@@ -451,6 +529,10 @@ public static String toString(SampleMaterial value, String details) {
451529 return DataHelper .toStringNullable (details );
452530 }
453531
532+ if (value == SampleMaterial .CLINICAL_SAMPLE && StringUtils .isNotBlank (details )) {
533+ return details ;
534+ }
535+
454536 return value .toString ();
455537 }
456538}
0 commit comments