WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: gwwilk on November 23, 2013, 12:54:21 PM

Title: OBSOLETE! Scripts to Display CDC Influenza Maps
Post by: gwwilk on November 23, 2013, 12:54:21 PM
Since the flu season is upon us, this set of Saratoga template scripts displays current and past CDC Influenza Activity Maps.  There are two views, the Current Influenza Season which displays maps for the current and past weeks from 2007-2008 through the current Season and week, and Past Influenza Seasons which displays maps for all weeks from 2007-2008 though the most recent complete season.

There are four settings that require configuration: the page width, $divWidth; the image to show when a map is missing from the CDC archive, $missingImage; a flag to determine whether W3C validation is not desired, $invalidOK; and whether to use 'onclick' rather than 'onmouseover' to display new maps, $useOnClick.

I've included a 'missing-piece.jpg' to display when no image is found in the CDC archives for a given week, and I've added it to the 'ajax-images' directory on my site.  You can put it anywhere on your site so long as you include the correct path to the image.  This image will display when 'onerror' is encountered by the JavaScript code.  While all four major browsers currently support this image attribute, W3C's validation does not.  If you desire complete compliance with W3C's validator, set $invalidOK to 'false'.  Using this setting displays the 'alt=' text instead.

The maps are 1132px wide at native resolution.  This is the resolution at which the maps display in the Saratoga template 'widescreen' mode.  At this resolution the hyperlink to 'Larger Map in New Tab' is disabled, but it is active at all smaller resolutions.

When using 'onmouseover' by setting '$useOnClick = false' the map that is immediately displayed will often be the one beneath the dropdown menu's week that is clicked rather than the most recent map.  This is easily remedied by mousing over the desired season's map.  I, for one, get annoyed by repetitive mouse clicks, so I often use the mouseover option in my scripts.  You get to choose your preferred presentation.

I've tried to debug the map changeover to a new year in late December and early January, but this code might need refinement come year's end.  Hence the persistence of some commented out primitive debugging code.  I think the code to display a new map each Friday at 11AM Eastern Time of the most recent week's data is solid, but I'm not quite sure when the CDC posts the new map.  Their site just says 'each Friday'.

The CDC's 'FluView' has been evolving for the past several years, and they aren't nearly as sophisticated as the NWS when it comes to image consistency and thorough archiving of images.  Nevertheless they do deserve credit for compiling the data, creating the maps, and archiving them.

