From 52c66906e5385443b46b04f3d586152b3a9d5f04 Mon Sep 17 00:00:00 2001 From: Phil Owen <19691521+PhillipsOwen@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:48:18 -0500 Subject: [PATCH] updating to use the new unified database (apsviz + asgs_dashboard -> apsviz) --- src/common/pg_impl.py | 8 ++++---- src/server.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/common/pg_impl.py b/src/common/pg_impl.py index 88c9eda..8474ef0 100644 --- a/src/common/pg_impl.py +++ b/src/common/pg_impl.py @@ -75,7 +75,7 @@ def get_terria_map_workbench_data(self, **kwargs): max_age: int = int(kwargs['max_age']) # get the layer list - ret_val = self.exec_sql('asgs', sql) + ret_val = self.exec_sql('apsviz', sql) # check the return if ret_val == -1: @@ -96,7 +96,7 @@ def get_terria_map_workbench_data(self, **kwargs): insertion_date = dateutil.parser.parse(item['insertion_date']) date_diff = pytz.utc.localize(datetime.utcnow()) - insertion_date - # is this young enough + # is this young enough? if date_diff.days < max_age: # save the run id run_id = f"{item['instance_id']}-{item['uid']}%" @@ -133,9 +133,9 @@ def get_terria_map_catalog_data(self, **kwargs): # get the new workbench data workbench_data: dict = self.get_workbench_data(**kwargs) - # should we continue + # should we continue? if not ('Error' in workbench_data or 'Warning' in workbench_data): - # if there was workbench data use it in the data query + # if there was workbench data, use it in the data query if len(workbench_data) > 0: wb_sql: str = f",_run_id:='{'-'.join(workbench_data['workbench'][0].split('-')[:-1])}%'" else: diff --git a/src/server.py b/src/server.py index cda48b3..132a0aa 100644 --- a/src/server.py +++ b/src/server.py @@ -43,7 +43,7 @@ APP.add_middleware(CORSMiddleware, allow_origins=['*'], allow_credentials=True, allow_methods=["*"], allow_headers=["*"]) # declare the database to use -db_name: tuple = ('apsviz', 'apsviz_gauges', 'asgs') +db_name: tuple = ('apsviz', 'apsviz_gauges') # create a DB connection object db_info: PGImplementation = PGImplementation(db_name, _logger=logger) @@ -63,9 +63,9 @@ async def get_terria_map_catalog_data(grid_type: Union[str, None] = Query(defaul """ Gets the json formatted terria map UI catalog data.
Note: Leave filtering params empty if not desired. -
   grid_type: Filter by the name of the ASGS grid +
   grid_type: Filter by the name of the ECFLOW grid
   event_type: Filter by the event type -
   instance_name: Filter by the name of the ASGS instance +
   instance_name: Filter by the name of the ECFLOW instance
   met_class: Filter by the meteorological class
   storm_name: Filter by the storm name
   cycle: Filter by the cycle @@ -225,7 +225,7 @@ async def get_terria_map_catalog_data_secure(grid_type: Union[str, None] = Query
Note: Leave filtering params empty if not desired.
   grid_type: Filter by the name of the grid
   event_type: Filter by the event type -
   instance_name: Filter by the name of the ASGS instance +
   instance_name: Filter by the name of the ECFLOW instance
   met_class: Filter by the meteorological class
   storm_name: Filter by the storm name
   cycle: Filter by the cycle @@ -308,7 +308,7 @@ async def get_terria_map_catalog_data_file(file_name: Union[str, None] = Query(d
   file_name: The name of the output file (default is apsviz.json)
   grid_type: Filter by the name of the grid
   event_type: Filter by the event type -
   instance_name: Filter by the name of the ASGS instance +
   instance_name: Filter by the name of the ECFLOW instance
   met_class: Filter by the meteorological class
   storm_name: Filter by the storm name
   cycle: Filter by the cycle @@ -462,7 +462,7 @@ async def get_catalog_member_records(run_id: Union[str, None] = Query(default=No """ Gets the json formatted catalog member data.
Note: Leave filtering params empty if not desired. -
   run_id: Filter by the name of the ASGS grid. Leaving this empty will result in getting the latest records. +
   run_id: Filter by the name of the ECFLOW grid. Leaving this empty will result in getting the latest records.
   project_code: Filter by the project code.
   filter_event_type: Filter out records by event type.
   limit: limit the number of records returned. only applicable when run_id is empty. @@ -534,9 +534,9 @@ async def get_pulldown_data(grid_type: Union[str, None] = Query(default=None), e """ Gets the json formatted UI pulldown data.
Note: Leave filtering params empty if not desired. -
   grid_type: Filter by the name of the ASGS grid +
   grid_type: Filter by the name of the ECFLOW grid
   event_type: Filter by the event type -
   instance_name: Filter by the name of the ASGS instance +
   instance_name: Filter by the name of the ECFLOW instance
   met_class: Filter by the meteorological class
   storm_name: Filter by the storm name
   cycle: Filter by the cycle