Skip to content

Commit f3bf8f0

Browse files
authored
Merge branch 'development' into bugfix-14058-ipi_lab_message_reference_laboratory
2 parents 2e748bb + 9a59c61 commit f3bf8f0

16 files changed

Lines changed: 235 additions & 87 deletions

File tree

sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2427,7 +2427,6 @@ public interface Captions {
24272427
String PathogenTest_quantitativeUnit = "PathogenTest.quantitativeUnit";
24282428
String PathogenTest_quantitativeValue = "PathogenTest.quantitativeValue";
24292429
String PathogenTest_reportDate = "PathogenTest.reportDate";
2430-
String PathogenTest_resultDetails = "PathogenTest.resultDetails";
24312430
String PathogenTest_retestRequested = "PathogenTest.retestRequested";
24322431
String PathogenTest_rifampicinResistant = "PathogenTest.rifampicinResistant";
24332432
String PathogenTest_rsv_testedDiseaseVariant = "PathogenTest.rsv.testedDiseaseVariant";

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ public class PathogenTestDto extends PseudonymizableDto {
128128
public static final String ANTIBODY_TITRE = "antibodyTitre";
129129
public static final String PERFORMED_BY_REFERENCE_LABORATORY = "performedByReferenceLaboratory";
130130
public static final String RETEST_REQUESTED = "retestRequested";
131-
public static final String RESULT_DETAILS = "resultDetails";
132131
public static final String QUANTITATIVE_VALUE = "quantitativeValue";
133132
public static final String QUANTITATIVE_UNIT = "quantitativeUnit";
134133
public static final String QUANTITATIVE_BOOLEAN = "quantitativeBoolean";
@@ -336,10 +335,6 @@ public class PathogenTestDto extends PseudonymizableDto {
336335
private Boolean performedByReferenceLaboratory;
337336
// defaulting this test to false.
338337
private Boolean retestRequested = false;
339-
@Diseases({
340-
Disease.MALARIA })
341-
@Size(max = FieldConstraints.CHARACTER_LIMIT_DEFAULT, message = Validations.textTooLong)
342-
private String resultDetails;
343338

344339
// Generic quantitative result fields, shown per the test method's ResultValueType (issue #13952).
345340
private Float quantitativeValue;
@@ -970,14 +965,6 @@ public void setRetestRequested(Boolean retestRequested) {
970965
this.retestRequested = retestRequested;
971966
}
972967

973-
public String getResultDetails() {
974-
return resultDetails;
975-
}
976-
977-
public void setResultDetails(String resultDetails) {
978-
this.resultDetails = resultDetails;
979-
}
980-
981968
public String getSerotypeText() {
982969
return serotypeText;
983970
}

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,12 @@ public enum PathogenTestType {
7171
// for every disease per #13951. The legacy ENZYME_LINKED_IMMUNOSORBENT_ASSAY is now
7272
// @NotSelectableForNewTests so historic records still render and case-classification rules
7373
// referencing IGM_/IGG_SERUM_ANTIBODY continue to fire (they bind to the same enum constants).
74-
@Diseases(value = {
75-
Disease.SALMONELLOSIS }, hide = true)
7674
@PathogenTestCategoryRel(PathogenTestCategory.SEROLOGICAL_TESTS)
7775
@ResultValueTypeRel({
7876
ResultValueType.QUALITATIVE,
7977
ResultValueType.NUMERIC })
8078
IGM_SERUM_ANTIBODY,
8179

82-
@Diseases(value = {
83-
Disease.SALMONELLOSIS }, hide = true)
8480
@PathogenTestCategoryRel(PathogenTestCategory.SEROLOGICAL_TESTS)
8581
@ResultValueTypeRel({
8682
ResultValueType.QUALITATIVE,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,6 @@ PathogenTest.tubeMitogeneGT10=Tube Mitogen >10
20092009
PathogenTest.antibodyTitre=Antibody titre
20102010
PathogenTest.performedByReferenceLaboratory=Performed by reference laboratory
20112011
PathogenTest.retestRequested=Retest requested
2012-
PathogenTest.resultDetails=Result details
20132012
PathogenTest.quantitativeValue=Value
20142013
PathogenTest.quantitativeUnit=Unit
20152014
PathogenTest.quantitativeBoolean=Detected

sormas-backend/src/main/java/de/symeda/sormas/backend/sample/PathogenTest.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ public class PathogenTest extends DeletableAdo {
189189
private String antibodyTitre;
190190
private Boolean performedByReferenceLaboratory;
191191
private Boolean retestRequested;
192-
private String resultDetails;
193192
private Float quantitativeValue;
194193
private String quantitativeUnit;
195194
private YesNoUnknown quantitativeBoolean;
@@ -814,14 +813,6 @@ public void setRetestRequested(Boolean retestRequested) {
814813
this.retestRequested = retestRequested;
815814
}
816815

817-
public String getResultDetails() {
818-
return resultDetails;
819-
}
820-
821-
public void setResultDetails(String resultDetails) {
822-
this.resultDetails = resultDetails;
823-
}
824-
825816
public String getSpecieText() {
826817
return specieText;
827818
}

sormas-backend/src/main/java/de/symeda/sormas/backend/sample/PathogenTestFacadeEjb.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ public static PathogenTestDto toDto(PathogenTest source) {
348348
target.setAntibodyTitre(source.getAntibodyTitre());
349349
target.setPerformedByReferenceLaboratory(source.getPerformedByReferenceLaboratory());
350350
target.setRetestRequested(source.getRetestRequested());
351-
target.setResultDetails(source.getResultDetails());
352351
target.setQuantitativeValue(source.getQuantitativeValue());
353352
target.setQuantitativeUnit(source.getQuantitativeUnit());
354353
target.setQuantitativeBoolean(source.getQuantitativeBoolean());
@@ -678,7 +677,6 @@ public PathogenTest fillOrBuildEntity(@NotNull PathogenTestDto source, PathogenT
678677
target.setAntibodyTitre(source.getAntibodyTitre());
679678
target.setPerformedByReferenceLaboratory(source.getPerformedByReferenceLaboratory());
680679
target.setRetestRequested(source.getRetestRequested());
681-
target.setResultDetails(source.getResultDetails());
682680
target.setQuantitativeValue(source.getQuantitativeValue());
683681
target.setQuantitativeUnit(source.getQuantitativeUnit());
684682
target.setQuantitativeBoolean(source.getQuantitativeBoolean());

sormas-backend/src/main/resources/sql/sormas_schema.sql

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16360,7 +16360,7 @@ BEGIN
1636016360
WHERE quantitativetext IS NOT NULL AND quantitativetext <> ''
1636116361
AND length(CASE WHEN testresulttext IS NULL OR testresulttext = '' THEN quantitativetext ELSE testresulttext || E'\n' || quantitativetext END) > 4096;
1636216362
IF truncated_count > 0 THEN
16363-
RAISE NOTICE 'Migration 640: % pathogentest row(s) had their preserved quantitativetext truncated to fit varchar(4096).', truncated_count;
16363+
RAISE NOTICE 'Migration 639: % pathogentest row(s) had their preserved quantitativetext truncated to fit varchar(4096).', truncated_count;
1636416364
END IF;
1636516365
UPDATE pathogentest
1636616366
SET testresulttext = LEFT(CASE
@@ -16374,7 +16374,7 @@ BEGIN
1637416374
WHERE quantitativetext IS NOT NULL AND quantitativetext <> ''
1637516375
AND length(CASE WHEN testresulttext IS NULL OR testresulttext = '' THEN quantitativetext ELSE testresulttext || E'\n' || quantitativetext END) > 4096;
1637616376
IF truncated_count > 0 THEN
16377-
RAISE NOTICE 'Migration 640: % pathogentest_history row(s) had their preserved quantitativetext truncated to fit varchar(4096).', truncated_count;
16377+
RAISE NOTICE 'Migration 639: % pathogentest_history row(s) had their preserved quantitativetext truncated to fit varchar(4096).', truncated_count;
1637816378
END IF;
1637916379
UPDATE pathogentest_history
1638016380
SET testresulttext = LEFT(CASE
@@ -16402,11 +16402,70 @@ ALTER TABLE testreport_history ADD COLUMN IF NOT EXISTS fourfoldincreaseantibody
1640216402
INSERT INTO schema_version (version_number, comment) VALUES (641, 'Malaria and Dengue DD and Lab message processing fixes');
1640316403

1640416404

16405-
-- 2025-06-36 Performed by reference laboratory missing for lab messages
16405+
-- 2025-06-26 Performed by reference laboratory missing for lab messages
1640616406

1640716407
ALTER TABLE testreport ADD COLUMN IF NOT EXISTS performedbyreferencelaboratory boolean;
1640816408
ALTER TABLE testreport_history ADD COLUMN IF NOT EXISTS performedbyreferencelaboratory boolean;
1640916409

1641016410
INSERT INTO schema_version (version_number, comment) VALUES (642, '#14058 - Performed by reference laboratory not toggled');
1641116411

16412+
-- 2026-06-29 Remove Malaria-specific "Result details" pathogen test field (issue #14016)
16413+
-- The Malaria resultdetails field duplicated the generic "Test result details" (testresulttext) field on the
16414+
-- pathogen test form. Drop it and fold any captured value into testresulttext so no free-text result is lost.
16415+
-- Both pathogentest and pathogentest_history are migrated.
16416+
--
16417+
-- versioning_trigger on pathogentest mirrors every UPDATE into pathogentest_history & disable it for the
16418+
-- migration window so the backfill does not inject phantom audit rows, and re-enable when done.
16419+
--
16420+
-- testresulttext is varchar(4096) while resultdetails is varchar(255): LEFT(..., 4096) guards against a
16421+
-- near-full testresulttext overflowing the column once resultdetails is appended.
16422+
ALTER TABLE pathogentest DISABLE TRIGGER versioning_trigger;
16423+
DO $$
16424+
DECLARE
16425+
truncated_count integer;
16426+
BEGIN
16427+
IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = current_schema() AND table_name = 'pathogentest' AND column_name = 'resultdetails') THEN
16428+
SELECT count(*) INTO truncated_count FROM pathogentest
16429+
WHERE resultdetails IS NOT NULL AND resultdetails <> ''
16430+
AND length(CASE
16431+
WHEN testresulttext IS NULL OR testresulttext = '' THEN resultdetails
16432+
WHEN testresulttext = resultdetails THEN testresulttext
16433+
ELSE testresulttext || E'\n' || resultdetails
16434+
END) > 4096;
16435+
IF truncated_count > 0 THEN
16436+
RAISE NOTICE 'Migration 642: % pathogentest row(s) had their preserved resultdetails truncated to fit varchar(4096).', truncated_count;
16437+
END IF;
16438+
UPDATE pathogentest
16439+
SET testresulttext = LEFT(CASE
16440+
WHEN testresulttext IS NULL OR testresulttext = '' THEN resultdetails
16441+
WHEN testresulttext = resultdetails THEN testresulttext
16442+
ELSE testresulttext || E'\n' || resultdetails
16443+
END, 4096)
16444+
WHERE resultdetails IS NOT NULL AND resultdetails <> '';
16445+
END IF;
16446+
IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = current_schema() AND table_name = 'pathogentest_history' AND column_name = 'resultdetails') THEN
16447+
SELECT count(*) INTO truncated_count FROM pathogentest_history
16448+
WHERE resultdetails IS NOT NULL AND resultdetails <> ''
16449+
AND length(CASE
16450+
WHEN testresulttext IS NULL OR testresulttext = '' THEN resultdetails
16451+
WHEN testresulttext = resultdetails THEN testresulttext
16452+
ELSE testresulttext || E'\n' || resultdetails
16453+
END) > 4096;
16454+
IF truncated_count > 0 THEN
16455+
RAISE NOTICE 'Migration 642: % pathogentest_history row(s) had their preserved resultdetails truncated to fit varchar(4096).', truncated_count;
16456+
END IF;
16457+
UPDATE pathogentest_history
16458+
SET testresulttext = LEFT(CASE
16459+
WHEN testresulttext IS NULL OR testresulttext = '' THEN resultdetails
16460+
WHEN testresulttext = resultdetails THEN testresulttext
16461+
ELSE testresulttext || E'\n' || resultdetails
16462+
END, 4096)
16463+
WHERE resultdetails IS NOT NULL AND resultdetails <> '';
16464+
END IF;
16465+
END $$;
16466+
ALTER TABLE pathogentest DROP COLUMN IF EXISTS resultdetails;
16467+
ALTER TABLE pathogentest_history DROP COLUMN IF EXISTS resultdetails;
16468+
ALTER TABLE pathogentest ENABLE TRIGGER versioning_trigger;
16469+
INSERT INTO schema_version (version_number, comment) VALUES (643, 'Remove Malaria-specific result details pathogen test column, preserving values into testresulttext issue #14016');
16470+
1641216471
-- *** Insert new sql commands BEFORE this line. Remember to always consider _history tables. ***

sormas-rest/swagger.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22780,11 +22780,6 @@
2278022780
"type" : "string",
2278122781
"format" : "date-time"
2278222782
},
22783-
"resultDetails" : {
22784-
"type" : "string",
22785-
"maxLength" : 512,
22786-
"minLength" : 0
22787-
},
2278822783
"retestRequested" : {
2278922784
"type" : "boolean"
2279022785
},

sormas-rest/swagger.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23091,10 +23091,6 @@ components:
2309123091
reportDate:
2309223092
type: string
2309323093
format: date-time
23094-
resultDetails:
23095-
type: string
23096-
maxLength: 512
23097-
minLength: 0
2309823094
retestRequested:
2309923095
type: boolean
2310023096
rifampicinResistant:

sormas-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestForm.java

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@
2121
import static de.symeda.sormas.ui.utils.LayoutUtil.loc;
2222

2323
import java.util.ArrayList;
24-
import java.util.Collections;
2524
import java.util.Date;
2625
import java.util.List;
2726
import java.util.function.Supplier;
28-
import java.util.stream.Collectors;
2927

3028
import com.vaadin.shared.Registration;
3129
import com.vaadin.ui.Component;
@@ -339,30 +337,19 @@ public void preCommit(CommitEvent commitEvent) throws CommitException {
339337
try {
340338
comp.validate();
341339
} catch (InvalidValueException e) {
342-
collectCauses(e, allCauses);
340+
FormComponent.collectCauses(e, allCauses);
343341
}
344342
}
345343

346344
if (activeSection != null) {
347345
try {
348346
activeSection.validate();
349347
} catch (InvalidValueException e) {
350-
collectCauses(e, allCauses);
348+
FormComponent.collectCauses(e, allCauses);
351349
}
352350
}
353351

354-
if (!allCauses.isEmpty()) {
355-
String joinedCaptions = allCauses.stream().map(InvalidValueException::getMessage).collect(Collectors.joining(", "));
356-
throw new InvalidValueException(joinedCaptions, allCauses.toArray(new InvalidValueException[0]));
357-
}
358-
}
359-
360-
private static void collectCauses(InvalidValueException e, List<InvalidValueException> target) {
361-
if (e.getCauses().length > 0) {
362-
Collections.addAll(target, e.getCauses());
363-
} else {
364-
target.add(e);
365-
}
352+
FormComponent.throwCombined(allCauses);
366353
}
367354

368355
@Override

0 commit comments

Comments
 (0)