# Diagnosis

The Diagnosis API allows for the creation, retrieval, updating, and deletion of diagnoses associated with patients. Each diagnosis must be associated with a patient, and a doctor, and it can optionally be linked to a hospital, disease, and specific symptoms and medications.

# Get Diagnosis List

Retrieve a list of all diagnoses.

  • URL: patients/diagnoses/
  • Method: GET
  • Response Example:
    [
      {
        "unique_id": "diag001",
        "patient_id": "pat001",
        "doctor_id": "doc123",
        "hospital_id": "hosp001",
        "disease_id": "dis001",
        "stage_cancer": "Stage II",
        "date_diagnosis": "2023-01-01",
        "symptoms": [
          {
            "unique_id": "sym001",
            "symptom_name": "Headache",
            "symptom_details": "Severe and constant."
          },
          {
            "unique_id": "sym003",
            "symptom_name": "Fatigue",
            "symptom_details": "Persistent throughout the day."
          }
        ],
        "medications": [
          {
            "unique_id": "med001",
            "medication_name": "Ibuprofen",
            "medication_brands": "Advil, Motrin",
            "medication_details": "Anti-inflammatory and pain reliever."
          }
        ],
        "date_created": "2023-01-01T14:00:00Z",
        "last_updated": "2023-01-01T14:00:00Z"
      },
      ...
    ]
    

# Create a Diagnosis

Create a new diagnosis for a patient. This action requires providing the patient_id, doctor_id, disease_id (if applicable), symptom_ids (if any), and medication_ids (if any) to correctly associate the diagnosis.

  • URL: patients/diagnoses/

  • Method: POST

  • Request Example:

    {
      "patient_id": "pat001",
      "doctor_id": "doc123",
      "hospital_id": "hosp001",
      "disease_id": "dis001",
      "stage_cancer": "Stage II",
      "date_diagnosis": "2023-01-01",
      "symptom_ids": ["sym001", "sym003"],
      "medication_ids": ["med001"]
    }
    
    • Explanation:
      • patient_id, doctor_id: Required fields to specify the patient and doctor associated with this diagnosis.
      • hospital_id, disease_id: Optional fields that link the diagnosis to a hospital and a disease, if relevant.
      • symptom_ids: List of unique IDs for symptoms associated with the diagnosis.
      • medication_ids: List of unique IDs for medications prescribed in the diagnosis.
  • Response Example:

    {
      "unique_id": "diag001",
      "patient_id": "pat001",
      "doctor_id": "doc123",
      "hospital_id": "hosp001",
      "disease_id": "dis001",
      "stage_cancer": "Stage II",
      "date_diagnosis": "2023-01-01",
      "symptoms": [
        {
          "unique_id": "sym001",
          "symptom_name": "Headache",
          "symptom_details": "Severe and constant."
        },
        {
          "unique_id": "sym003",
          "symptom_name": "Fatigue",
          "symptom_details": "Persistent throughout the day."
        }
      ],
      "medications": [
        {
          "unique_id": "med001",
          "medication_name": "Ibuprofen",
          "medication_brands": "Advil, Motrin",
          "medication_details": "Anti-inflammatory and pain reliever."
        }
      ],
      "date_created": "2023-01-01T14:00:00Z",
      "last_updated": "2023-01-01T14:00:00Z"
    }
    

# Get a Diagnosis

Retrieve the details of a specific diagnosis by unique ID.

  • URL: patients/diagnoses/<str:unique_id>/
  • Method: GET
  • Response Example:
    {
      "unique_id": "diag001",
      "patient_id": "pat001",
      "doctor_id": "doc123",
      "hospital_id": "hosp001",
      "disease_id": "dis001",
      "stage_cancer": "Stage II",
      "date_diagnosis": "2023-01-01",
      "symptoms": [
        {
          "unique_id": "sym001",
          "symptom_name": "Headache",
          "symptom_details": "Severe and constant."
        },
        {
          "unique_id": "sym003",
          "symptom_name": "Fatigue",
          "symptom_details": "Persistent throughout the day."
        }
      ],
      "medications": [
        {
          "unique_id": "med001",
          "medication_name": "Ibuprofen",
          "medication_brands": "Advil, Motrin",
          "medication_details": "Anti-inflammatory and pain reliever."
        }
      ],
      "date_created": "2023-01-01T14:00:00Z",
      "last_updated": "2023-01-01T14:00:00Z"
    }
    

# Update a Diagnosis

Update an existing diagnosis by unique ID. You can update fields such as stage_cancer, date_diagnosis, symptom_ids, or medication_ids.

  • URL: patients/diagnoses/<str:unique_id>/

  • Method: PUT

  • Request Example:

    {
      "stage_cancer": "Stage III",
      "date_diagnosis": "2023-02-01",
      "symptom_ids": ["sym001", "sym004"],
      "medication_ids": ["med002"]
    }
    
    • Explanation:
      • Updates the cancer stage, diagnosis date, and changes associated symptoms and medications.
  • Response Example:

    {
      "unique_id": "diag001",
      "patient_id": "pat001",
      "doctor_id": "doc123",
      "hospital_id": "hosp001",
      "disease_id": "dis001",
      "stage_cancer": "Stage III",
      "date_diagnosis": "2023-02-01",
      "symptoms": [
        {
          "unique_id": "sym001",
          "symptom_name": "Headache",
          "symptom_details": "Severe and constant."
        },
        {
          "unique_id": "sym004",
          "symptom_name": "Nausea",
          "symptom_details": "Persistent."
        }
      ],
      "medications": [
        {
          "unique_id": "med002",
          "medication_name": "Paracetamol",
          "medication_brands": "Tylenol",
          "medication_details": "Pain reliever."
        }
      ],
      "date_created": "2023-01-01T14:00:00Z",
      "last_updated": "2023-02-02T14:00:00Z"
    }
    

# Delete a Diagnosis

Delete a diagnosis by unique ID.

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