# Diseases

The Diseases API enables CRUD operations for disease records, including the ability to associate diseases with symptoms. Each disease includes a list of related symptoms, shown as nested objects in GET responses. For POST and PUT requests, the association is managed using symptom_ids, a list of unique_ids representing the symptoms.

# Get Disease List

Retrieve a list of all diseases, with associated symptoms shown as nested objects.

  • URL: documents/diseases/
  • Method: GET
  • Response Example:
    [
      {
        "unique_id": "disease123",
        "disease_name": "Influenza",
        "disease_details": "A viral infection that attacks the respiratory system.",
        "disease_symptoms": [
          {
            "unique_id": "symptom789",
            "symptom_name": "Fever",
            "symptom_details": "A rise in body temperature.",
            "date_created": "2023-01-01T12:00:00Z",
            "last_updated": "2023-01-01T12:00:00Z"
          },
          {
            "unique_id": "symptom456",
            "symptom_name": "Cough",
            "symptom_details": "A sudden expulsion of air from the lungs.",
            "date_created": "2023-01-01T12:00:00Z",
            "last_updated": "2023-01-01T12:00:00Z"
          }
        ],
        "date_created": "2023-01-01T12:00:00Z",
        "last_updated": "2023-01-01T12:00:00Z"
      },
      ...
    ]
    

# Create a Disease

Create a new disease entry, associating it with specific symptoms by providing their unique_ids in the symptom_ids field.

  • URL: documents/diseases/
  • Method: POST
  • Request Example:
    {
      "disease_name": "Influenza",
      "disease_details": "A viral infection that attacks the respiratory system.",
      "symptom_ids": ["symptom789", "symptom456"]
    }
    
  • Response Example:
    {
      "unique_id": "disease123",
      "disease_name": "Influenza",
      "disease_details": "A viral infection that attacks the respiratory system.",
      "disease_symptoms": [
        {
          "unique_id": "symptom789",
          "symptom_name": "Fever",
          "symptom_details": "A rise in body temperature.",
          "date_created": "2023-01-01T12:00:00Z",
          "last_updated": "2023-01-01T12:00:00Z"
        },
        {
          "unique_id": "symptom456",
          "symptom_name": "Cough",
          "symptom_details": "A sudden expulsion of air from the lungs.",
          "date_created": "2023-01-01T12:00:00Z",
          "last_updated": "2023-01-01T12:00:00Z"
        }
      ],
      "date_created": "2023-01-01T12:00:00Z",
      "last_updated": "2023-01-01T12:00:00Z"
    }
    

# Get a Disease

Retrieve details of a specific disease by unique ID, with associated symptoms shown as nested objects.

  • URL: documents/diseases/<str:unique_id>/
  • Method: GET
  • Response Example:
    {
      "unique_id": "disease123",
      "disease_name": "Influenza",
      "disease_details": "A viral infection that attacks the respiratory system.",
      "disease_symptoms": [
        {
          "unique_id": "symptom789",
          "symptom_name": "Fever",
          "symptom_details": "A rise in body temperature.",
          "date_created": "2023-01-01T12:00:00Z",
          "last_updated": "2023-01-01T12:00:00Z"
        },
        {
          "unique_id": "symptom456",
          "symptom_name": "Cough",
          "symptom_details": "A sudden expulsion of air from the lungs.",
          "date_created": "2023-01-01T12:00:00Z",
          "last_updated": "2023-01-01T12:00:00Z"
        }
      ],
      "date_created": "2023-01-01T12:00:00Z",
      "last_updated": "2023-01-01T12:00:00Z"
    }
    

# Update a Disease

Update an existing disease by unique ID, associating or updating associated symptoms using symptom_ids.

  • URL: documents/diseases/<str:unique_id>/
  • Method: PUT
  • Request Example:
    {
      "disease_name": "Severe Influenza",
      "disease_details": "A severe viral infection affecting the respiratory system.",
      "symptom_ids": ["symptom789", "symptom123"]
    }
    
  • Response Example:
    {
      "unique_id": "disease123",
      "disease_name": "Severe Influenza",
      "disease_details": "A severe viral infection affecting the respiratory system.",
      "disease_symptoms": [
        {
          "unique_id": "symptom789",
          "symptom_name": "Fever",
          "symptom_details": "A rise in body temperature.",
          "date_created": "2023-01-01T12:00:00Z",
          "last_updated": "2023-01-01T12:00:00Z"
        },
        {
          "unique_id": "symptom123",
          "symptom_name": "Body Aches",
          "symptom_details": "Pain throughout the body, typically with fatigue.",
          "date_created": "2023-01-02T12:00:00Z",
          "last_updated": "2023-01-02T12:00:00Z"
        }
      ],
      "date_created": "2023-01-01T12:00:00Z",
      "last_updated": "2023-01-03T08:30:00Z"
    }
    

# Delete a Disease

Delete a disease by unique ID.

  • URL: documents/diseases/<str:unique_id>/
  • Method: DELETE
  • Response: 204 No Content