rcpch / national-paediatric-diabetes-audit

A django application to audit the care of children and young people with diabetes in England and Wales.
0 stars 1 forks source link

Delete old submission (including patients) after CSV upload successful #336

Open mbarton opened 3 weeks ago

mbarton commented 3 weeks ago

Now we can have multiple patients with the same NHS number (#324) we can be a bit safer in how we handle CSV uploads.

If we move the code to delete the old submission to after we have fully validated the CSV and written all the data, an unhandled error during the process would lead to the new submission being inactive but with the old one preserved. With the behaviour as it stands you'll end up with only the potentially half uploaded new submission.

I wonder if for full safety we want to delete the old submission after a given period of time rather than straight away? This is potentially easier said than done given we don't have a periodic scheduled task system set up yet.

We certainly want to retain the last but one CSV upload.