The main two scripts to reference in your menu system are 'wxflumap.php' (http://www.gwwilkins.org/wxflumap.php) for the current season and 'wxpastflumap.php' (http://www.gwwilkins.org/wxpastflumap.php) for past seasons.

Thanks to John Gillett for his suggestions and for helping to debug the scripts.

Edit 2014 Jan 14:  There were errors in the coding to determine the current flu season's year so that the years were wrong in several places.  These errors have been corrected in wxflumaps2.zip but bear in mind that only wxflumap.php and inc-flumap.php have changed.  All of the rest of the files are unchanged from the original zip distribution which is no longer available for obvious reasons.

Edit 2014 April 11:  Another error in the coding of the flu maps package has been unearthed.  The Past Flumaps were trying to access a current map in an archive because of a coding error involving the use of the wrong variable.  Also, the lack of parentheses in ternary operator statements could for some web hosts result in no current map display.  Both of these problems have been fixed in wxflumaps2a.zip

Edit 2014 Oct 3:  The start of Influenza season wasn't properly configured in these scripts.  Version 3 fixes this problem.

Edit2 2014 Oct 3:  The start of Influenza season is still not quite right.  Version 3a applies band aids, but only the next few weeks will tell the tale.

Edit 2014 Oct 14:  The first map of the 2014-2015 season has been up for a few days, and version 3a wasn't displaying it.  Version 3b displays it correctly.

Edit 2015 Jan 11:  There have been several problems with this script's displays over the past 3 weeks.  Version 4 attempts to correct them, but there will need to be some changes made to the past flu maps display as well.

Edit 2015 Jan 13:  Version4 didn't display the flu maps correctly again as of today.  Version 4a addresses this problem while the past flu maps haven't been addressed as yet.

Edit 2015 Jan 15:  Versions bombed out today.  Version 3b provides an interim fix for the 'week 53 produced when Jan 3 falls on Saturday' problem.

Edit 2015 Jan 16:  Version 5 contains FluMap and Past FluMap script revisions.  There were a number of factors that required rewriting the scripts, including maps through 2009 using a leading zero to identify maps from week 1 through week 9.  The CDC's map download isn't working today for this year's week 1 map, so I'm not sure what they are doing there.

Edit 2015 Jan 17:  The logic I developed for displaying the past FluMaps for seasons up to 2010 in the Past Maps wasn't carried over into the Current FluMaps script.  This only affects 'inc-flumaps.php' and is corrected in V5a.

Edit 2015 Jan 24:  Getting closer with version 5b.  They reverted to leading zeros in the map week names as of 2015!  Next week may see another change of two after which things should be stable for a while.

Edit 2015 Jan 30:  No surprise, there was a problem displaying this week's map.  Version 5c fixes it.

Edit 2015 Feb 11:  The Past Flumaps display for the 2014-2015 season would have failed next year without modification.  This version, 5D, is supposed to avoid that eventuality.

Edit 2015 May 22:  As anticipated, there are 'end-of-season' problems.  So far the logic that indicated the end of the current flu season has proven to be flawed.  Version 5E corrects this problem.

Edit 2015 May 29:  The last map, week 20, of the current season didn't display with 5E, as anticipated.  Version 5F appears to work correctly in displaying all maps.  As expected the 'Out of Season' message will reappear as this script's output next week.

Edit 2015 June 7:  With the end of the current flu season now past, I wanted to revise the past flu map script so that it would display the season just ended as well as all other prior seasons.  It turned out to be a messy problem, but Version 6 contains a past flu map script that does the trick.  I'm leaving Version 5f up as well because its past flu map script will see all prior seasons except the one just ended.

Edit 2017 May 26:  These scripts are now obsolete in view of the CDC's vastly improved presentation of past and present influenza seasons.  On my site I now just link to the CDC's flu map page (https://www.cdc.gov/flu/weekly/usmap.htm).
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on December 08, 2013, 12:04:01 PM
Thanks Jerry for another nice script.  =D>   As of today, Sunday, (12/8/13) the CDC has not updated the map through last Friday as yet. Perhaps not until Monday morning.

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on December 08, 2013, 01:33:33 PM
Thanks Jerry for another nice script.  =D>   As of today, Sunday, (12/8/13) the CDC has not updated the map through last Friday as yet. Perhaps not until Monday morning.

Jeff

Thanks for the kind words.  To answer your concern, the latest map was posted Friday, Dec. 6, Jeff.  Mouse over the prior years' week 48 and you'll see that the date progresses as you go back in time, until you see it jump back to Nov. 29 in 2008-2009.  A week ago Friday they posted week 47, and this past Friday they posted week 48.

Remember that the data for the prior week ending on Saturday is received by Tuesday the following week in order to be posted on Friday the following week.  Ergo we see week 48 ending on a week from yesterday (Saturday Nov. 30).

I hope my explanation doesn't just add to the confusion... :?
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on December 09, 2013, 07:43:21 AM
Jerry,

Perfectly clear ...  \:D/

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 12, 2014, 08:20:41 AM
I finally checked the Flumaps this morning only to discover coding errors regarding the year after 2014 arrived.  These errors have been corrected in wxflumap2.zip attached to the first post above.  The original wxflumap.zip is no longer available.  I may need to revisit these scripts at the start of the 2014-2015 flu season to ensure they're working as intended.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on April 11, 2014, 08:28:50 PM
A couple more bugs have emerged in the capable hands of John Gillett.  :-)

The Past Flumaps were trying to access a current map in an archive because of a coding error involving the use of the wrong variable.  Also, the lack of parentheses in ternary operator statements could for some web hosts result in no current map display.  Both of these problems have been fixed in wxflumaps2a.zip above.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: ed2kayak on April 15, 2014, 09:56:43 PM
Jerry,

Thanks for update!

Ed
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on October 03, 2014, 06:12:09 AM
This script was written after the 2013-2014 Influenza season had begun, and it didn't have a lock on the start of a new Influenza season.  It still doesn't, but the attached modified 'wxflumap3.zip' delays the map display until the first full week in October has passed.  Further modifications might be needed...

All previous versions have been removed.

Edit 3 Oct 2104 2:30pm CDT:  The scripts still may not be quite right for the start of the flu season.  Version 3a applies band aids, but might require further attention over the next couple of weeks.

Edit 14 Oct 2014:  The map for week 40 has been up for a few days, but version 3a isn't displaying it.  Version 3b displays it correctly.

Edit 10 Jan 2015:  This version has been deprecated...
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 11, 2015, 09:56:17 AM
There have been several issues with this script over the past 3 weeks that have required some modifications.  I wasn't aware that on the years where January 3 is a Saturday there is a 'week 53' map produced before the 'week 1' map is made.  This version 4 correctly displays the week 53 maps this week, but because this version displays 'week 53' as 'week 1', I'm not sure what's going to happen next Friday when a new map appears.

This version 4 is very much an interim version that just deals with this year's problem by displaying the same maps for 'week 53' and 'week 1'.  I haven't addressed the problem yet in the past flumaps display.

Edit 2014 Jan 13:  Version4 removed due to errors in display as of today.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 13, 2015, 09:49:48 AM
This is still a work in progress.  :-( The current maps in version 4 didn't display correctly today,  #-o so the Version 4a corrects this problem.  More updates are probably on the way as we work our way to the end of this week.  I have as yet to address the past flumaps script.  Version4 has been deleted from the previous post.

Edit 15 Jan 2015:  Version 4a bombed out today.  Use the old Version 3b until I can fix the 'week 53 produced when Jan 3 is a Saturday' problem.

Edit 24 Jan 2015:  Version 3b will NOT display 2015's maps.  Use Version 5b in the first post instead.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on January 15, 2015, 12:09:59 PM
Jerry,

You're making good progress. Thanks for the updates and devoted time. Much appreciated !!!  =D>

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 16, 2015, 02:03:39 PM
Unfortunately Version 4a bombed out totally today! :sad:

As an interim fix, use the old Version 3b attached.  I'm working, albeit making slow progress, on fixing up the 'week 53 when Jan 3 falls on Saturday' problem.

Edit 2015 Jan 16:  Version 3b removed in favor of Version 5 below.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on January 16, 2015, 03:18:15 PM
Switched to Version 3b ...

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 17, 2015, 03:05:40 PM
Version 5 contains FluMap and Past FluMap script revisions.  There were a number of factors that required major rewriting of the scripts, including the CDC using a leading zero to identify maps from week 1 through week 9 up until 2010 as well as problems with weeks 53, 1, and 2.

The CDC's map download isn't working today for this year's week 1 map, so I'm not sure what they are doing there.  Another slight revision may be needed once this map appears for download.

Here are the links to my Current Flumaps (http://www.gwwilkins.org/wxflumap.php) and my Past FluMaps (http://www.gwwilkins.org/wxpastflumap.php) pages.

Edit 2015 Jan 17:  The logic I developed for displaying the past FluMaps for seasons up to 2010 in the Past Maps wasn't carried over into the Current FluMaps script.  This only affects 'inc-flumaps.php' and is corrected in V5a.

Edit 2015 Jan 24:  Version 5a has been supplanted by 5b because the CDC has reverted to leading zeros in the week numbers as of 2015.

Edit 2015 Jan 30:  Version 5c in the top post fixes the display of today's week 3 map.  Hopefully no further modifications will need to be made (this year anyway).
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on January 17, 2015, 03:41:23 PM
Jerry,

Updated to Version "5". Thanks.

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 17, 2015, 03:52:23 PM
Jerry,

Updated to Version "5". Thanks.

Jeff
I don't think you updated all six scripts, Jeff.  You are missing past maps that should be there.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on January 17, 2015, 03:56:52 PM
It's on the server. Any settings that I need to make?
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 17, 2015, 05:03:09 PM
It's on the server. Any settings that I need to make?
All's well now,  Jeff. Must have been a cache issue on the server.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Silversword on January 18, 2015, 12:00:09 AM
Hi Jerry,

I was just checking out your flu site and noticed that when I selected either week 1 and week 2 for 2015, above the map shows up as week 1 and week 2 for 2014.  Don't know if the map is correct or not for either for 2014 or 1015 for those two week for those years.

Another tweak, maybe??

I have not implemented this page yet.

Regards,

--Stan Y.
   Maui, Hawaii



Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 18, 2015, 12:20:10 AM
There aren't any maps that are downloadable for those weeks as yet, Stan.  Hence I've omitted the links.  The last link is 2013-2014 for weeks 1 & 2.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Silversword on January 18, 2015, 12:42:43 AM
Hi Jerry,

That explains the issue.

If/when time permits I will try to set one up on my site.

Thanks for your contributions for this project.

Regards,

--Stan Y.
   Maui, Hawaii
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 18, 2015, 12:52:36 AM
The logic I developed for displaying the past FluMaps for seasons up to 2010 in the Past Maps wasn't carried over into the Current FluMaps script.  This only affects 'inc-flumaps.php' and is corrected in V5a in the first post above.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Gregal on January 18, 2015, 08:13:29 AM
Ditto what Stan Y said, I am seeing the same thing as well as when I check SE Lincoln Site I am see the same thing.  See attached screen shot.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 18, 2015, 08:57:35 AM
Those maps aren't downloadable right now for some reason.  Week 1 wasn't available when I revised the script Friday, and it still isn't.  The 'Downloadable Version' (http://www.cdc.gov/flu/weekly/downloadimage.htm?w=1) link for week 1 isn't functioning right now, and I can't find it in the archive.

Once the CDC has things working again, and hopefully they will, I'll revise the script to include the 2014-2015 Weeks 1-20.  There are other ways I could indicate the unavailability of the map(s), and I will if the CDC continues to withhold the 2015 maps, but I doubt they will.  If they withhold the maps from public distribution, the entire 'FluMap' exercise becomes pointless.  The information used to generate the maps comes from thousands of individuals and institutions who have every right to use the maps as they see fit, e.g. in presentations and on their web sites.  These are public not proprietary documents.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 24, 2015, 04:27:32 PM
Version 5b in the first post above displays the current and past year maps.  The CDC reverted to leading zeros in the week number as of 2015.  Yesterday the 2015 week 2 map was rotated 90° clockwise, but it's oriented correctly now.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Silversword on January 24, 2015, 06:56:25 PM
Hi Jerry,

Thanks for the updates.  I still have not have a chance to install this on my site.  Hope to work on it after I get some other things out of the way.

Noticed that your latest version is looking good but there seems to be one error for being compliant with W3C that shows:

 Line 1093, Column 376: there is no attribute "onerror"

…2007-2008/images/usmap02.jpg" onerror="replaceImage(this, 'ajax-images/missing…

Otherwise, can't see a difference on viewing this page.

Just an observation.

Thanks for all for this project.

--Stan Y.
   Maui, Hawaii
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 24, 2015, 10:31:12 PM
There's a switch in 'wxflumap. php'  to turn off validation,  but I have left it set to 'invalid-ok'.  This renders the script invalid when checked as you know. ☺
Title: Re: Scripts to Display CDC Influenza Maps
Post by: CamarilloWX on January 30, 2015, 05:10:46 PM
Very cool script, thanks for sharing.  It appears to be having issues with the new map.  The image source is:

Code: [Select]
http://www.cdc.gov/flu/weekly/weeklyarchives2014-2015/images/usmap3.jpg
It should be:

Code: [Select]
http://www.cdc.gov/flu/weekly/weeklyarchives2014-2015/images/usmap03.jpg
I took a look at the script to see if I could find a fix but it is beyond my skill level.  :-)
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 30, 2015, 05:25:14 PM
Very cool script, thanks for sharing.  It appears to be having issues with the new map.  The image source is:

Code: [Select]
http://www.cdc.gov/flu/weekly/weeklyarchives2014-2015/images/usmap3.jpg
It should be:

Code: [Select]
http://www.cdc.gov/flu/weekly/weeklyarchives2014-2015/images/usmap03.jpg
I took a look at the script to see if I could find a fix but it is beyond my skill level.  :-)
I've been working on a fix for the past hour or so, and I think I've finally got it in V5c, in the top post above and here.

Edit 2015 Feb 11:  No biggie right now, but the Past Flumaps display for the 2014-2015 season would have failed next year without modification.  This version, 5D, is supposed to avoid that eventuality.  Time will tell.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on January 31, 2015, 10:34:58 AM
Jerry,

Looking good !!!!!!!!!!!    \:D/

Thanks much for your time and effort.

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: W3DRM on January 31, 2015, 12:30:08 PM
+1

Just installed 5c and it looks great to me. No issues detected, so far.

GREAT JOB  =D> =D> =D>
Title: Re: Scripts to Display CDC Influenza Maps
Post by: CamarilloWX on January 31, 2015, 10:12:52 PM
Works great!  Thanks again for sharing.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: SteveJ on February 02, 2015, 12:42:34 AM
Downloaded, unzipped, uploaded...

and it JUST WORKS!

http://weather.lakewebster.com/wxflumap.php

Nicely done and thank you!
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on February 11, 2015, 12:14:57 PM
Trying to get ahead of the game here...

The Past Flumaps display for the 2014-2015 season would have failed next year without modification.  The version 5D, in the first post of this thread, is supposed to avoid that eventuality.  Time will tell.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on May 22, 2015, 08:03:40 AM
As anticipated, there are 'end-of-season' problems with this script.  The first problem so far is that the logic that indicated the end of the current flu season has proven to be flawed.  Version 5E in the first post corrects this problem, for now at least.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on May 23, 2015, 08:12:21 AM
Thanks for the update, Jerry.   :grin:  Much appreciated !!!

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on May 29, 2015, 12:29:59 PM
The final version of the 'Flumaps' for this season, 5F, is now attached to the first post of this thread.  It was no surprise when the end-of-season logic fell over again today.  Version 5F should display the current week 20 correctly.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on May 30, 2015, 08:44:07 AM
Thanks Jerry ...  :-)  Will next year's flu maps require as many updates  :?: This is a lot of work on your part .

Your efforts are much appreciated  =D>

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on May 30, 2015, 09:07:40 AM
My problem has been trying to fathom the CDC's use of weeks and the fact that some seasons, like this one, include a 53rd week.  :-)  In addition there isn't absolute consistency regarding leading zeroes in their filenames.  There can be leading zero differences season by season and the scripts will need to keep up with them.

The next issue will be displaying the 2014-2015 season in 'Past Seasons' when this season is over.  I made a premature stab at it yesterday, but the results weren't pretty!
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on May 30, 2015, 09:28:40 AM
Geeeez Jerry,

With all of the issues not within your control, maybe you should consider putting this project on the shelf.  :-k, but you're the type that thrives on challenges ...
A really nice script  \:D/


Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on May 30, 2015, 09:55:51 AM
Geeeez Jerry,

With all of the issues not within your control, maybe you should consider putting this project on the shelf.
"Software is never finished, only abandoned", to paraphrase Leonardo da Vinci as many have done.
Quote
:-k, but you're the type that thrives on challenges ...
Yes, I do like puzzles...
Quote
A really nice script  \:D/
:oops:
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on June 07, 2015, 09:39:38 PM
With the end of the current flu season now past, I wanted to revise the past flu map script so that it would display the season just ended as well as all other prior seasons.  It turned out to be a messy problem, but Version 6 in the top post contains a past flu map version that does the trick.  I'm leaving Version 5f up as well because its past flu map script will see all prior seasons except the one just ended.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on June 08, 2015, 09:47:36 AM
Thanks Jerry   :!:

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on October 19, 2015, 10:32:19 AM
With the influenza season upon us it was time to check these scripts again, and to no one's surprise they came up wanting.  The problems had largely to do with the CDC's use of 'week 53' which made their 'week 1' what is 'week 2' by everyone else's reckoning.  The current season that 'wxflumap.php' was trying to display was this week a non-existent 'Week 41'.  This has been fixed in the current version (http://gwwilkins.org/wxflumap.php) on my site.  Download the main script here (http://gwwilkins.org/wxflumap.php?sce=view) by Right clicking on the source, selecting 'Save as...', and saving without the '.txt'.  The selection script (http://www.gwwilkins.org/flumap-select.php?sce=view) and include script (http://www.gwwilkins.org/inc-flumap.php?sce=view) can be similarly saved.

The past season flu map scripts were also broken, primarily because the 'week 53' problem.  It too has been fixed (http://gwwilkins.org/wxpastflumap.php).  The primary script can be downloaded here (http://www.gwwilkins.org/wxpastflumap.php?sce=view), as can the selection script (http://www.gwwilkins.org/pastflumap-select.php?sce=view) and the include script (http://gwwilkins.org/inc-pastflumap.php?sce=view).

All these scripts are now versioned with the year with 'a' for Spring and 'b' for Fall followed by a version number for that season.  The scripts are still a bit gnarly-looking, but hopefully over time they can be smoothed out. :-)
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on October 19, 2015, 03:27:29 PM
Jerry,

Thanks for all of the updates. Much appreciated ...  \:D/

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on October 19, 2015, 03:42:39 PM
Jerry,

Thanks for all of the updates. Much appreciated ...  \:D/

Jeff
You're welcome, Jeff.  Just FYI because it won't matter this year, I just now changed the '$outOfSeason' logic from
Code: [Select]
$outOfSeason = ($currentWeek>(20+$SaturdayJan3[date("Y")]) && $currentWeek<41));
to
Code: [Select]
$outOfSeason = ($currentWeek>(20+$SaturdayJan3[date("Y")]) && $currentWeek<(40+$SaturdayJan3[date("Y")]));
in order to correct this for future years.  It was 'Jerry-rigged' to work, but the why was missing.  You can just redownload the main 'wxflumap.php' script above.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on October 19, 2015, 03:50:02 PM
Done ... All set ...  =D&gt;

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 16, 2016, 09:28:25 AM
There were more bugs in the CDC Flu Map scripts that showed up during the transition from 2015 into 2016.  The modified scripts are available on my web site via the '?sce=view' download technique.  They might get through the rest of this season and beyond, but experience tells me that's probably not going to happen. ](*,) :-)  Here is the current script's output (http://www.gwwilkins.org/wxflumap.php).

Current Flu Season Scripts Version 20160116:
  wxflumap.php (http://www.gwwilkins.org/wxflumap.php?sce=view)
  flumap-select.php (http://www.gwwilkins.org/flumap-select.php?sce=view)
  inc-flumap.php (http://www.gwwilkins.org/inc-flumap.php?sce=view)

The Past Flu Season Scripts are unchanged from Oct. 2015 (http://www.wxforum.net/index.php?topic=20825.msg267067#msg267067)
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 23, 2016, 10:17:53 AM
One more bug not surprisingly emerged yesterday in this script - the current week's map wasn't referenced by the '2015-2016' link although it did display on initial page load.  The only modification was to 'inc-flumaps.php', but I've updated the version on all three scripts to today's date for consistency's sake.  Here is the current script's output (http://www.gwwilkins.org/wxflumap.php).

Current Flu Season Scripts Version 20160123:
  wxflumap.php (http://www.gwwilkins.org/wxflumap.php?sce=view)
  flumap-select.php (http://www.gwwilkins.org/flumap-select.php?sce=view)
  inc-flumap.php (http://www.gwwilkins.org/inc-flumap.php?sce=view)

The Past Flu Season Scripts are unchanged from Oct. 2015 (http://www.wxforum.net/index.php?topic=20825.msg267067#msg267067)

New bugs probably won't emerge until the end of the Flu Season, and hopefully not even then. :-|
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on January 24, 2016, 09:35:08 AM
Jerry,

Thanks for keeping your great script updated !!!  \:D/

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 26, 2016, 02:15:18 PM
I didn't quite finish the fixes to 'inc-flumap.php' on the 23rd. :oops:  The current version (http://www.gwwilkins.org/wxflumap.php) will correctly display this year's map on initial page load.  You can get the newly revised 'inc-wxflumap.php'  here (http://www.gwwilkins.org/inc-flumap.php?sce=view). (Save as usual.)
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on January 26, 2016, 04:07:03 PM
Jerry,

Got it !!! Thanks.   \:D/

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on January 30, 2016, 12:09:52 AM
There were more problems with these maps today. :-( The current week's map didn't have a link so it obviously wasn't displaying on mouseover.  This has been corrected in today's version.  The only modifications were to 'inc-flumaps.php', but I've updated the version on all three scripts to today's date for consistency's sake.  Here is the current script's output (http://www.gwwilkins.org/wxflumap.php).

Current Flu Season Scripts Version 20160129:
  wxflumap.php (http://www.gwwilkins.org/wxflumap.php?sce=view)
  flumap-select.php (http://www.gwwilkins.org/flumap-select.php?sce=view)
  inc-flumap.php (http://www.gwwilkins.org/inc-flumap.php?sce=view)

The Past Flu Season Scripts are unchanged from Oct. 2015 (http://www.wxforum.net/index.php?topic=20825.msg267067#msg267067)
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Breezy on January 31, 2016, 08:48:28 AM
Jerry, Thanks. Updated ...  :-)

Jeff
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on April 22, 2017, 09:46:46 AM
There was a huge change in the CDC's Flu Map script and presentation (https://www.cdc.gov/flu/weekly/usmap.htm) this week!  The current maps are no longer available in the same format because they've scripted the map with 'hover' changes and a slideshow of the current year with individual maps selectable at random.  It's a significant improvement over their old presentation, and better achieves what I was attempting with my 'Current Season' (https://www.gwwilkins.org/wxflumap.php) script.  Kudos to them!

BUT, their scripters didn't quite realize how past flu maps weren't regularly named, so their past season presentation isn't quite ready for prime time--it hangs, for me anyway.

I don't think I need to continue with my version of the 'Current Season', so I've merely linked to the CDC's page in my menu.  However I think there's still some merit in keeping my 'Past Seasons' (https://www.gwwilkins.org/wxpastflumap.php) in the mix, so it remains in my menu until the CDC sorts out the problems with their new presentation.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on April 23, 2017, 09:03:00 AM
Today the historical flu seasons are working on the CDC's site!  With that, my menu links only to their site for flu maps.  I really like what the CDC has done with these maps. =D&gt; \:D/ =D&gt;
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Jáchym on April 23, 2017, 09:07:52 AM
Hi,
you could use the XML feeds, I used that on my page and they (fortunately) didnt change that
http://www.meteotemplate.com/template/plugins/fluUS/
https://www.cdc.gov/flu/weekly/flureport.xml
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on April 23, 2017, 10:08:40 AM
Hi,
you could use the XML feeds, I used that on my page and they (fortunately) didnt change that
http://www.meteotemplate.com/template/plugins/fluUS/
https://www.cdc.gov/flu/weekly/flureport.xml
Looks great, Jachym!  I don't have much experience with XML feeds, so I'm not sure how to go about that.  Also, the past seasons are nice for comparison purposes.  Thinking about their presentation, it isn't that easy to compare week-by-week with a 'hover' like it is with my presentation.  I think I'll restore it as an alternative.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Jáchym on April 23, 2017, 10:26:14 AM
LOL, I can help you with XML, it is not that difficult to use in PHP and thanks for the idea, I might actually see if I can make some comparison scripts too using the XML feed

If you want to have a look at the code, you can download mine here:
http://www.meteotemplate.com/web/plugins.php

It is called "Flu U.S."

The advantage of using XML or JSON is always the fact it is less vulnerable to changes, these feeds are meant for use by others so they dont change them often (with the exception of NWS...) :D
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on April 23, 2017, 03:34:49 PM
LOL, I can help you with XML, it is not that difficult to use in PHP and thanks for the idea, I might actually see if I can make some comparison scripts too using the XML feed

If you want to have a look at the code, you can download mine here:
http://www.meteotemplate.com/web/plugins.php

It is called "Flu U.S."

The advantage of using XML or JSON is always the fact it is less vulnerable to changes, these feeds are meant for use by others so they dont change them often (with the exception of NWS...) :D
I borrowed your code and adapted it to run in the Saratoga template (https://www.gwwilkins.org/flu-main.php).  The versatility of Highcharts is very impressive--downloading charts in different formats, even!  Thanks! \:D/
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Jáchym on April 23, 2017, 05:22:55 PM
Yes, looks nice
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on April 23, 2017, 05:45:00 PM
Yes, looks nice
Thanks, Jáchym, but you did all of the heavy lifting.  I just provided a framework.  It also occurred to me that I hadn't properly credited you for your fine work.  Corrected.
Title: Re: Scripts to Display CDC Influenza Maps
Post by: Jáchym on April 23, 2017, 05:47:34 PM
NP, and thanks, it is always great to see how people co-operate here

Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on May 19, 2017, 11:44:57 PM
Just a little tweak to the code today...I rotated the array so that the latest week will be the default, like here (https://www.gwwilkins.org/flu-main.php).  I've been a little brain dead since I've been building my own server for the past couple of weeks with a Lenovo server (open box from Newegg at half price) on Linux Debian.  Lots and lots of issues, and it's not secured with SSL yet.  Doing things like trying to serve multiple secure domains from one IP address by using nginx as a reverse-proxy to apache2 on the server and to another box here (believe it or not, a Raspberry Pi!) that hosts a different site.  The site mirrors (http://selincolnwx.info) and will eventually replace my GoDaddy server. With a theoretical 1GB bandwidth up and down on my fiber connection, why not?  Plus it's a real learning experience!!! ](*,) #-o :shock: :lol:

The modified 'flu-main' code (https://www.gwwilkins.org/flu-main.php?sce=view).

Thanks again, Jáchym!
Title: Re: Scripts to Display CDC Influenza Maps
Post by: gwwilk on May 26, 2017, 10:46:59 PM
For the past two weeks the CDC's Flumap XML data file has been missing the latest data, first week 19 and now week 20, so
through no fault of his Jáchym's script (https://www.gwwilkins.org/flu-main.php) is no longer inclusive. 

Meanwhile the CDC has VASTLY improved their presentation of the Flu data.  They've also cleverly incorporated not only the display of all of this season's maps but all of the past seasons where data is available back to 2003-2004.

I've abandoned my flu maps in favor of a link to the CDC's far better presentation (https://www.cdc.gov/flu/weekly/usmap.htm). Kudos to them! =D&gt; \:D/ =D&gt;  What I originally perceived as deficiencies in the way they handled their flu maps have now been thoroughly overcome, and then some.
Title: Re: OBSOLETE! Scripts to Display CDC Influenza Maps
Post by: jgillett on May 27, 2017, 12:53:25 PM
Thank you for that update, Jerry.
Title: Re: OBSOLETE! Scripts to Display CDC Influenza Maps
Post by: Breezy on May 29, 2017, 07:54:48 AM
Thanks for the new link, Jerry  \:D/.  Happy Memorial Day ...

Jeff
Title: Re: OBSOLETE! Scripts to Display CDC Influenza Maps
Post by: Jáchym on May 29, 2017, 08:22:34 AM
I emailed them asking if the XML feed will continue.
Title: Re: OBSOLETE! Scripts to Display CDC Influenza Maps
Post by: Jáchym on June 09, 2017, 12:07:19 PM
Quote
This system only runs during weeks 40-20 of the flu season. We have moved to an abbreviated FluView report over the summer months (weeks 21-39). It will be updated again starting at week 40 of the 2017-18 season in October. Thank you for contacting CDC-INFO. For more information, please call 1-800-CDC-INFO (800-232-4636), visit www.cdc.gov and click on “Contact CDC-INFO,” or go to www.cdc.gov/info.