Skip to content
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

Eatyourpeas/issue538 #726

Merged
merged 12 commits into from
Jan 8, 2024
Merged

Eatyourpeas/issue538 #726

merged 12 commits into from
Jan 8, 2024

Conversation

eatyourpeas
Copy link
Member

Overview

This fixes 4 things to do with the workflow for transferring children between centres.

  1. remove E12 users from the email cc when the transfer request is sent
  2. if the transfer is refused and the child is returned to the original trust, fix the bug that the original sending organisation is added to list of historical trusts.
  3. change the reject/accept modal to read 'I confirm' rather than the more ambiguous 'I accept'
  4. Remove the current organisation from the dropdown which appears when the transfer button is pressed. This prevents the user from transferring a child into the organisation where they already are.

Code changes

Changes are made in 3 files
case_views.py - this deletes the new site object created if the transfer is rejected, and reanimates the previous record.

registration_views: removes members of the RCPCH audit team from the cc in tranfer requests email. removes current organisation from transfer organisation list

case_table: change the wording in the modal button

Documentation changes (done or required as a result of this PR)

Bug fix, so no implications for documentation

Related Issues

#538

Mentions

@mentions of the person or team responsible for reviewing proposed changes.
@anchit_chandran @pacharanero

@eatyourpeas eatyourpeas added bug Something isn't working user-interface Issues which are primarily UI fixes priority: high High Priority Work - Max 3 Items labels Dec 20, 2023
@eatyourpeas
Copy link
Member Author

Forgive me for piggybacking these changes on the back of this PR. It is related and equally urgent, so thought it might acceptable to couple the two issues.

In addition to the items/fixes listed in the PR above, subsequent commits have:

  1. removed a filter bug where local health boards did not see their organisations' users
  2. removed the empty brackets in the footer segment in case form

These items are in templates/epilepsy12/forms/case.html and views/user_management_views.py

The main fix is a bigger issue though:

The problem

Currently if a child is transferred between centres, if the transfer is rejected (or sometimes accepted), the relationships it has with other centres in the Assessment tab which track general paediatric, neurology and surgical care are lost.

Background

The Site model, as the middle table in the M2M relationship between Case and Organisation, stores information about the relationship a child has with an organisation. For each organisation involved in a child's care, either current or historic, a record is stored in the Site model. Flags document if a Site is actively involved in care, and the nature of the relationship (lead site, general paediatric/neuro or surgical site). To build a chronology of sites that have historically led the care of a child's epilepsy, it is possible to have multiple records for different organisations where lead site status is true, but active involvement status is false. These appear in the registration form as historical lead sites if they exist.

By contrast, any other relationships the site may have (not lead status, but provide general paediatric, neurology or epilepsy surgery care) are stored only once - no chronology for these exist. If a child moves its surgical care, a new record is created reflecting the change and the old one deleted.

It becomes more complicated if:

  1. A lead centre transfers lead centre status to another organisation which is already involved in the care of the child
  2. A lead centre transfers lead centre status to another organisation but continues to offer general paediatric, neurology or surgical care
  3. Any requests for transfer are then rejected - as everything needs to be put back the way it was before the request was made

Having spent some time looking at these edge cases I am fairly sure this now works the way it was intended but really we need some tests. I have not had time so far to add these, and in the interests of urgency, am submitting this fix , with a view to adding some tests later on. I am really happy to help with the review of this PR as it is larger and more complicated than I would like.

Copy link
Member

@pacharanero pacharanero left a comment

Choose a reason for hiding this comment

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

Reviewed with @dc2007git and @eatyourpeas - tested the changes to lead site transfer logic with success.
Closes #538

@pacharanero pacharanero merged commit 0555054 into development Jan 8, 2024
1 check passed
@pacharanero pacharanero deleted the eatyourpeas/issue538 branch January 8, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: high High Priority Work - Max 3 Items user-interface Issues which are primarily UI fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants