Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Internal clients functionality #183

Merged
merged 80 commits into from
May 7, 2020
Merged

Internal clients functionality #183

merged 80 commits into from
May 7, 2020

Conversation

xispa
Copy link
Member

@xispa xispa commented Apr 23, 2020

Description of the issue/feature this PR addresses

This Pull Request adds Internal Clients functionality. Internal Clients differ from "standard" (or external) clients so, the formers share Patients, Batches (Cases) and Doctors. Therefore, senaite.health becomes suitable to fit with the needs of both private clinics and public reference laboratories:

Captura de 2020-04-29 19-35-10

The schema above applies for Batches and Doctors as well. A new item "Internal Clients" has been added in the left-hand navigation bar. So any client created inside this folder will be considered as Internal and therefore, all its Patients, Doctors and Cases will be visible (and shareable, e.g. on Sample creation) by other Internal Clients.

Information from Clients created inside "Clients" folder, won't be shared and will remain private, so their Patients, Cases and Doctors will become private.

For clearliness, some icons have been added in listings, as well as viewlets to notify the user about the sharing policy. These icons and viewlets are not displayed to client contacts from external clients to prevent them to be confused (at the end, their data will only be private and there is no chance to make it shareable).

Captura de 2020-04-29 19-41-56

Captura de 2020-04-29 19-43-41

Additional notes

  • Samples are never shared
  • Assignment of a Client (Primary Referrer) to a Patient is now required
  • Assignment of a Client to a Doctor is now required
  • Assignment of a Client to a Case is now required
  • Functionality bound to workflow permissions, so conditional queries are required only because LabClerks (or LabMan) have access to all them. External Contacts will never be able to reach a Patient (or any other shareable type) that does not belong to them, and if they try to directly use the url that points to the shareable object, they will get an "Insufficient Privileges" response.

Tips for functional testing

  1. Any of the shareable types (Patient, Case, Doctor) can be created from root's folder (/patients, /doctors, /batches). If so, the object is moved inside the proper client on creation.
  2. In Add Batch (Case) form, Patient, Client and Doctor fields are filtered in accordance with the type of the selected Client: if internal, items from all internal clients are displayed. Otherwise, only items that belong to the selected Client are displayed.
  3. Once created, the Client for Patient, Doctor and Cases cannot be changed.
  4. In Edit Batch form, Patient and Doctor fields are filtered in accordance with the type of Client the batch was assigned to.
  5. In Add Sample view, the shareable types are filtered in accordance with the type of Client selected.
  6. In Add Sample view, when a Batch is selected, the fields "Patient" and "Doctor" are automatically filled in accordance.
  7. In Add Sample view, fields for shareable types are filtered accordingly.
  8. If logged in as Internal Client's contact, user can use shareable types from other Internal Clients (e.g. while creating a Sample)
  9. Internal Client contacts can view and modify shareable types, even if they do not belong to the client the contact belongs to. Remember the Client (that will always be the "Owner") cannot be changed.
  10. External Client contacts can only view and modify their own Patients, Doctors and Cases.

Current behavior before PR

The only way to share Patients, Doctors and Batches was to create them without a Client assigned. In such case, all Clients were able to see and use them, regardless of their "type".

Desired behavior after PR is merged

Two types of clients: "External Client" and "Internal Client". Patients, Cases and Doctors from internal clients are shared among them, while keeping their Ownership (Referrer). Patient, Cases and Doctors from External Clients cannot be shared at all and remain private.

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

xispa added 30 commits April 18, 2020 14:55
@xispa xispa requested review from Espurna and ramonski April 29, 2020 17:48
@xispa xispa changed the title Internal clients Internal clients functionality Apr 29, 2020
@Espurna
Copy link

Espurna commented Apr 29, 2020

What happens to Patients that are not assigned to a Client after the upgrade? Should they be moved inside a fake Client named as "our-lab"?

@Espurna
Copy link

Espurna commented Apr 29, 2020

External Client Contacts seems to not be able to select a Primary Sample during the Sample creation. Is this done on purpose?

@xispa
Copy link
Member Author

xispa commented Apr 29, 2020

What happens to Patients that are not assigned to a Client after the upgrade? Should they be moved inside a fake Client named as "our-lab"?

With the previous upgrade step 1.2.3, all Patients were moved to their corresponding Clients. Only those patients assigned to different clients (directly or indirectly via sample or case), weren't moved. These are the Patients that were left in /patients root folder, so neither clients nor internal clients will be able to use them anymore in new Samples. Nevertheless, the record and permissions are kept, so users will be able to see them from either samples or batches those patients are assigned to.

Not sure what to do with them (since they are directly or indirectly assigned to different clients already and we assume that clients created until date were of type "external"). I think we cannot resolve the issue automatically, but I think that at least, we should display an alert icon in patients listing (visible to labman + labclerk only) so lab personnel become aware of those "orphan" patients. Same same for clinical cases and doctors. At this point, an option would be to allow them to "manually" assign the Client, even if the Patient has samples that belong to another.... not sure

@xispa
Copy link
Member Author

xispa commented Apr 29, 2020

External Client Contacts seems to not be able to select a Primary Sample during the Sample creation. Is this done on purpose?

Ummm, not done on purpose afak. Maybe is an issue in core? Will check

@Espurna Espurna merged commit 044a4a2 into master May 7, 2020
@Espurna Espurna deleted the internal_clients branch May 7, 2020 19:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

2 participants