Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove "disclaimer" from code and files, fix failing test #23

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</div>

<script type="module">
import App from 'https://cdn.jsdelivr.net/gh/reichlab/predtimechart@2.0.10/dist/predtimechart.bundle.js';
import App from 'https://cdn.jsdelivr.net/gh/reichlab/predtimechart@2.0.11/dist/predtimechart.bundle.js';
document.predtimechart = App; // for debugging

function replace_chars(the_string) {
Expand Down
1 change: 0 additions & 1 deletion demo/predtimechart-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,5 @@
"current_date": "2023-05-27",
"models": ["Flusight-baseline", "MOBS-GLEAM_FLUH", "PSI-DICE"],
"initial_checked_models": ["Flusight-baseline"],
"disclaimer": "Most forecasts have failed to reliably predict rapid changes in the trends of reported cases and hospitalizations. Due to this limitation, they should not be relied upon for decisions about the possibility or timing of rapid changes in trends.",
"initial_xaxis_range": null
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from datetime import date, datetime, timedelta
import json
import re
from pathlib import Path

import click
Expand Down Expand Up @@ -56,11 +55,13 @@ def main(hub_dir, target_out_dir):
logger.info(f'main(): done: {len(json_files)} JSON files generated: {[str(_) for _ in json_files]}. ')



#
# _generate_json_files() and helpers
#
def reference_date_from_today(now: datetime = date.today()) -> datetime:
def reference_date_from_today(now: date = None) -> date:
if now is None: # per https://stackoverflow.com/questions/52511405/freeze-time-not-working-for-default-param
now = date.today()

# Calculate the days until the next Saturday
days_to_saturday = 5 - now.weekday()
if days_to_saturday < 0:
Expand Down
3 changes: 0 additions & 3 deletions src/hub_predtimechart/generate_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ def ptc_options_for_hub(hub_config: HubConfig):
options['models'].sort()
options['initial_checked_models'] = hub_config.initial_checked_models

# set `disclaimer`
options['disclaimer'] = hub_config.disclaimer

# set `initial_xaxis_range`
options['initial_xaxis_range'] = None

Expand Down
1 change: 0 additions & 1 deletion src/hub_predtimechart/hub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def __init__(self, hub_dir: Path, ptc_config_file: Path):
self.target_date_col_name = ptc_config['target_date_col_name']
self.horizon_col_name = ptc_config['horizon_col_name']
self.initial_checked_models = ptc_config['initial_checked_models']
self.disclaimer = ptc_config['disclaimer']

# set model_ids
self.model_id_to_metadata = {}
Expand Down
8 changes: 1 addition & 7 deletions src/hub_predtimechart/ptc_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
"items": {
"type": "string"
}
},
"disclaimer": {
"description": "text providing any important information users should know",
"type": "string",
"minLength": 1
}
},
"required": [
Expand All @@ -51,7 +46,6 @@
"reference_date_col_name",
"target_date_col_name",
"horizon_col_name",
"initial_checked_models",
"disclaimer"
"initial_checked_models"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,5 @@
"CADPH-FluCAT_Ensemble", "CEPH-Rtrend_fluH", "CMU-TimeSeries", "CU-ensemble", "GT-FluFNP", "ISU_NiemiLab-NLH", "JHU_CSSE-CSSE_Ensemble", "LUcompUncertLab-chimera", "LosAlamos_NAU-CModel_Flu", "MIGHTE-Nsemble", "MOBS-GLEAM_FLUH", "NIH-Flu_ARIMA", "NU_UCSD-GLEAM_AI_FLUH", "PSI-PROF", "SGroup-RandomForest", "SigSci-CREG", "SigSci-TSENS", "Stevens-GBR", "UGA_flucast-Copycat", "UGA_flucast-INFLAenza", "UGuelph-CompositeCurve", "UGuelphensemble-GRYPHON", "UM-DeepOutbreak", "UMass-flusion", "UMass-trends_ensemble", "UNC_IDD-InfluPaint", "UVAFluX-Ensemble", "VTSanghani-Ensemble", "cfa-flumech", "cfarenewal-cfaepimlight", "fjordhest-ensemble"
],
"initial_checked_models": ["UMass-flusion", "UMass-trends_ensemble"],
"disclaimer": "Most forecasts have failed to reliably predict rapid changes in the trends of reported cases and hospitalizations. Due to this limitation, they should not be relied upon for decisions about the possibility or timing of rapid changes in trends.",
"initial_xaxis_range": null
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,5 @@
"current_date": "2023-05-27",
"models": ["Flusight-baseline", "MOBS-GLEAM_FLUH", "PSI-DICE"],
"initial_checked_models": ["Flusight-baseline"],
"disclaimer": "Most forecasts have failed to reliably predict rapid changes in the trends of reported cases and hospitalizations. Due to this limitation, they should not be relied upon for decisions about the possibility or timing of rapid changes in trends.",
"initial_xaxis_range": null
}
2 changes: 1 addition & 1 deletion tests/hub_predtimechart/test_generate_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_generate_options_complex_forecast_hub():
act_options = ptc_options_for_hub(hub_config)
for exp_field in ['target_variables', 'initial_target_var', 'task_ids', 'initial_task_ids', 'intervals',
'initial_interval', 'available_as_ofs', 'initial_as_of', 'current_date', 'models',
'initial_checked_models', 'disclaimer', 'initial_xaxis_range']:
'initial_checked_models', 'initial_xaxis_range']:
assert exp_field in act_options
assert act_options[exp_field] == exp_options[exp_field]

