# Profile

The Profile API is designed to manage user profiles, which can be linked to patient records. Each profile is associated with a user and contains detailed information such as contact details and location. Profiles can be created, retrieved, updated, and deleted.

# Get Profile List

Retrieve a list of all profiles.

  • URL: patients/profiles/
  • Method: GET
  • Response Example:
    [
      {
        "unique_id": "prof123",
        "user": {
          "email": "user@example.com",
          "first_name": "John",
          "last_name": "Doe"
        },
        "phone_number": "+123456789",
        "physical_address": "123 Street Name",
        "address_line_1": "Apt 101",
        "town": "Sample Town",
        "region": "Sample Region",
        "province": "Sample Province",
        "country": "Sample Country",
        "latitude": "12.345678",
        "longitude": "-12.345678",
        "date_created": "2023-01-01T12:00:00Z",
        "last_updated": "2023-01-01T12:00:00Z"
      }
    ]
    

# Create a Profile

Create a new profile. A new user will be created or an existing one associated if user details are provided.

  • URL: patients/profiles/

  • Method: POST

  • Request Example:

    {
      "user": {
        "email": "user@example.com",
        "first_name": "John",
        "last_name": "Doe"
      },
      "phone_number": "+123456789",
      "physical_address": "123 Street Name",
      "address_line_1": "Apt 101",
      "town": "Sample Town",
      "region": "Sample Region",
      "province": "Sample Province",
      "country": "Sample Country",
      "latitude": "12.345678",
      "longitude": "-12.345678"
    }
    

    Note: The user field is required and will be used to associate the profile with an existing user or create a new one.

  • Response Example:

    {
      "unique_id": "prof123",
      "user": {
        "email": "user@example.com",
        "first_name": "John",
        "last_name": "Doe"
      },
      "phone_number": "+123456789",
      "physical_address": "123 Street Name",
      "address_line_1": "Apt 101",
      "town": "Sample Town",
      "region": "Sample Region",
      "province": "Sample Province",
      "country": "Sample Country",
      "latitude": "12.345678",
      "longitude": "-12.345678",
      "date_created": "2023-01-01T12:00:00Z",
      "last_updated": "2023-01-01T12:00:00Z"
    }
    

# Get a Profile

Retrieve details of a specific profile by its unique ID.

  • URL: patients/profiles/<str:unique_id>/
  • Method: GET
  • Response Example:
    {
      "unique_id": "prof123",
      "user": {
        "email": "user@example.com",
        "first_name": "John",
        "last_name": "Doe"
      },
      "phone_number": "+123456789",
      "physical_address": "123 Street Name",
      "address_line_1": "Apt 101",
      "town": "Sample Town",
      "region": "Sample Region",
      "province": "Sample Province",
      "country": "Sample Country",
      "latitude": "12.345678",
      "longitude": "-12.345678",
      "date_created": "2023-01-01T12:00:00Z",
      "last_updated": "2023-01-01T12:00:00Z"
    }
    

# Update a Profile

Update an existing profile by unique ID. This allows modifying the associated user details and profile information.

  • URL: patients/profiles/<str:unique_id>/
  • Method: PUT
  • Request Example:
    {
      "phone_number": "+987654321",
      "province": "New Province"
    }
    
  • Response Example:
    {
      "unique_id": "prof123",
      "user": {
        "email": "user@example.com",
        "first_name": "John",
        "last_name": "Doe"
      },
      "phone_number": "+987654321",
      "physical_address": "123 Street Name",
      "address_line_1": "Apt 101",
      "town": "Sample Town",
      "region": "Sample Region",
      "province": "New Province",
      "country": "Sample Country",
      "latitude": "12.345678",
      "longitude": "-12.345678",
      "date_created": "2023-01-01T12:00:00Z",
      "last_updated": "2023-01-01T12:00:00Z"
    }
    

# Delete a Profile

Delete a profile by its unique ID.

  • URL: patients/profiles/<str:unique_id>/
  • Method: DELETE
  • Response: 204 No Content