SORMAS-Foundation / SORMAS-Project

SORMAS (Surveillance, Outbreak Response Management and Analysis System) is an early warning and management system to fight the spread of infectious diseases.
https://sormas.org
GNU General Public License v3.0
293 stars 143 forks source link

Extend deletion configuration for field-wise deletion #7716

Open MartinWahnschaffe opened 2 years ago

MartinWahnschaffe commented 2 years ago

Situation Description

7008 introduces a configuration for automatic deletion of entities. Besides this we also need to be able to delete data of individual fields.

Pre-requisite #7760

Feature Description

Since the whole logic and the data dictionary are based on the dtos and not the entities, these field paths are relying on the dto as-well.

An example for a field path would be "symptoms.bloodPressureDiastolic" to delete the diastolic blood pressure information of a case (CaseDataDto).

Important: We only allow to delete the value of fields that are either native data types (int, string, enum) or ReferenceDto and are NOT required. Using the Dto instead of directly deleting in the entity or the database has the benefit of validating the dto when saving it.

Next we need to update the deletion process executed by the cron service. When fields are defined, the following needs to be done

Also implement a validation for the configuration that can be executed whenever a configuration changes.

Out of scope

Important: The field-wise deletion implemented here should not cover related persons and visits. Those can be referenced by multiple different core entities with different field-wise deletion rules, so a more complex logic has to be applied.

Additional Information

JaquM-HZI commented 2 years ago

@MartinWahnschaffe @markusmann-vg Please note that dependencies exist or must be defined for the deletion periods of a field. For example, a non-close contact must be deleted earlier if it has not received a quarantine order than a non-close contact with a quarantine order.

markusmann-vg commented 2 years ago

@JaquM-HZI However, those are rules and is far more than taking a deletion duration and trigger the deletion when it's needed to be applied. It's a whole new story/epic to implement rules with dependencies for deletion.

JaquM-HZI commented 2 years ago

@markusmann-vg as discussed, my comment can be ignored