Expand Down
1 change: 0 additions & 1 deletion tests/hub_predtimechart/test_hub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def test_hub_config_complex_forecast_hub():
assert hub_config.target_date_col_name == 'target_end_date'
assert hub_config.horizon_col_name == 'horizon'
assert hub_config.initial_checked_models == ['Flusight-baseline']
assert hub_config.disclaimer == "Most forecasts have failed to reliably predict rapid changes in the trends of reported cases and hospitalizations. Due to this limitation, they should not be relied upon for decisions about the possibility or timing of rapid changes in trends."
assert (sorted(list(hub_config.model_id_to_metadata.keys())) ==
sorted(['Flusight-baseline', 'MOBS-GLEAM_FLUH', 'PSI-DICE']))
assert hub_config.task_ids == sorted(['reference_date', 'target', 'horizon', 'location', 'target_end_date'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ reference_date_col_name: 'reference_date'
target_date_col_name: 'target_end_date'
horizon_col_name: 'horizon'
initial_checked_models: ['UMass-flusion', 'UMass-trends_ensemble']
disclaimer: Most forecasts have failed to reliably predict rapid changes in the trends of reported cases and hospitalizations. Due to this limitation, they should not be relied upon for decisions about the possibility or timing of rapid changes in trends.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ reference_date_col_name: 'reference_date'
target_date_col_name: 'target_end_date'
horizon_col_name: 'horizon'
initial_checked_models: ['Flusight-baseline']
disclaimer: Most forecasts have failed to reliably predict rapid changes in the trends of reported cases and hospitalizations. Due to this limitation, they should not be relied upon for decisions about the possibility or timing of rapid changes in trends.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ reference_date_col_name: 'origin_date'
target_date_col_name: 'origin_date' # NB: this hub is invalid for predtimechart, which requires this column but is not present here. we use a placeholder so that the config file is valid
horizon_col_name: 'horizon'
initial_checked_models: ['Flusight-baseline']
disclaimer: Most forecasts have failed to reliably predict rapid changes in the trends of reported cases and hospitalizations. Due to this limitation, they should not be relied upon for decisions about the possibility or timing of rapid changes in trends.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ reference_date_col_name: 'reference_date'
target_date_col_name: 'target_end_date'
horizon_col_name: 'horizon'
initial_checked_models: ['Flusight-baseline']
disclaimer: Most forecasts have failed to reliably predict rapid changes in the trends of reported cases and hospitalizations. Due to this limitation, they should not be relied upon for decisions about the possibility or timing of rapid changes in trends.