Skip to content

Commit 8c17426

Browse files
authored
Merge pull request #13945 from SORMAS-Foundation/feature/13560-samples-list-upgrade
Upgrades samples list & also maps list items to SNOMED-CT identifier
2 parents e26b6f3 + c16ec34 commit 8c17426

5 files changed

Lines changed: 317 additions & 58 deletions

File tree

sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleMaterial.java

Lines changed: 100 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919

2020
import java.util.Collections;
2121
import java.util.EnumMap;
22+
import java.util.EnumSet;
2223
import java.util.Map;
24+
import java.util.Set;
25+
26+
import org.apache.commons.lang3.StringUtils;
2327

2428
import de.symeda.sormas.api.Disease;
2529
import 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
}

sormas-api/src/main/resources/enum.properties

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,53 +1341,62 @@ RsvSubtype.RSV_A_AND_B = RSV A+B
13411341
RsvSubtype.INDETERMINATE = Indeterminate
13421342

13431343
# SampleMaterial
1344+
SampleMaterial.ABSCESS_SWAB = Abscess swab
1345+
SampleMaterial.AMNIOTIC_FLUID = Amniotic fluid
1346+
SampleMaterial.ANTERIOR_NARES_SWAB = Anterior nares swab
1347+
SampleMaterial.ASPIRATE = Aspirate (unspecified)
13441348
SampleMaterial.BLOOD = Blood
1349+
SampleMaterial.BONE = Bone
1350+
SampleMaterial.BONE_MARROW = Bone marrow
1351+
SampleMaterial.BRAIN_TISSUE = Brain tissue
1352+
SampleMaterial.BRONCHOALVEOLAR_LAVAGE = Bronchoalveolar lavage
1353+
SampleMaterial.CATHETER_EXIT_SITE = Catheter exit site
13451354
SampleMaterial.CEREBROSPINAL_FLUID = Cerebrospinal fluid
1346-
SampleMaterial.CRUST = Crust
1347-
SampleMaterial.NASAL_SWAB = Nasal swab
1355+
SampleMaterial.CLINICAL_SAMPLE = Clinical Sample (Other)
1356+
SampleMaterial.CONJUNCTIVAL_SWAB = Conjunctival swab
1357+
SampleMaterial.DRY_BLOOD = Dried blood spot
1358+
SampleMaterial.EDTA_WHOLE_BLOOD = EDTA whole blood
1359+
SampleMaterial.ENDOTRACHEAL_ASPIRATE = Endotracheal aspirate
1360+
SampleMaterial.EYE = Eye
1361+
SampleMaterial.GASTRIC_FLUID = Gastric fluid
1362+
SampleMaterial.GENITAL_SWAB = Genital swab
1363+
SampleMaterial.MIDDLE_EAR_FLUID = Middle ear fluid
1364+
SampleMaterial.NP_ASPIRATE = Nasopharyngeal aspirate
13481365
SampleMaterial.NP_SWAB = Nasopharyngeal swab
1349-
SampleMaterial.OTHER = Other
1366+
SampleMaterial.NUCHAL_SKIN_BIOPSY = Nuchal skin biopsy
1367+
SampleMaterial.OP_ASPIRATE = Oropharyngeal (throat) aspirate
1368+
SampleMaterial.THROAT_SWAB = Oropharyngeal (throat) swab
1369+
SampleMaterial.PERITONEAL_FLUID = Peritoneal fluid
1370+
SampleMaterial.PLASMA = Plasma
1371+
SampleMaterial.PLEURAL_FLUID = Pleural fluid
1372+
SampleMaterial.PUS = Pus
13501373
SampleMaterial.RECTAL_SWAB = Rectal swab
1351-
SampleMaterial.SERA = Sera
1374+
SampleMaterial.SALIVA = Saliva
1375+
SampleMaterial.SEMEN = Semen
1376+
SampleMaterial.SERA = Serum
1377+
SampleMaterial.SKIN = Skin
1378+
SampleMaterial.CRUST = Skin lesion crust
1379+
SampleMaterial.SPUTUM = Sputum
13521380
SampleMaterial.STOOL = Stool
1353-
SampleMaterial.THROAT_SWAB = Throat swab
1381+
SampleMaterial.SWAB_UNSPECIFIED = Swab (unspecified)
1382+
SampleMaterial.SYNOVIAL_FLUID = Synovial fluid
1383+
SampleMaterial.TEARS = Tears
13541384
SampleMaterial.TISSUE = Tissue
1385+
SampleMaterial.UNKNOWN = Unknown
13551386
SampleMaterial.URINE = Urine
1356-
SampleMaterial.CORNEA_PM=Cornea p.m
1357-
SampleMaterial.SALIVA=Saliva
1358-
SampleMaterial.URINE_PM=Urine p.m
1359-
SampleMaterial.NUCHAL_SKIN_BIOPSY=Nuchal skin biopsy
1360-
SampleMaterial.BRAIN_TISSUE=Brain tissue
1361-
SampleMaterial.OROPHARYNGEAL_SWAB=Oropharyngeal swab
1362-
SampleMaterial.SPUTUM=Sputum
1363-
SampleMaterial.ENDOTRACHEAL_ASPIRATE=Endotracheal aspirate
1364-
SampleMaterial.BRONCHOALVEOLAR_LAVAGE=Bronchoalveolar lavage
1365-
SampleMaterial.ANTERIOR_NARES_SWAB=Anterior nares swab
1366-
SampleMaterial.OP_ASPIRATE=Oropharyngeal aspirate
1367-
SampleMaterial.NP_ASPIRATE=Nasopharyngeal aspirate
1368-
SampleMaterial.NASOPHARYNGEAL_LAVAGE=Nasopharyngeal lavage
1369-
SampleMaterial.PLEURAL_FLUID=Pleural fluid specimen
1370-
SampleMaterial.CLINICAL_SAMPLE=Clinical sample
1371-
SampleMaterial.PERITONEAL_FLUID = Peritoneal Fluid
1372-
SampleMaterial.SYNOVIAL_FLUID = Synovial Fluid
1373-
SampleMaterial.DRY_BLOOD = Dried blood spot
1374-
SampleMaterial.AMNIOTIC_FLUID = Amniotic fluid
1387+
SampleMaterial.WOUND = Wound
1388+
SampleMaterial.NASAL_SWAB = Nasal swab
1389+
SampleMaterial.OTHER = Other
1390+
SampleMaterial.CORNEA_PM = Cornea p.m
1391+
SampleMaterial.URINE_PM = Urine p.m
1392+
SampleMaterial.OROPHARYNGEAL_SWAB = Oropharyngeal swab
13751393
SampleMaterial.THROAT_ASPIRATE = Throat aspirate
1376-
SampleMaterial.EDTA_WHOLE_BLOOD = EDTA Whole Blood
1377-
SampleMaterial.INTESTINAL_FLUID = Intestinal Fluid
1394+
SampleMaterial.NASOPHARYNGEAL_LAVAGE = Nasopharyngeal lavage
1395+
SampleMaterial.INTESTINAL_FLUID = Intestinal fluid
13781396
SampleMaterial.DUODENUM_FLUID = Duodenum fluid
1379-
SampleMaterial.ASPIRATE = Aspirate
13801397
SampleMaterial.BONE_AND_JOINT = Bone and joint specimen
1381-
SampleMaterial.CATHETER_EXIT_SITE = Catheter exit site
1382-
SampleMaterial.EYE = Eye
1383-
SampleMaterial.GASTRIC_FLUID = Gastric fluid
1384-
SampleMaterial.GENITAL_SWAB = Genital swab
13851398
SampleMaterial.LOWER_RESPIRATORY_TRACT = Lower respiratory tract
1386-
SampleMaterial.PUS = Pus
1387-
SampleMaterial.SEMEN = Semen
1388-
SampleMaterial.SKIN = Skin
13891399
SampleMaterial.SOFT_TISSUE = Soft tissue sample
1390-
SampleMaterial.WOUND = Wound
13911400
SampleMaterial.BIOPSY = Biopsy
13921401
# SampleSource
13931402
SampleSource.ANIMAL=Animal

0 commit comments

Comments
 (0)