{"openapi":"3.0.0","info":{"description":"API for Aguarics project (UdG Algorithms)","version":"1","title":"Aguarics API","contact":{"email":"david.martineza@udg.edu"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"tags":[{"name":"developers","description":"Operations available to regular developers"}],"paths":{"/experiments/sensor_placement":{"post":{"summary":"Spawn an Experiment (Sensor Placement)","description":"Create a new experiment (Sensor Placement Algorithm).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"city_name":{"type":"string","description":"Name of the city.","enum":["Sabadell"]},"iterations":{"type":"number","format":"integer","default":20000,"description":"Number of iterations for the greedy algorithm. After \"X\" iterations, if no better solution is found, the algorithm halts. A larger number will provide a more optimal solution, also increasing computation time."}},"required":["city_name"]}}}},"responses":{"200":{"description":"Experiment created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"experiment_id":{"type":"string","description":"ID of the spawned computation."}}}}}},"400":{"description":"Bad request. Invalid parameters provided."},"500":{"description":"Internal Server Error. Server crashed."}}}},"/experiments/sensor_placement/{experiment_id}":{"get":{"summary":"Check Experiment Status or Get Results (Sensor Placement)","description":"Retrieve the status and results of an experiment (Sensor Placement).","parameters":[{"name":"experiment_id","in":"path","required":true,"schema":{"type":"string"},"description":"ID of the experiment."}],"responses":{"200":{"description":"Experiment status and results.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["pending","error","completed"],"description":"Status of the experiment."},"result":{"description":"Complex object with experiment results.","type":"object","properties":{"sensor_and_covered_points_geojson_url":{"type":"string","format":"uri","description":"URL pointing to a geojson with points where the sensors and their covered consumption escomeses are placed. The geojson features contain: the IDs (coherent with the other results returned in this response); position in EPSG:25831; 'monit_point' property indicates if it is a sensor (1) or it is a covered consumption escomesa (0); and 'monit_area' property is a number that goes from 1..n, where n is the number of sensors, so a consumption escomesa feature with 'monit_area = 1' means that it is covered by the sensor in the first array position of the 'best_result' returned in this JSON response."},"best_result":{"type":"array","description":"Array of the node_id or escomesa_id of the nodes of the network to place sensors.","items":{"type":"integer"},"example":[493,45,85,383]},"opt_value":{"type":"number","format":"double","description":"Optimal value of the algorithm. Higher values indicate better solutions (1) and lower values indicate worst solutions (0) according to the evaluation function criteria. Current criteria: Entire consumption covered by at least one sensor and with the lowest possible distance between consumption points and its closest sensor thaat covers it.","example":0.96},"des_score":{"type":"object","description":"Deagregated score of the metrics considered in the evaluation function.","properties":{"covered_node_distances":{"type":"object","description":"Dictionary of distances between each escomesa_id (consumption point) and the closest sensor that covers it.","additionalProperties":{"type":"number","format":"double"},"example":{"285":100.903,"270":238.451,"87":382.972,"85":0,"45":0}},"normalized_covered_cons":{"type":"number","format":"double","description":"Normalized consumption coverage. A value of 1 indicates all network consumption is covered by at least one sensor. A value of 0.75 means 75% of consumption in network is being covered.","example":1.0},"normalized_dist_score":{"type":"number","format":"double","description":"Normalized distance score. A value of 1 indicates all consumption nodes are covered by a sensor and the closest sensor is within 100m.","example":0.91}}},"coverage_nodes_percentage":{"type":"number","format":"double","description":"Percentage of covered nodes by at least one sensor.","example":100.0},"unique_nodes_percentage":{"type":"number","format":"double","description":"Percentage of unique nodes (nodes covered by only 1 sensor). This is an informative field (not used in optimization).","example":50.47},"interference_nodes_percentage":{"type":"number","format":"double","description":"Percentage of interference nodes (nodes covered by more than one sensor). This is an informative field (not used in optimization).","example":49.53}}}}}}}},"404":{"description":"Experiment not found."}}}}},"components":{"securitySchemes":{"TokenAuth":{"type":"apiKey","name":"Authorization","in":"header"}},"schemas":{"Schema":{"type":"object","properties":{"id":{"type":"integer","format":"int64"}}}}},"security":[{"TokenAuth":[]}]}