Skip to content

REST API

Benedikt Ricken edited this page Jan 25, 2025 · 8 revisions

The backend provides a REST API for easy communication between back- and frontend.

Endpoints

  • GET: /api/stations/: Returns all stations:
[
    {
        "id": 1,
        "name": "AB",
        "patientCount": 0,
        "missing_classifications": 1
    }
]
  • GET: /api/stations/<int:station_id>/: Returns the patients for a station:
[
    {
        "id": 5,
        "name": "Michael Lee",
        "lastClassificationDate": null,
        "lastClassificationMinutes": null,
        "lastClassificationAIndex": null,
        "lastClassificationSIndex": null,
        "currentRoom": "Room 8",
        "currentBed": "5",
        "missing_classifications_last_week": [
            "2025-01-18",
            "2025-01-19",
            "2025-01-20",
            "2025-01-21",
            "2025-01-22",
            "2025-01-23",
            "2025-01-24",
            "2025-01-25"
        ],
        "lastClassification": null
    }
]
  • GET /api/questions/<int:station_id>/<int:patient_id>/<str:date>/ Returns the current classification state
{
   "care_time": 0,
   "is_in_isolation": false,
   "a_index": 0,
   "s_index": 0,
   "admission_date": "2025-01-05T00:00:00Z",
   "discharge_date": "2025-02-10T00:00:00Z",
   "careServices":[
      {
         "id":"int",
         "name":"string",
         "short":"string",
         "categories":[
            {
               "id":"int",
               "name":"string",
               "short":"string",
               "severities":[
                  {
                     "severity":"int",
                     "questions":[
                        {
                           "id": 2,
                           "field__name": "Allgemeine Pflege",
                           "field__short": "A",
                           "category__name": "Körperpflege",
                           "category__short": "Körperpflege",
                           "name": "A-koerperpflege-2-1",
                           "severity": 2,
                           "description": "Hilfe bei überwiegend selbständiger Körperpflege",
                           "short": "Überwiegend selbständige Körperpflege",
                           "selected": false
                       }
                     ]
                  }
               ]
            }
         ]
      }
   ]
}
  • PUT /api/questions/<int:station_id>/<int:patient_id>/<str:date>/: Update a selection for a question Body:
{
   "id":"int",
   "selcted":"bool"
}

or alternatively you can set the isolation:

{
    "is_in_isolation": "bool"
}
  • GET /api/calculate/<int:station_id>/<int:patient_id>/<str:date>/: Returns the current results
{
   "category1":"string",
   "category2":"string",
   "minutes":"int",
}
  • GET /api/stations/analysis?frequency=daily|monthly
[
    {
        "id": 3,
        "name": "Station 1A",
        "date": "2025-01-25",
        "minutes": 109
    }
]
  • GET /api/visit-type/<int:station_id>/
{
    "stationary": [
        "Michael Lee"
    ],
    "part_stationary": [],
    "acute": [],
    "undefined": []
}
  • GET /api/current-station/<int:patient_id>/
{
    "station_id": "int"
}
  • GET /api/patient/dates/<int:patient_id>/<int:station_id>/
{
    "dates": [
        {
            "date": "2025-01-06",
            "hasClassification": false
        }
    ]
}
  • POST /api/calculate_direct/<int:station_id>/<int:patient_id>/<str:date>/<str:a_value>/<str:s_value>/

No Body required

Response:

{
   "category1":"string",
   "category2":"string",
   "minutes":"int",
}
  • GET /api/analysis/caregivers/<str:start>/<str:end>/ Endpoint to retrieve coordinates for the is and should occupancy on stations.
[
  {
        "station_id": 3,
        "station_name": "Station 1A",
        "dataset_night": [],
        "dataset_day": [
            {
                "date": "2025-01-25",
                "should": 0.047186147186147186,
                "is": null
            }
        ]
    }
]

Clone this wiki locally