Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
barroco committed Aug 4, 2023
1 parent 44e442e commit 1fb2774
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 21 deletions.
22 changes: 13 additions & 9 deletions monitoring/mock_uss/riddp/routes_observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,24 @@ def riddp_flight_details(flight_id: str) -> Tuple[str, int]:
return f'Flight "{flight_id}" not found', 404

rid_version: RIDVersion = webapp.config[KEY_RID_VERSION]
flight_details = fetch.flight_details(flight_info.flights_url, flight_id, True, rid_version, utm_client)
flight_details = fetch.flight_details(
flight_info.flights_url, flight_id, True, rid_version, utm_client
)
if rid_version == RIDVersion.f3411_19:
# TODO: Implement details for F3411-19
return flask.jsonify(observation_api.GetDetailsResponse(id=flight_id))
elif rid_version == RIDVersion.f3411_22a:
result = observation_api.GetDetailsResponse(
id=flight_id,
operator_id=flight_details.details.v22a_value.get("operator_id"),
uas_id=flight_details.details.v22a_value.get("uas_id"),
operator_location=flight_details.details.v22a_value.get("operator_location"),
operational_status=flight_details.details.v22a_value.get("operational_status"),
)
return flask.jsonify(
result
id=flight_id,
operator_id=flight_details.details.v22a_value.get("operator_id"),
uas_id=flight_details.details.v22a_value.get("uas_id"),
operator_location=flight_details.details.v22a_value.get(
"operator_location"
),
operational_status=flight_details.details.v22a_value.get(
"operational_status"
),
)
return flask.jsonify(result)
else:
return f"Support for RID version {rid_version} not yet implemented", 501
5 changes: 4 additions & 1 deletion monitoring/uss_qualifier/resources/netrid/observers.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def observe_flight_details(
self, flight_id: str
) -> Tuple[Optional[observation_api.GetDetailsResponse], fetch.Query]:
query = fetch.query_and_describe(
self.session, "GET", f"/display_data/{flight_id}", scope=self.rid_version.read_scope
self.session,
"GET",
f"/display_data/{flight_id}",
scope=self.rid_version.read_scope,
)
try:
result = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
from uas_standards.ansi_cta_2063_a import SerialNumber
from uas_standards.astm.f3411 import v22a

from monitoring.monitorlib.fetch.rid import FetchedFlights
from monitoring.monitorlib.fetch.rid import (
FetchedFlights
FetchedUSSFlightDetails,
FetchedUSSFlights,
FlightDetails,
)
from monitoring.monitorlib.fetch.rid import FetchedUSSFlightDetails, FetchedUSSFlights, FlightDetails
from monitoring.monitorlib.geo import validate_lat, validate_lng
from monitoring.monitorlib.rid import RIDVersion
from monitoring.uss_qualifier.common_data_definitions import Severity
Expand Down Expand Up @@ -45,13 +47,11 @@ def evaluate_sp_details(self, details: FlightDetails, participants: List[str]):
details.v22a_value.get("operator_location"), participants
)

def evaluate_dp_details(self, observed_details: Optional[FlightDetails], injected_flight, participants):
self.evaluate_operator_id(
observed_details.get("operator_id"), participants
)
self.evaluate_uas_id(
observed_details.get("uas_id"), participants
)
def evaluate_dp_details(
self, observed_details: Optional[FlightDetails], injected_flight, participants
):
self.evaluate_operator_id(observed_details.get("operator_id"), participants)
self.evaluate_uas_id(observed_details.get("uas_id"), participants)
self.evaluate_operator_location(
observed_details.get("operator_location"), participants
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ def step_under_test(self: UnitTestScenario):
def test_operational_status():
_assert_operational_status("Undeclared", True) # v19 and v22a
_assert_operational_status("Emergency", True) # v22a only
_assert_operational_status("Invalid", False) # Invalid
_assert_operational_status("Invalid", False) # Invalid
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def _evaluate_normal_observation(
mapping.injected_flight,
participants=[
observer.participant_id,
mapping.injected_flight.uss_participant_id
mapping.injected_flight.uss_participant_id,
],
)

Expand Down

0 comments on commit 1fb2774

Please sign in to comment.