UVAPadovaAPIWrapper module¶
- class UVAPadovaAPIWrapper.UvaPadovaAPI(HOST_ADDRESS: str = '127.0.0.1', PORT: int = 5000)[source]¶
Bases:
object
This class can be used by a client to make requests to the UVAPadovaAPI simply from Python code. In addition, the attributes of the class make input and output data more organized.
Note
The methods don’t check the correctness of the input parameters. To enter the input parameters correctly, please read the documentation of UVAPadova Simulator.
- Parameters
HOST_ADDRESS (str) – The IP address of the server that runs the UVAPadovaAPI.py.
PORT (int) – The port number where the UVAPadovaAPI.py can be accessed on the server.
listOfCarbohydrateIntakes (list(float)) – A list which contains the carbohydrate intakes during the simulation line.
listOfInsulinIntakes (list(float)) – A list which contains the insulin intakes during the simulation line.
listOfBloodGlucoseValues (list(float)) – A list which contains the blood glucose values in 5 minute increments.
- doSimulation(carbohydrate: Optional[float] = None, insulin: Optional[float] = None)[source]¶
This method extends the initialized simulation by 5 minutes. Insulin or/and carbohydrate intake can be added to the simulation.
Note
Before calling this function, please initialize a patient by “initializePatient” function.
- Parameters
carbohydrate (float, optional) – The amount of carbohydrate intake, in the last five minutes (in grams).
insulin (float, optional) – The amount of insulin intake, in the last five minutes (unit).
- Returns
If the simulation request was successful, the function returns a dictionary, which contains the “bloodGlucose” value at the end of the simulation and optionally other alerts related to the simulation.
If the simulation request was unsuccessful, the function returns the reason of the error (string format).
- initializePatient(patient_name: str, pump: Optional[str] = None, sensor: Optional[str] = None) → bool[source]¶
This method initialize a new simulation (resets the simulation line).
- Parameters
patient_name (str) – The identifier of the patient.
pump (str, optional) – The type of the insulin pump.
sensor (str, optional) – The type of the CGM sensor.
- Returns
If the initialization was successful returns true, otherwise returns false.
- Return type
bool