Tests are categorised and AST structure (DrugSusceptibility) enhancement#13961
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds pathogen test categories and metadata to PathogenTestType (with legacy non-selectability), replaces MIC-based drug susceptibility with method/zone-diameter/surveillance across API/backend/DB, and updates UI components, i18n, and tests to support the new structures. ChangesPathogen Test Categorization & Drug Susceptibility Transformation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@sormas-backend/src/main/resources/sql/sormas_schema.sql`:
- Around line 16055-16158: The migration only adds new per-drug columns (e.g.,
amikacinmethod, amikacinzonediameter, amikacinsurveillance and their _history
counterparts) but does not backfill existing MIC/susceptibility values, so
existing records will show NULL; add a data migration (run before switching the
mapper/UI) that copies legacy AST/MIC and susceptibility fields into the new
per-drug columns for both drugsusceptibility and drugsusceptibility_history.
Implement SQL UPDATEs that, for each drug (e.g., amikacin, rifampicin,
ciprofloxacin, etc.), set <drug>method, <drug>zonediameter, <drug>surveillance
from the existing legacy MIC/susceptibility source columns (only where the new
column IS NULL to avoid overwriting), wrap in a transaction, handle NULLs/type
conversions as needed, and include the same backfill for the _history table so
audit trail values are preserved before the application starts reading the new
columns.
In
`@sormas-ui/src/main/java/de/symeda/sormas/ui/samples/components/TestMethodComponent.java`:
- Around line 392-394: In TestMethodComponent.setDto ensure the savedCategory
returned by PathogenTestType.getCategory(savedType) is included in
testCategoryField's items before calling
testCategoryField.setValue(savedCategory): call getVisibleTestCategories(...) to
obtain the current List, if savedCategory is not contained add it to that list
(or create a new list including it), then call testCategoryField.setItems(...)
(or set the field’s container) and only then call
testCategoryField.setValue(savedCategory); this ensures legacy/merged categories
not normally returned by getVisibleTestCategories are visible in the ComboBox.
In
`@sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java`:
- Around line 258-268: The code fails to compile because Unit.PERCENTAGE is used
in DrugSusceptibilityForm.addMicField (and other setWidth calls) without
importing the Sizeable.Unit enum; fix by either adding the proper import (e.g.,
import com.vaadin.server.Sizeable.Unit;) at the top of DrugSusceptibilityForm or
by qualifying the enum usage as com.vaadin.server.Sizeable.Unit.PERCENTAGE in
the setWidth(...) calls (e.g., in addMicField and the other methods that call
setWidth(100, Unit.PERCENTAGE)).
In `@sormas-ui/src/main/java/de/symeda/sormas/ui/utils/FormComponent.java`:
- Around line 321-331: updateTestTypeItemsByCategory currently builds the list
from Diseases.DiseasesConfiguration.getVisibleValues(...) which omits
disease-hidden enum values, so a saved retainType can be dropped; update the
method so that after collecting visible values you explicitly ensure retainType
(PathogenTestType retainType) is present: if retainType != null and not already
in the filtered list and it matches the selected category (or category is null)
then add retainType to the collection before sorting/setting items on comboBox
(then keep the existing comboBox.setValue(retainType) behavior if present in the
final list); reference updateTestTypeItemsByCategory, retainType,
Diseases.DiseasesConfiguration.getVisibleValues, PathogenTestType,
comboBox.setItems and comboBox.setValue.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c7ea3355-c5a8-4001-8332-9db1218cbf4b
📒 Files selected for processing (19)
sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.javasormas-api/src/main/java/de/symeda/sormas/api/i18n/Strings.javasormas-api/src/main/java/de/symeda/sormas/api/sample/NotSelectableForNewTests.javasormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenTestCategory.javasormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenTestCategoryRel.javasormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenTestType.javasormas-api/src/main/java/de/symeda/sormas/api/therapy/DrugSusceptibilityDto.javasormas-api/src/main/java/de/symeda/sormas/api/therapy/SusceptibilityMethod.javasormas-api/src/main/java/de/symeda/sormas/api/therapy/SusceptibilitySurveillanceType.javasormas-api/src/main/resources/captions.propertiessormas-api/src/main/resources/enum.propertiessormas-api/src/main/resources/strings.propertiessormas-api/src/test/java/de/symeda/sormas/api/sample/PathogenTestTypeTest.javasormas-backend/src/main/java/de/symeda/sormas/backend/therapy/DrugSusceptibility.javasormas-backend/src/main/java/de/symeda/sormas/backend/therapy/DrugSusceptibilityMapper.javasormas-backend/src/main/resources/sql/sormas_schema.sqlsormas-ui/src/main/java/de/symeda/sormas/ui/samples/components/TestMethodComponent.javasormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.javasormas-ui/src/main/java/de/symeda/sormas/ui/utils/FormComponent.java
Fixes #13951, #13956
Summary by CodeRabbit
New Features
Database
Tests