-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple visits for the same patient in CSV upload causes duplicate entries #206
Comments
I thought this was as simple as changing
But I ended up with a few questions about how we normalise our data model. At the moment there is not a unique constraint on NHS number. So even fixing this bug within The relation between So I've probably talked myself into an Either way we also need a way of showing validation errors if the same patient is in the CSV with different details. |
I have a PR up here that doesn't use |
I thought I had made the NHS Number unique and required. If it is not then it should be because there can only be one patient per NHS Number. This does mean though that it will not be possible to save a patient with an invalid NHS number. However, since the same patient will be resubmitted every cohort as they get older (unless they die, I suppose), it needs to be possible that they have multiple records in the AuditCohort table (though only one per cohort, unless the requirement is to store all historical uploads - I am not sure we ever got a clear answer to that). In which case, update_or_create would be the way to go during the upload process. I thought that was how it had been originally written actually. As you say, this would overwrite any previous entries in address or GP practice, but I don't think the NPDA team mind this. As I remember Holly said that even if the patients move centres midway through the audit year, NPDA currently do not track this - they just update the PDU and the new centre inherits all the scores from previous as if their own. |
I wonder if there is value in not normalising I've written up my thoughts on how this interacts with |
Duplicate the final row in
dummy_sheet.csv
and change the visit date.The text was updated successfully, but these errors were encountered: