Added temperature field to patient visit vitals
name: Feature Request
about: Suggest a new feature or enhancement for the Corpus Collector Backend.
title: "[Feature]: Support for Temperature Vitals in Patient Visits"
labels: "feature"
assignees: ''
title: "feat(backend): add temperature field to patient visit vitals"
🚀 Feature Request
Is your feature request related to a problem? Please describe.
Currently, the PatientVisitDetails model and associated services only support recording a limited subset of vitals (BP, Pulse, Heart Rate, RBS, Height, Weight). Medical staff cannot record or track a patient's body temperature as structured data, forcing them to use the unstructured "extra_note" field, which prevents data analysis and clinical tracking of fevers.
Describe the solution you'd like
I would like the backend to support a dedicated temperature field throughout the vitals lifecycle:
-
Database Model: Add a
temperaturecolumn to thePatientVisitDetailsmodel (Numeric(10, 2)) with aCheckConstraintto ensure the value is between 0 and 150. -
API Schemas: Update the
VitalBase,VitalCreate, andVitalUpdatePydantic schemas to include thetemperaturefield as an optional float. -
Service Layer: Update
patient_service.py(create_vital,update_vital,get_vitals_history) to handle the persistence and retrieval of temperature data. -
API Endpoints: Ensure the
PUT /api/v1/patients/vitals/{book_no}endpoint correctly maps the temperature from the request payload to the service calls.
Describe alternatives you've considered
An alternative was to continue using the extra_note field, but this is not viable for long-term clinical data processing or automated health alerts. Another option was a separate table for specialized vitals, but body temperature is a core metric that belongs in the primary vitals record.
Additional context
The frontend is being updated to send this data. The backend must handle the numeric precision required for medical readings (e.g., 98.6).
📌 Follow semantic issue titling convention:feat(vitals): support body temperature recording