Skip to content

feat(#3490): Analyzer Manual QC Recording - Spring Boot backend#3499

Open
karansahani78 wants to merge 8 commits into
DIGI-UW:developfrom
karansahani78:feature/analyzer-manual-qc
Open

feat(#3490): Analyzer Manual QC Recording - Spring Boot backend#3499
karansahani78 wants to merge 8 commits into
DIGI-UW:developfrom
karansahani78:feature/analyzer-manual-qc

Conversation

@karansahani78
Copy link
Copy Markdown

Closes #3490

This PR introduces backend support for Analyzer Manual QC Recording.

Changes

  • Added Liquibase migration for analyzer_qc_run table and QC config fields on analyzer
  • Extended Analyzer entity with QC configuration (frequency + required flag)
  • Implemented QC run persistence (Entity, DAO, Service)
  • Added QC status evaluation logic (DAILY, PER_SHIFT, CUSTOM_HOURS)
  • Exposed REST endpoints for QC status, recording, and history
  • Added unit tests covering core QC logic and validation

Note

Local Maven build fails due to unresolved dependencies (org.itech:dataexport-*), which appear unrelated to this change. Changes are scoped to analyzer QC feature.

- Liquibase migration: new analyzer_qc_run table, QC config fields on analyzer
- AnalyzerQcRun entity: UUID-based ID, analyzer FK, result/value/runDate/source
- Analyzer entity: qcFrequencyType, qcFrequencyHours, qcRequired
- AnalyzerQcRunDAO + Impl: lastPass, lastRun, history queries (BaseDAOImpl)
- AnalyzerQcServiceImpl: DAILY/PER_SHIFT/CUSTOM_HOURS status evaluation
- AnalyzerQcRestController: 3 REST endpoints with @PreAuthorize
- Unit tests: 7 cases covering all status rules and validation
Copilot AI review requested due to automatic review settings April 25, 2026 21:32
@karansahani78
Copy link
Copy Markdown
Author

Hi maintainers,
This PR implements backend support for Analyzer Manual QC Recording (#3490).
Please let me know if any changes or improvements are needed.
Thank you!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds backend support for Analyzer Manual QC Recording (#3490) by introducing a new persistence model for manual QC runs, QC scheduling configuration on analyzers, and REST endpoints for status/recording/history.

Changes:

  • Adds Liquibase migration to create analyzer_qc_run and add QC configuration columns to analyzer.
  • Introduces new Analyzer QC domain layer (entity/DAO/service) plus REST controller endpoints.
  • Adds enums and unit tests for QC status evaluation and QC run validation.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
src/test/java/org/openelisglobal/analyzerqc/AnalyzerQcServiceTest.java Unit tests for QC status evaluation and record validation logic.
src/main/resources/liquibase/base-changelog.xml Wires the new analyzer QC Liquibase migration into the master changelog.
src/main/resources/liquibase/analyzer/004-014-create-analyzer-qc-run.xml Creates analyzer_qc_run table and adds analyzer QC config columns.
src/main/java/org/openelisglobal/analyzerqc/valueholder/AnalyzerQcStatus.java DTO for QC status response (status + last run + next due).
src/main/java/org/openelisglobal/analyzerqc/valueholder/AnalyzerQcRun.java New JPA entity representing a manual analyzer QC run.
src/main/java/org/openelisglobal/analyzerqc/service/AnalyzerQcServiceImpl.java Implements QC evaluation rules and QC run recording.
src/main/java/org/openelisglobal/analyzerqc/service/AnalyzerQcService.java Service interface for QC status, recording, and history.
src/main/java/org/openelisglobal/analyzerqc/form/QcRunForm.java Request body model for recording a QC run.
src/main/java/org/openelisglobal/analyzerqc/daoimpl/AnalyzerQcRunDAOImpl.java DAO queries for last pass, last run, and full history.
src/main/java/org/openelisglobal/analyzerqc/dao/AnalyzerQcRunDAO.java DAO interface for QC run persistence/query methods.
src/main/java/org/openelisglobal/analyzerqc/controller/AnalyzerQcRestController.java REST endpoints for QC status, recording, and history.
src/main/java/org/openelisglobal/analyzer/valueholder/QcStatus.java New QC status enum used by the analyzer QC API.
src/main/java/org/openelisglobal/analyzer/valueholder/QcFrequencyType.java New enum for QC frequency rules (daily/shift/custom).
src/main/java/org/openelisglobal/analyzer/valueholder/Analyzer.java Adds QC schedule/required configuration fields to Analyzer entity.

Comment thread src/test/java/org/openelisglobal/analyzerqc/AnalyzerQcServiceTest.java Outdated
Comment thread src/test/java/org/openelisglobal/analyzerqc/AnalyzerQcServiceTest.java Outdated
Comment thread src/main/java/org/openelisglobal/analyzerqc/valueholder/AnalyzerQcRun.java Outdated
@karansahani78
Copy link
Copy Markdown
Author

karansahani78 commented Apr 25, 2026

Thanks for the review.

I’ve addressed the key feedback:

  • mapped sys_user_id properly in the entity (kept DB constraint intact)
  • updated DAO usage to align with BaseDAO
  • fixed duration comparison logic (no truncation)
  • aligned role annotations with project conventions
  • updated unit tests accordingly

Please let me know if anything else needs improvement.

@noel-mugisha
Copy link
Copy Markdown

Some files include unnecessary comments, maybe you can remove some of them.

@karansahani78
Copy link
Copy Markdown
Author

Some files include unnecessary comments, maybe you can remove some of them.

Thanks for the feedback!

Sure, I’ll clean up unnecessary comments and push an update shortly.

@karansahani78
Copy link
Copy Markdown
Author

Thanks for the detailed context on issue #3490 regarding OGC-41 integration.

I realize my current implementation introduces a separate QC run flow, which does not align with the intended architecture using QCResult, QCControlLot, and the existing QCResultCreatedEvent pipeline.

I can refactor this PR to integrate with the existing QCResult flow (instead of maintaining a separate analyzer_qc_run model). Please let me know if you'd prefer this refactor in the current PR or as a new PR.

Happy to align with the OGC-41 design direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Help wanted: Analyzer Manual QC Recording

3 participants