Skip to content

Commit

Permalink
add national_platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
ocefpaf committed Feb 15, 2024
1 parent 5617bfc commit 760ca0d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions ioos_metrics/ioos_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
from bs4 import BeautifulSoup
from fake_useragent import UserAgent

from ioos_metrics.national_platforms import (
get_cbibs,
get_cdip,
get_coops,
get_ndbc,
get_nerrs,
get_oap,
)

logging.basicConfig(
filename="metric.log",
encoding="utf-8",
Expand Down Expand Up @@ -425,6 +434,11 @@ def update_metrics():
columns = dict(zip(functions.keys(), values, strict=False))
new_row.update(columns)

# National Platforms hits several sources and should be parallelized.
functions = [get_cbibs, get_cdip, get_coops, get_ndbc, get_nerrs, get_oap]
national_platforms = sum(parallel(joblib.delayed(function)() for function in functions))
new_row.update({"National Platforms": national_platforms})

new_row = pd.DataFrame.from_dict(data=new_row, orient="index").T

# only update numbers if it's a new day
Expand Down
2 changes: 1 addition & 1 deletion tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def test_if_metric_is_a_natural_number():
comt,
federal_partners,
hab_pilot_projects,
hf_radar_installations,
ioos_core_variables,
mbon_projects,
metadata_records,
Expand All @@ -61,7 +62,6 @@ def test_if_metric_is_a_natural_number():
qartod_manuals,
regional_associations,
regional_platforms,
hf_radar_installations,
]
for function in functions:
num = function()
Expand Down

0 comments on commit 760ca0d

Please sign in to comment.