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

Support for bulk creating beds inside a location #10585

Open
rithviknishad opened this issue Feb 13, 2025 · 7 comments
Open

Support for bulk creating beds inside a location #10585

rithviknishad opened this issue Feb 13, 2025 · 7 comments
Labels
needs-triage question Further information is requested

Comments

@rithviknishad
Copy link
Member

rithviknishad commented Feb 13, 2025

issues will be assigned once the solution to solve this is approved

Is your feature request related to a problem? Please describe.
When setting up locations of a facility, there'd be multiple beds inside a location. To ease data entry effort, we should be able to bulk create beds (eg. Bed 1, Bed 2, Bed 3, etc...).

Describe the solution you'd like
We could either ask the prefix name from the user and call the API.

Describe alternatives you've considered
We def. can/should explore more better ways to approach this

@tellmeY18 tellmeY18 added this to Care Feb 13, 2025
@tellmeY18 tellmeY18 moved this to Triage in Care Feb 13, 2025
@rajku-dev
Copy link
Contributor

i would like to work on this.

@rithviknishad
Copy link
Member Author

issues will be assigned once the solution to solve this is approved; do share your thoughts on how to solve this.

@AdityaJ2305
Copy link
Contributor

Hmm, as much as I understood, we can have the prefix name from user and also starting and ending numbering label for example A1 to A10. And prefix 'Bed' and push the array from Bed A1 to Bed A10
It could be just number as well

@github-actions github-actions bot added needs-triage question Further information is requested labels Feb 13, 2025
@rajku-dev
Copy link
Contributor

rajku-dev commented Feb 13, 2025

Approach

  • For different locations within a facility (floors, ward, etc) can have different variety of beds (ICU, Standard etc.)

  • In location form we can add a Input field for user to select the type of bed , and conditional field to select number of beds of selected category (by default add 1 for the type of bed entered)

  • show a real-time preview of how the beds will be updated (ICU-1, ICU-2, ICU-3 etc)

  • we don't require to send the array in network request as it will create memory overhead, we can only send type of bed and number to add in payload

  • then make api call, backend will update database to add new beds for that location

@Rustix69
Copy link
Contributor

Approach for Dynamic Bed Naming & Optimized API Request

1. User Input Fields in Location Form

  • Bed Type Selection: User can select the type of bed (e.g., ICU, Standard, etc.).
  • Number of Beds: A field to specify how many beds to add (defaults to 1 for each type).
  • Real-Time Preview: Dynamically generate a preview of bed names based on existing beds (e.g., ICU-1, ICU-2, ICU-3).

2. Real-Time Bed Name Preview

  • Before submitting, users see a preview of the beds that will be created.
  • If 3 ICU beds already exist (ICU-1, ICU-2, ICU-3), adding 3 more will show:
  • If no beds exist, the preview will start from ICU-1.

3. Optimized API Request Structure

  • Do not send the entire list of generated bed names to avoid memory overhead.
  • Only send bed type and count in the payload.
  • Example API Payload:
{
  "location_id": "12345",
  "bed_type": "ICU",
  "count": 3
}

4. Backend Processing & Database Update

  • Backend fetches the existing beds of the selected type for that location.
  • Determines the next available bed number.
  • Generates and inserts new beds dynamically.
  • Updates the parent location records accordingly.

5. Validation Rules

  • Ensure bed numbers are sequential and unique.
  • Restrict the maximum number of beds per location (if applicable).
  • Prevent duplicate names from being created.

@hrit2773
Copy link
Contributor

@rithviknishad is the backend open for contributions now

@hrit2773
Copy link
Contributor

@rithviknishad we can ask the user to add multiple beds once the user selects location form as bed. We can create a separate model for Bed in the backend with fields bed_type, number_of_units, location referencing to existing facilityLocation model or we can also create a JSON field of beds in FacilityLocation Model anything can be preferred. And it will be better to create a separate model for Bed Types also which would allow admin to add default bed types. In frontend we can show a select field with all those bed types as choices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage question Further information is requested
Projects
Status: Triage
Development

No branches or pull requests

5 participants