reichlab / Covid-19-Hub-Vizualization

2 stars 3 forks source link

add initial_as_of.json #95

Closed elray1 closed 1 year ago

elray1 commented 1 year ago

Resolves the second item under issue #94

netlify[bot] commented 1 year ago

Deploy Preview for covid-19-hub-vizualization ready!

Name Link
Latest commit 74df23a4e7881f48c77a1b1fafec6b2d4ddd38a7
Latest deploy log https://app.netlify.com/sites/covid-19-hub-vizualization/deploys/6375240130f35100081fff60
Deploy Preview https://deploy-preview-95--covid-19-hub-vizualization.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

matthewcornell commented 1 year ago

I'm confused why this line is min and not max: initial_as_of <- as.character(min(available_as_ofs[["death"]]))

elray1 commented 1 year ago

The idea is that on that line, I'm just initializing it to the lowest possible value, and then below that I'm looping over all of the as_of dates and updating to a more recent as_of date only if the forecast file exists. Extracting the logic/skipping other lines:

initial_as_of <- as.character(min(available_as_ofs[["death"]])) # some initial value that will be updated later
for (as_of in as.character(as_ofs)) {
    ...
    if (file.exists(file_path)) {
        ...
                initial_as_of <- max(initial_as_of, as_of) # update to the later as_of date only if there are forecasts for that date
    }
}
matthewcornell commented 1 year ago

Sounds good!