Skip to content

Clean DataHealth after Preview & Refactoring on how to deal with SideEffencts on Study State changes - #41

Merged
westei merged 2 commits into
developfrom
umm/refactor-study-state-change-sideeffect-refactoring
Mar 6, 2026
Merged

Clean DataHealth after Preview & Refactoring on how to deal with SideEffencts on Study State changes#41
westei merged 2 commits into
developfrom
umm/refactor-study-state-change-sideeffect-refactoring

Conversation

@westei

@westei westei commented Feb 27, 2026

Copy link
Copy Markdown
Member

Feature:
* This adds support for deleting Data Health information in case a study is set back to DRAFT after data where collected during the PREVIEW state

Refactoring:

* StudyService does no longer implement all side effects when the study state is changed. It creates `StudyStateChangedEvent` and publishes them as Spring `ApplicationEvent`
* All affected Services now provide `@EventListener` that perform any necessary side effects. This includes the `IntegrationService`, `InterventionService` and `ObservationService`
* NOTE: The deletion of data in the ElasticIndex and data health data in the OccurredObservationRepository when a Study is transitioned from the PREVIEW to the DRAFT state is still done in the StudyService
* Adapted the UnitTest to validate that the events are triggered

    * This adds support for deleting Data Health information in case a study is set back to DRAFT after data where collected during the PREVIEW state

Refactoring:

    * StudyService does no longer implement all side effects when the study state is changed. It creates `StudyStateChangedEvent` and publishes them as Spring `ApplicationEvent`
    * All affected Services now provide `@EventListener` that perform any necessary side effects. This includes the `IntegrationService`, `InterventionService` and `ObservationService`
    * NOTE: The deletion of data in the ElasticIndex and data health data in the OccurredObservationRepository when a Study is transitioned from the PREVIEW to the DRAFT state is still done in the StudyService
    * Adapted the UnitTest to validate that the events are triggered
@westei
westei requested a review from janoliver20 February 27, 2026 11:31
@westei westei self-assigned this Feb 27, 2026

@janoliver20 janoliver20 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@github-actions

github-actions Bot commented Mar 6, 2026

Copy link
Copy Markdown

Test Results

151 tests  +2   150 ✅ +2   1m 48s ⏱️ -6s
 51 suites +1     1 💤 ±0 
 51 files   +1     0 ❌ ±0 

Results for commit 4cde663. ± Comparison against base commit 96f9d0c.

@westei
westei merged commit aeddc3b into develop Mar 6, 2026
5 checks passed
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.

2 participants