Rename main.py to api.py and minor changes

This commit is contained in:
30hours 2024-02-11 03:03:23 +00:00
parent d379e4073c
commit 32401c9031
4 changed files with 23 additions and 6 deletions

View file

@ -10,7 +10,7 @@ RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 5000
# define environment variable
ENV FLASK_APP=main.py
ENV FLASK_APP=api.py
# run Gunicorn instead of the default Flask development server
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "main:app"]

View file

@ -1,4 +1,8 @@
# main.py
"""
@file api.py
@brief API for 3lips.
@author 30hours
"""
from flask import Flask, Response, render_template, request, redirect, jsonify, send_from_directory
import os

View file

@ -7,8 +7,9 @@ class AdsbAssociator:
"""
@class AdsbAssociator
@brief A class for associating a detection with ADS-B truth.
@details Uses radar detection data from a blah2 server.
@brief A class for associating detections of the same target.
@details Girst associate ADS-B truth with each radar detection.
Then associate over multiple radars.
@see blah2 at https://github.com/30hours/blah2.
Uses truth data in delay-Doppler space from an adsb2dd server.
@see adsb2dd at https://github.com/30hours/adsb2dd.

View file

@ -81,9 +81,21 @@ async def event():
# main processing
for item in api_event:
for radar in item["server"]:
# associator selection
if item["associator"] == "adsb-associator":
associator = adsbAssociator
else:
print("Error: Associator invalid.")
return
print(radar, flush=True)
# coord reg selection
if item["coordreg"] == "ellipse-parametric":
coordreg = ellipseParametric
else:
print("Error: Coord reg invalid.")
return
print(radar, flush=True)
# delete old API requests
api_event = [