# 
        Vital APIs
    
        # 
        Create Vitals :
    
Endpoint : POST /v1/sync/Observation
Note
Appointment must be created at front-end before creating vitals. As it will create encounter also, which we required to link in all the Observation resources. This must be handled at front-end. Also there must exist only one appointment and encounter for a given day for a patient/student.
        # 
        Request Body :
    
- While creating a vital for a patient, client-end must send all the field in request body to backend.
- If height is entered in cm, thenheightFtandheightInchmust be empty string or null andheightCmmust contain the value.
- If height is entered in ftandinch, thenheightCmmust be empty string or null and bothheightFtandheightInchmust contain the value.
- tempUnitmust contain only- Cor- Fas values.
- bloodGlucoseTypemust contain only- fastingor- randomas values.
- bloodGlucoseUnitmust contain only- mg/dLor- mmol/Las values.
- eyeTestTypemust contain only- 1or- 2as values for- with glassesand- without glasses.
- leftEyeand- rightEyecan have values from- 1to- 7. These number are mapped to the options for left and right eye. Ex:- 1means- Normal Vision (6/6 or 20/20). This mapping must be done at client-end.
- cholesteroland- cholesterolUnitboth values must be present if user is saving cholesterol value.
[
  {
    "vitalUuid": "e4719ac7-9b1f-42e2-9071-cd918e637cf9", // vital uuid created at android end
    "appointmentId": "44", // send the appointment id of created appointment resource
    "patientId": "7", // patient id
    "heightFt": "",
    "heightInch": "",
    "heightCm": "175",
    "weight": "65",
    "heartRate": "80",
    "respRate": "66",
    "spo2": "89",
    "temp": "45",
    "tempUnit": "F", //C or F only
    "bpDiastolic": "130",
    "bpSystolic": "97",
    "bloodGlucose": "66",
    "bloodGlucoseType": "random", // fasting or random only
    "bloodGlucoseUnit": "mmol/L", //mg/dL or mmol/L only 
    "leftEye": "2",
    "rightEye": "3",
    "eyeTestType": "2", // 1 or 2 only
    "cholesterol": 4,
    "cholesterolUnit": "mg/dl",
    "createdOn": "2024-10-09" // must be the timestamp when the vital is created
  }
]
        # 
        Response Body :
    
- Fhir Ids of Observation resource is not required by front-end , so client side may or may not use this response.
{
  "status": 1,
  "message": "Data saved successfully.",
  "data": [
    {
      "status": "201 Created",
      "id": "92ec7af7-3bfa-473c-ad7f-a1b1002eb7a8",
      "err": null,
      "fhirId": "46" // this fhir ID will be used in patch request as vitalFhirId
    }
  ]
}
        # 
        Get Vitals
    
Endpoint : GET /v1/Observation
- Client-side must fetch all the vitals together.
        # 
        Response body
    
{
  "status": 1,
  "message": "Data fetched",
  "total": 2,
  "data": [
    {
      "appointmentUuid": "1324asfdf-sfaasdfaf-asd-bjadsfgafoiwqoi-iuweqsnf",
      "vitalFhirId": "32", // this is encounter id
      "appointmentId": "31",
      "practitionerName": "Himanshu",
      "patientId": "5",
      "heightFt": null,
      "heightInch": null,
      "heightCm": 50,
      "weight": 50,
      "heartRate": 50,
      "respRate": 50,
      "spo2": 50,
      "temp": 50,
      "tempUnit": "C",
      "bpDiastolic": 50,
      "bpSystolic": 50,
      "bloodGlucoseType": "fasting",
      "bloodGlucose": 50,
      "bloodGlucoseUnit": "mg/dL",
      "eyeTestType": "2",
      "leftEye": 1,
      "rightEye": 2,
      "cholesterol": 4,
      "cholesterolUnit": "mg/dl"
    },
    {
      "appointmentUuid": "1231432asfdf-sfaasdfaf-asd-bjadzvcoiwqoi-iuweqsnf",
      "vitalFhirId": "32",
      "practitionerName": "Himanshu",
      "appointmentId": "44",
      "patientId": "7",
      "heightFt": null,
      "heightInch": null,
      "heightCm": 175,
      "weight": 65,
      "heartRate": 80,
      "respRate": 26,
      "spo2": 89,
      "temp": 45,
      "tempUnit": "F",
      "bpDiastolic": 130,
      "bpSystolic": 97,
      "bloodGlucoseType": "random",
      "bloodGlucose": 66,
      "bloodGlucoseUnit": "mmol/L",
      "eyeTestType": "2",
      "leftEye": 2,
      "rightEye": 3,
      "cholesterol": 4,
      "cholesterolUnit": "mg/dl"
    }
  ]
} 
                                