# Patient enrollment

| **API URL**     | {{url}}/spice-service/patient/enrollment |
| --------------- | ---------------------------------------- |
| **Method**      | POST                                     |
| **Description** | Patient enrollment                       |

#### **Input:** <a href="#patientenrollment-input" id="patientenrollment-input"></a>

| **Field Name**        | **Type** | **Mandatory** | **Example**                                                                                                                                     |
| --------------------- | -------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization(Header) | String   | Yes           | Bearer eyJlbmMiOiJBMTI4R0NNIiwiYWxnIjoiUlNBLU9BRVAtMjU2In0.MCm0mJDfpfjlr10Uok79-kTF7fv9Tn7cI5m2WsRDGUd9VS7iRmfbszjuc1-w5D-PYt9CdVxRMGBQlzYauhnI |

#### **Input:** <a href="#patientenrollment-input-.1" id="patientenrollment-input-.1"></a>

| **Field Name**              | **Type**         | **Mandatory** | **Example**               |
| --------------------------- | ---------------- | ------------- | ------------------------- |
| NationalId                  | String           | Yes           | PARTE65432                |
| FirstName                   | String           | Yes           | Partha                    |
| LastName                    | String           | Yes           | E                         |
| MobileNumber                | String           | Yes           | 198765432                 |
| MobileNumberCategory        | String           | Yes           | Personal                  |
| county                      | String           | Yes           | Kwale                     |
| SubCounty                   | String           | Yes           | Matuga                    |
| Occupation                  | String           | Yes           | Employed                  |
| LevelOfEducation            | String           | Yes           | A-level Completed         |
| gender                      | String           | Yes           | Male                      |
| DateOfBirth                 | Date             | No            | 26/05/2000                |
| Age                         | Bigint           | Yes           | 23                        |
| IsRegularSmoker             | Boolean          | Yes           | No                        |
| Diabetes                    | String           | Yes           | N/A                       |
| Hypertension                | String           | Yes           | N/A                       |
| Height                      | Double-precision | Yes           | 182                       |
| Weight                      | Double-precision | Yes           | 77                        |
| Systolic                    | Integer          | Yes           | 88                        |
| Diastolic                   | Integer          | Yes           | 88                        |
| Pulse                       | Integer          | No            | 88                        |
| Blood Glucose               | Double-precision | No            | 23                        |
| lastMealTime                | TimeStamp        | No            | 2023-05-26T17:01:13+05:30 |
| MentalHealthQuestions(PHQ4) | Integer          | Yes           | 4                         |

#### **Sample Input:** <a href="#patientenrollment-sampleinput" id="patientenrollment-sampleinput"></a>

{\
"gender": "Male",\
"isRegularSmoker": false,\
"cvdRiskScore": 2,\
"dateOfBirth": "2000-05-26T00:00:00+05:30",\
"bpLog": {\
"avgSystolic": 88,\
"bpLogId": 47,\
"weight": 77,\
"avgDiastolic": 88,\
"avgBloodPressure": "88/88",\
"height": 182,\
"bpLogDetails": \[\
{\
"diastolic": 88,\
"pulse": 88,\
"systolic": 88\
},\
{\
"diastolic": 88,\
"pulse": 88,\
"systolic": 88\
},\
{\
"diastolic": 88,\
"pulse": 88,\
"systolic": 88\
}\
],\
"bmi": 23.25\
},\
"phq4": {\
"phq4Score": 7,\
"phq4MentalHealth": \[\
{\
"answerId": 67,\
"score": 3,\
"questionId": 6,\
"displayOrder": 4\
},\
{\
"answerId": 23,\
"score": 1,\
"questionId": 13,\
"displayOrder": 1\
},\
{\
"answerId": -1,\
"score": 2,\
"questionId": 9,\
"displayOrder": 3\
},\
{\
"answerId": 49,\
"score": 1,\
"questionId": 17,\
"displayOrder": 2\
}\
],\
"phq4RiskLevel": "Moderate"\
},\
"cvdRiskLevel": "Low risk",\
"unitMeasurement": "metric",\
"bpLogId": 47,\
"cvdRiskScoreDisplay": "2% - Low risk",\
"bioMetrics": {\
"gender": "Male",\
"isRegularSmoker": false,\
"age": 23\
},\
"siteId": 1,\
"patientTrackId": 12,\
"glucoseLog": {\
"glucoseUnit": "mmol/L",\
"hba1cUnit": "mmol/L"\
},\
"age": 23,\
"bioData": {\
"firstName": "Partha",\
"lastName": "E",\
"country": 1,\
"levelOfEducation": "A-level Completed",\
"phoneNumber": "198765432",\
"occupation": "Employed",\
"nationalId": "PARTE65432",\
"initial": "E",\
"county": 2,\
"subCounty": 3,\
"insuranceStatus": false,\
"phoneNumberCategory": "Personal"\
},\
"patientStatus": {\
"htnPatientType": "N/A",\
"diabetesPatientType": "N/A",\
"isHtnDiagnosis": false,\
"isDiabetesDiagnosis": false\
}\
}

