UVAPadovaAPI module¶
- class UVAPadovaAPI.Simulate[source]¶
Bases:
flask_restful.Resource
This class handles the requests to modify the current state of the simulation.
Note
The API doesn’t check the correctness of the input parameters. To enter the input parameters correctly, please read the documentation of UVAPadova Simulator.
- endpoint = 'simulate'¶
- get()[source]¶
The simulation can be extended by 5 minutes by an HTTP GET request. If carbohydrate or insulin intake occurred in the last 5 minutes, their amount can be specified as an HTTP GET parameter.
Examples
>>> http://<IP ADDRESS>:<PORT NUMBER>/simulate?carbohydrate=<value in grams>&insulin=<value in units>
- Returns
A HTTP status code according to the success of the request. Furthermore, if the simulation request was successful, the function returns a JSON string, which contains the “bloodGlucose” value at the end of the simulation and optionally other alerts related to the simulation.
- Return type
str
- mediatypes()¶
- methods: Optional[List[str]] = {'GET', 'POST'}¶
A list of methods this view can handle.
- class UVAPadovaAPI.SimulationCreator[source]¶
Bases:
flask_restful.Resource
This class handles the requests to initialize a simulation.
Note
The API doesn’t check the correctness of the input parameters. To enter the input parameters correctly, please read the documentation of UVAPadova Simulator.
- endpoint = 'simulationcreator'¶
- get()[source]¶
A new simulation can be created by an HTTP GET request. For the initialization, the patient ID is required as a HTTP GET parameter. Optionally, the type of insulin pump or/and CGM sensor used for the simulation can also be specified as a HTTP GET parameter.
- Returns:
str: A HTTP status code according to the success of the request.
- Examples:
>>> http://<IP ADDRESS>:<PORT NUMBER>/createSimulation?patientid=<patient ID>&pump=<pump name>&sensor=<CGM name>
- mediatypes()¶
- methods: Optional[List[str]] = {'GET'}¶
A list of methods this view can handle.
- UVAPadovaAPI.uva_padova_simulator = None¶
This modul level variable will be contain (after initialization) an UvaPadovaSimulator instance, which represents the current state of the simulation and modifies it.