Skip to content

Commit

Permalink
updating to use the new unified database (apsviz + asgs_dashboard -> …
Browse files Browse the repository at this point in the history
…apsviz)
  • Loading branch information
PhillipsOwen committed Jan 31, 2024
1 parent b10be4c commit 52c6690
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/common/pg_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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']}%"
Expand Down Expand Up @@ -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:
Expand Down
16 changes: 8 additions & 8 deletions src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.
<br/>Note: Leave filtering params empty if not desired.
<br/>&nbsp;&nbsp;&nbsp;grid_type: Filter by the name of the ASGS grid
<br/>&nbsp;&nbsp;&nbsp;grid_type: Filter by the name of the ECFLOW grid
<br/>&nbsp;&nbsp;&nbsp;event_type: Filter by the event type
<br/>&nbsp;&nbsp;&nbsp;instance_name: Filter by the name of the ASGS instance
<br/>&nbsp;&nbsp;&nbsp;instance_name: Filter by the name of the ECFLOW instance
<br/>&nbsp;&nbsp;&nbsp;met_class: Filter by the meteorological class
<br/>&nbsp;&nbsp;&nbsp;storm_name: Filter by the storm name
<br/>&nbsp;&nbsp;&nbsp;cycle: Filter by the cycle
Expand Down Expand Up @@ -225,7 +225,7 @@ async def get_terria_map_catalog_data_secure(grid_type: Union[str, None] = Query
<br/>Note: Leave filtering params empty if not desired.
<br/>&nbsp;&nbsp;&nbsp;grid_type: Filter by the name of the grid
<br/>&nbsp;&nbsp;&nbsp;event_type: Filter by the event type
<br/>&nbsp;&nbsp;&nbsp;instance_name: Filter by the name of the ASGS instance
<br/>&nbsp;&nbsp;&nbsp;instance_name: Filter by the name of the ECFLOW instance
<br/>&nbsp;&nbsp;&nbsp;met_class: Filter by the meteorological class
<br/>&nbsp;&nbsp;&nbsp;storm_name: Filter by the storm name
<br/>&nbsp;&nbsp;&nbsp;cycle: Filter by the cycle
Expand Down Expand Up @@ -308,7 +308,7 @@ async def get_terria_map_catalog_data_file(file_name: Union[str, None] = Query(d
<br/>&nbsp;&nbsp;&nbsp;file_name: The name of the output file (default is apsviz.json)
<br/>&nbsp;&nbsp;&nbsp;grid_type: Filter by the name of the grid
<br/>&nbsp;&nbsp;&nbsp;event_type: Filter by the event type
<br/>&nbsp;&nbsp;&nbsp;instance_name: Filter by the name of the ASGS instance
<br/>&nbsp;&nbsp;&nbsp;instance_name: Filter by the name of the ECFLOW instance
<br/>&nbsp;&nbsp;&nbsp;met_class: Filter by the meteorological class
<br/>&nbsp;&nbsp;&nbsp;storm_name: Filter by the storm name
<br/>&nbsp;&nbsp;&nbsp;cycle: Filter by the cycle
Expand Down Expand Up @@ -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.
<br/>Note: Leave filtering params empty if not desired.
<br/>&nbsp;&nbsp;&nbsp;run_id: Filter by the name of the ASGS grid. Leaving this empty will result in getting the latest <limit> records.
<br/>&nbsp;&nbsp;&nbsp;run_id: Filter by the name of the ECFLOW grid. Leaving this empty will result in getting the latest <limit> records.
<br/>&nbsp;&nbsp;&nbsp;project_code: Filter by the project code.
<br/>&nbsp;&nbsp;&nbsp;filter_event_type: Filter out records by event type.
<br/>&nbsp;&nbsp;&nbsp;limit: limit the number of records returned. only applicable when run_id is empty.
Expand Down Expand Up @@ -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.
<br/>Note: Leave filtering params empty if not desired.
<br/>&nbsp;&nbsp;&nbsp;grid_type: Filter by the name of the ASGS grid
<br/>&nbsp;&nbsp;&nbsp;grid_type: Filter by the name of the ECFLOW grid
<br/>&nbsp;&nbsp;&nbsp;event_type: Filter by the event type
<br/>&nbsp;&nbsp;&nbsp;instance_name: Filter by the name of the ASGS instance
<br/>&nbsp;&nbsp;&nbsp;instance_name: Filter by the name of the ECFLOW instance
<br/>&nbsp;&nbsp;&nbsp;met_class: Filter by the meteorological class
<br/>&nbsp;&nbsp;&nbsp;storm_name: Filter by the storm name
<br/>&nbsp;&nbsp;&nbsp;cycle: Filter by the cycle
Expand Down

0 comments on commit 52c6690

Please sign in to comment.