#### **Output:** <a href="#patientenrollment-output" id="patientenrollment-output"></a>

| **Field Name**          | **Type**         | **Comments**               |
| ----------------------- | ---------------- | -------------------------- |
| `id`                    | Integer          | User ID                    |
| `nationalId`            | String           | Patient national ID        |
| `firstName`             | String           | Patient first name         |
| `lastName`              | String           | Patient last name          |
| `gender`                | String           | Patient gender             |
| `age`                   | Bigint           | Patient age                |
| `siteName`              | String           | Site name                  |
| `enrollmentDate`        | Time Stamp       | Enrollment date            |
| `virtualId`             | Bigint           | Virtual id                 |
| `avgSystolic`           | Integer          | Average systolic           |
| `avgDiastolic`          | Integer          | Average diastolic          |
| `bmi`                   | Double-precision | BMI                        |
| `cvdRiskLevel`          | String           | CVD risk level             |
| `cvdRiskScore`          | Integer          | CVD risk score             |
| `updatedFromEnrollment` | Boolean          | Is updated from enrollment |
| `latest`                | Boolean          | Is latest                  |
| `deleted`               | Boolean          | Is deleted                 |
| `oldRecord`             | Boolean          | Is old record              |
| `redRiskPatient`        | Boolean          | Is red risk patient        |
| `Treatment plan`        | String           | Provisional treatment plan |
| `isConfirmDiagnosis`    | Boolean          | Confirm diagnosis          |
| `phq4RiskLevel`         | String           | Phq4 risk level            |
| `phq4Score`             | Integer          | phq4 score                 |

#### **Sample Output:** <a href="#patientenrollment-sampleoutput" id="patientenrollment-sampleoutput"></a>

```
{
    "message": "Patient added successfully.",
    "entity": {
        "enrollment": {
            "id": 26,
            "nationalId": "PARTE65432",
            "firstName": "PARTHA",
            "lastName": "E",
            "gender": "Male",
            "age": 23,
            "emrNumber": 0,
            "siteName": "Medical Care",
            "enrollmentDate": "2023-05-26T17:55:42+05:30",
            "virtualId": 25
        },
        "bpLog": {
            "createdBy": 5,
            "updatedBy": 5,
            "avgSystolic": 88,
            "avgDiastolic": 88,
            "bmi": 23.25,
            "cvdRiskLevel": "Low risk",
            "cvdRiskScore": 2,
            "updatedFromEnrollment": false,
            "latest": false,
            "deleted": false,
            "oldRecord": false,
            "redRiskPatient": false
        },
        "treatmentPlan": [
            {
                "label": "Hba1c Check Frequency",
                "value": "Every 3 months"
            },
            {
                "label": "Blood Glucose Check Frequency",
                "value": "Physician Approval Pending"
            },
            {
                "label": "Blood Pressure Check Frequency",
                "value": "Every 3 months"
            },
            {
                "label": "Medical Review Frequency",
                "value": "Every 1 month"
            }
        ],
        "isConfirmDiagnosis": false,
        "phq4": {
            "createdBy": 5,
            "phq4RiskLevel": "Moderate",
            "phq4Score": 7
        }
    },
    "status": true,
    "entityList": null,
    "responseCode": 201,
    "totalCount": null
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://spice.docs.medtroniclabs.org/spice-docs/engineering/api-documentation/spice-services/patient-enrollment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
