CARDS-2021: PREMs: Automatically delete submitted survey responses older than one year - #1325
CARDS-2021: PREMs: Automatically delete submitted survey responses older than one year#1325veronikaslc wants to merge 3 commits into
Conversation
4c162e9 to
2a907db
Compare
| // select the data forms | ||
| "select distinct dataForm.*" | ||
| + " from [cards:Form] as dataForm" | ||
| // belonging to a visit | ||
| + " inner join [cards:Form] as visitInformation on visitInformation.subject = dataForm.subject" | ||
| + " inner join [cards:Answer] as submitted on isdescendantnode(submitted, visitInformation)" | ||
| + " where" | ||
| // link to the correct Visit Information questionnaire | ||
| + " visitInformation.questionnaire = '%1$s'" | ||
| // the data form was last modified by the patient before the allowed timeframe | ||
| + " and dataForm.[jcr:lastModified] < '%2$s'" | ||
| // the visit is submitted | ||
| + " and submitted.question = '%3$s'" | ||
| + " and submitted.value = 1" | ||
| // exclude the Visit Information form itself | ||
| + " and dataForm.questionnaire <> '%1$s'", |
There was a problem hiding this comment.
This query can probably be made more efficient by using looking for the SUBMITTED status flag and replacing the use of isdescendantnode with the form property (if still necessary).
There was a problem hiding this comment.
Not sure I got the optimisation of isdescendantnode part. Also did you mean the status flag on the form? May be the proposed change would be helpful
bbde0f2 to
da8bab4
Compare
sdumitriu
left a comment
There was a problem hiding this comment.
This should be moved in the patient-portal module.
| * @version $Id$ | ||
| * @since 0.9.6 | ||
| */ | ||
| @Designate(ocd = SubmittedFormsCleanupScheduler.Config.class, factory = true) |
There was a problem hiding this comment.
This doesn't need more than one instance running, so it shouldn't be using a factory.
Or, alternatively, add another setting in the Config below for the questionnaires to delete, so we could only have different deletion policies for different data.
|
Rebased and addressed most of the comments except query optimisation. |
7ee8b09 to
42cf98e
Compare
…der than one year
…der than one year Fixed tag
…der than one year Moved files to the patient-portal module; Removed factory usage from the scheduler
42cf98e to
d658b39
Compare
No description provided.