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

Added constraints to models to not allot multiple patients the same bed #1038

Closed
wants to merge 8 commits into from

Conversation

siddnikh
Copy link
Contributor

Proposed Changes

  • Added constraint in ConsultationBed model so no 2 patients can be allotted the same bed.
  • Added constraint in PatientConsultation model so no 2 patients can be allotted the same bed provided both of them are admitted.

Associated Issue

Issue #898

@sonarcloud
Copy link

sonarcloud bot commented Sep 27, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@@ -65,3 +65,10 @@ class ConsultationBed(BaseModel):
start_date = models.DateTimeField(null=False, blank=False)
end_date = models.DateTimeField(null=True, blank=True, default=None)
meta = JSONField(default=dict, blank=True)

class Meta:
constraints = [
Copy link
Member

Choose a reason for hiding this comment

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

Let's take a case where a patient starts off in a regular bed, moves to an ICU, and then moves back to the normal bed, this is practically possible right?

Copy link
Member

Choose a reason for hiding this comment

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

The correct solution should check if there is any patient currently using the bed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, do you suggest I modify the api route when assigning patients to bed along with the added constraints?

@siddnikh
Copy link
Contributor Author

@vigneshhari I tried adding a patient to the same bed, except we don't get that bed listed when we're trying to add another patient.

@gigincg
Copy link
Member

gigincg commented Nov 30, 2022

Already Resolved in #854

cc: @vigneshhari

@gigincg gigincg closed this Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants