Skip to content

Commit c1dadfc

Browse files
committed
clean up and fix tests
1 parent c06709c commit c1dadfc

File tree

7 files changed

+328
-245
lines changed

7 files changed

+328
-245
lines changed

nhsn/delphi_nhsn/run.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ def run_module(params, logger=None):
6363
geo_mapper = GeoMapper()
6464
signal_df_dict = dict()
6565
if not nhsn_df.empty:
66-
signal_df_dict.update({signal: nhsn_df for signal in SIGNALS_MAP if signal in nhsn_df.columns})
66+
signal_df_dict.update({signal: nhsn_df for signal in SIGNALS_MAP})
6767
# some of the source backups do not include for preliminary data
6868
if not preliminary_nhsn_df.empty:
6969
signal_df_dict.update(
70-
{signal: preliminary_nhsn_df for signal in PRELIM_SIGNALS_MAP if signal in preliminary_nhsn_df.columns}
70+
{signal: preliminary_nhsn_df for signal in PRELIM_SIGNALS_MAP}
7171
)
7272

7373
for geo, signals_df in product(GEOS, signal_df_dict.items()):
@@ -94,6 +94,7 @@ def run_module(params, logger=None):
9494

9595
df["se"] = np.nan
9696
df["sample_size"] = np.nan
97+
9798
dates = create_export_csv(
9899
df,
99100
geo_res=geo,
125 Bytes
Binary file not shown.
103 Bytes
Binary file not shown.

nhsn/tests/test_data/page.json

Lines changed: 160 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -273,125 +273,166 @@
273273
"pctconfc19icubedsperchos": "0.0",
274274
"pctconffluicubedsperchos": "0.0",
275275
"pctconfrsvicubedsperchos": "0.0"
276-
},
277-
{
278-
"weekendingdate": "2021-08-21T00:00:00.000",
279-
"jurisdiction": "USA",
280-
"numinptbeds": "750150.99",
281-
"numinptbedsadult": "679540.51",
282-
"numinptbedsped": "51335.02",
283-
"numinptbedsocc": "572345.09",
284-
"numinptbedsoccadult": "526399.17",
285-
"numinptbedsoccped": "32810.36",
286-
"numicubeds": "120768.79",
287-
"numicubedsadult": "91030.4",
288-
"numicubedsped": "21419.35",
289-
"numicubedsocc": "89853.28",
290-
"numicubedsoccadult": "70595.31",
291-
"numicubedsoccped": "14112.02",
292-
"numconfc19hosppatsadult": "92782.24",
293-
"numconfc19hosppatsped": "1268.64",
294-
"totalconfc19hosppats": "94050.88",
295-
"totalconffluhosppats": "292.67",
296-
"numconfc19icupatsadult": "24692.91",
297-
"totalconfc19icupats": "24692.91",
298-
"totalconffluicupats": "45.57",
299-
"totalconfc19newadmped": "2170.0",
300-
"numconfc19newadmadult18to49": "27365.0",
301-
"totalconfc19newadmadult": "90776.0",
302-
"numconfc19newadmunk": "4827.0",
303-
"totalconfc19newadm": "92946.0",
304-
"totalconfflunewadm": "280.0",
305-
"pctinptbedsocc": "0.763",
306-
"pctconfc19inptbeds": "0.1254",
307-
"pctconffluinptbeds": "0.0004",
308-
"pcticubedsocc": "0.744",
309-
"pctconfc19icubeds": "0.2045",
310-
"pctconffluicubeds": "0.0004",
311-
"pctconfc19newadmadult": "0.9767",
312-
"pctconfc19newadmped": "0.0233",
313-
"numinptbedshosprep": "5396",
314-
"numinptbedsocchosprep": "5396",
315-
"numicubedshosprep": "5396",
316-
"numicubedsocchosprep": "5396",
317-
"totalconfc19hosppatshosprep": "5393",
318-
"totalconffluhosppatshosprep": "4417",
319-
"totalconfrsvhosppatshosprep": "0",
320-
"totalconfc19icupatshosprep": "5393",
321-
"totalconffluicupatshosprep": "4415",
322-
"totalconfrsvicupatshosprep": "0",
323-
"totalconfc19newadmpedhosprep": "5276",
324-
"totalconfc19newadmadulthosprep": "5392",
325-
"totalconfc19newadmhosprep": "5392",
326-
"totalconfflunewadmpedhosprep": "0",
327-
"totalconfflunewadmadulthosprep": "0",
328-
"totalconfflunewadmhosprep": "4415",
329-
"totalconfrsvnewadmpedhosprep": "0",
330-
"totalconfrsvnewadmadulthosprep": "0",
331-
"totalconfrsvnewadmhosprep": "0",
332-
"pctinptbedsocchosprep": "5396",
333-
"pcticubedsocchosprep": "5396",
334-
"pctconfc19inptbedshosprep": "5393",
335-
"pctconffluinptbedshosprep": "4417",
336-
"pctconfrsvinptbedshosprep": "0",
337-
"pctconfc19icubedshosprep": "5393",
338-
"pctconffluicubedshosprep": "4415",
339-
"pctconfrsvicubedshosprep": "0",
340-
"numinptbedsperchosprep": "0.9492",
341-
"numinptbedsoccperchosprep": "0.9492",
342-
"numicubedsperchosprep": "0.9492",
343-
"numicubedsoccperchosprep": "0.9492",
344-
"totalconfc19hosppatsperc": "0.9486",
345-
"totalconffluhosppatsperc": "0.777",
346-
"totalconfrsvhosppatsperc": "0.0",
347-
"totalconfc19icupatsperchosprep": "0.9486",
348-
"totalconffluicupatsperchosprep": "0.7766",
349-
"totalconfrsvicupatsperchosprep": "0.0",
350-
"totalconfc19newadmpedper": "0.9281",
351-
"totalconfc19newadmadultp": "0.9485",
352-
"totalconfc19newadmperchosprep": "94.85",
353-
"totalconfflunewadmpedper": "0.0",
354-
"totalconfflunewadmadultp": "0.0",
355-
"totalconfflunewadmperchosprep": "77.66",
356-
"totalconfrsvnewadmpedper": "0.0",
357-
"totalconfrsvnewadmadultp": "0.0",
358-
"totalconfrsvnewadmperchosprep": "0.0",
359-
"pctinptbedsoccperchosprep": "0.9492",
360-
"pcticubedsoccperchosprep": "0.9492",
361-
"pctconfc19inptbedsperchosprep": "0.9486",
362-
"pctconffluinptbedsperchosprep": "0.777",
363-
"pctconfrsvinptbedsperchosprep": "0.0",
364-
"pctconfc19icubedsperchosprep": "0.9486",
365-
"pctconffluicubedsperchosprep": "0.7766",
366-
"pctconfrsvicubedsperchosprep": "0.0",
367-
"numinptbedsperchosprepabschg": "0.07",
368-
"numinptbedsoccperchospre": "0.07",
369-
"numicubedsperchosprepabschg": "0.07",
370-
"numicubedsoccperchosprepabschg": "0.07",
371-
"totalconfc19hosppatsperc_1": "0.07",
372-
"totalconffluhosppatsperc_1": "0.14",
373-
"totalconfrsvhosppatsperc_1": "0.0",
374-
"totalconfc19icupatsperch": "0.07",
375-
"totalconffluicupatsperch": "0.19",
376-
"totalconfrsvicupatsperch": "0.0",
377-
"totalconfc19newadmpedper_1": "0.07",
378-
"totalconfc19newadmadultp_1": "0.07",
379-
"totalconfc19newadmpercho": "0.07",
380-
"totalconfflunewadmpedper_1": "0.0",
381-
"totalconfflunewadmadultp_1": "0.0",
382-
"totalconfflunewadmpercho": "0.16",
383-
"totalconfrsvnewadmpedper_1": "0.0",
384-
"totalconfrsvnewadmadultp_1": "0.0",
385-
"totalconfrsvnewadmpercho": "0.0",
386-
"pctinptbedsoccperchospre": "0.0007",
387-
"pcticubedsoccperchosprepabschg": "0.0007",
388-
"pctconfc19inptbedspercho": "0.0007",
389-
"pctconffluinptbedspercho": "0.0014",
390-
"pctconfrsvinptbedspercho": "0.0",
391-
"pctconfc19icubedsperchos": "0.0007",
392-
"pctconffluicubedsperchos": "0.0019",
393-
"pctconfrsvicubedsperchos": "0.0"
394-
},
276+
},{
277+
"weekendingdate": "2021-08-21T00:00:00.000",
278+
"jurisdiction": "USA",
279+
"numinptbeds": "691631.77",
280+
"numinptbedsadult": "626133.24",
281+
"numinptbedsped": "37667.52",
282+
"numinptbedsocc": "525785.42",
283+
"numinptbedsoccadult": "479767.94",
284+
"numinptbedsoccped": "26370.0",
285+
"numicubeds": "98235.73",
286+
"numicubedsadult": "76084.07",
287+
"numicubedsped": "8987.7",
288+
"numicubedsocc": "69971.29",
289+
"numicubedsoccadult": "55500.93",
290+
"numicubedsoccped": "6279.0",
291+
"numconfc19hosppatsadult": "8413.3",
292+
"numconfc19hosppatsped": "392.43",
293+
"totalconfc19hosppats": "8805.73",
294+
"numconffluhosppatsadult": "131.21",
295+
"numconffluhosppatsped": "21.74",
296+
"totalconffluhosppats": "4869.7",
297+
"numconfrsvhosppatsadult": "55.84",
298+
"numconfrsvhosppatsped": "17.13",
299+
"totalconfrsvhosppats": "72.96",
300+
"numconfc19icupatsadult": "1209.86",
301+
"numconfc19icupatsped": "81.13",
302+
"totalconfc19icupats": "1290.99",
303+
"numconffluicupatsadult": "12.76",
304+
"numconffluicupatsped": "3.0",
305+
"totalconffluicupats": "812.94",
306+
"numconfrsvicupatsadult": "4.86",
307+
"numconfrsvicupatsped": "2.14",
308+
"totalconfrsvicupats": "7.0",
309+
"numconfc19newadmped0to4": "277.0",
310+
"numconfc19newadmped5to17": "190.0",
311+
"totalconfc19newadmped": "533.0",
312+
"numconfc19newadmadult18to49": "1260.0",
313+
"totalconfc19newadmadult": "9851.0",
314+
"numconfc19newadmunk": "337.0",
315+
"totalconfc19newadm": "10384.0",
316+
"totalconfflunewadmped": "19.0",
317+
"totalconfflunewadmadult": "140.0",
318+
"totalconfflunewadm": "6049.0",
319+
"totalconfrsvnewadmped": "35.0",
320+
"totalconfrsvnewadmadult": "49.0",
321+
"totalconfrsvnewadm": "84.0",
322+
"pctinptbedsocc": "0.7602",
323+
"pctconfc19inptbeds": "0.0127",
324+
"pctconffluinptbeds": "0.007",
325+
"pctconfrsvinptbeds": "0.0001",
326+
"pcticubedsocc": "0.7123",
327+
"pctconfc19icubeds": "0.0131",
328+
"pctconffluicubeds": "0.0083",
329+
"pctconfrsvicubeds": "0.0001",
330+
"pctconfc19newadmadult": "0.9487",
331+
"pctconfc19newadmped": "0.0513",
332+
"pctconfflunewadmadult": "0.0231",
333+
"pctconfflunewadmped": "0.0031",
334+
"pctconfrsvnewadmadult": "0.5833",
335+
"pctconfrsvnewadmped": "0.4167",
336+
"numinptbedshosprep": "5426",
337+
"numinptbedsocchosprep": "5426",
338+
"numicubedshosprep": "5426",
339+
"numicubedsocchosprep": "5426",
340+
"totalconfc19hosppatshosprep": "5426",
341+
"totalconffluhosppatshosprep": "5426",
342+
"totalconfrsvhosppatshosprep": "470",
343+
"totalconfc19icupatshosprep": "5426",
344+
"totalconffluicupatshosprep": "5426",
345+
"totalconfrsvicupatshosprep": "469",
346+
"totalconfc19newadmpedhosprep": "5304",
347+
"totalconfc19newadmadulthosprep": "5426",
348+
"totalconfc19newadmhosprep": "5426",
349+
"totalconfflunewadmpedhosprep": "287",
350+
"totalconfflunewadmadulthosprep": "292",
351+
"totalconfflunewadmhosprep": "5426",
352+
"totalconfrsvnewadmpedhosprep": "465",
353+
"totalconfrsvnewadmadulthosprep": "467",
354+
"totalconfrsvnewadmhosprep": "469",
355+
"pctinptbedsocchosprep": "5426",
356+
"pcticubedsocchosprep": "5426",
357+
"pctconfc19inptbedshosprep": "5426",
358+
"pctconffluinptbedshosprep": "5426",
359+
"pctconfrsvinptbedshosprep": "470",
360+
"pctconfc19icubedshosprep": "5426",
361+
"pctconffluicubedshosprep": "5426",
362+
"pctconfrsvicubedshosprep": "469",
363+
"numinptbedsperchosprep": "0.9489",
364+
"numinptbedsoccperchosprep": "0.9489",
365+
"numicubedsperchosprep": "0.9489",
366+
"numicubedsoccperchosprep": "0.9489",
367+
"totalconfc19hosppatsperc": "0.9489",
368+
"totalconffluhosppatsperc": "0.9489",
369+
"totalconfrsvhosppatsperc": "0.0822",
370+
"totalconfc19icupatsperchosprep": "0.9489",
371+
"totalconffluicupatsperchosprep": "0.9489",
372+
"totalconfrsvicupatsperchosprep": "0.082",
373+
"totalconfc19newadmpedper": "0.9276",
374+
"totalconfc19newadmadultp": "0.9489",
375+
"totalconfc19newadmperchosprep": "0.9489",
376+
"totalconfflunewadmpedper": "0.0502",
377+
"totalconfflunewadmadultp": "0.0511",
378+
"totalconfflunewadmperchosprep": "0.9489",
379+
"totalconfrsvnewadmpedper": "0.0813",
380+
"totalconfrsvnewadmadultp": "0.0817",
381+
"totalconfrsvnewadmperchosprep": "0.082",
382+
"pctinptbedsoccperchosprep": "0.9489",
383+
"pcticubedsoccperchosprep": "0.9489",
384+
"pctconfc19inptbedsperchosprep": "0.9489",
385+
"pctconffluinptbedsperchosprep": "0.9489",
386+
"pctconfrsvinptbedsperchosprep": "0.0822",
387+
"pctconfc19icubedsperchosprep": "0.9489",
388+
"pctconffluicubedsperchosprep": "0.9489",
389+
"pctconfrsvicubedsperchosprep": "0.082",
390+
"numinptbedsperchosprepabschg": "-0.0014",
391+
"numinptbedsoccperchospre": "-0.0014",
392+
"numicubedsperchosprepabschg": "-0.0014",
393+
"numicubedsoccperchosprepabschg": "-0.0014",
394+
"totalconfc19hosppatsperc_1": "-0.0014",
395+
"totalconffluhosppatsperc_1": "-0.0014",
396+
"totalconfrsvhosppatsperc_1": "0.0003",
397+
"totalconfc19icupatsperch": "-0.0014",
398+
"totalconffluicupatsperch": "-0.0014",
399+
"totalconfrsvicupatsperch": "0.0002",
400+
"totalconfc19newadmpedper_1": "-0.0012",
401+
"totalconfc19newadmadultp_1": "-0.0014",
402+
"totalconfc19newadmpercho": "-0.0014",
403+
"totalconfflunewadmpedper_1": "0.0",
404+
"totalconfflunewadmadultp_1": "0.0003",
405+
"totalconfflunewadmpercho": "-0.0014",
406+
"totalconfrsvnewadmpedper_1": "0.0002",
407+
"totalconfrsvnewadmadultp_1": "0.0",
408+
"totalconfrsvnewadmpercho": "0.0",
409+
"pctinptbedsoccperchospre": "-0.0014",
410+
"pcticubedsoccperchosprepabschg": "-0.0014",
411+
"pctconfc19inptbedspercho": "-0.0014",
412+
"pctconffluinptbedspercho": "-0.0014",
413+
"pctconfrsvinptbedspercho": "0.0003",
414+
"pctconfc19icubedsperchos": "-0.0014",
415+
"pctconffluicubedsperchos": "-0.0014",
416+
"pctconfrsvicubedsperchos": "0.0002",
417+
"numconfc19newadmped0to4per100k": "1.49",
418+
"numconfc19newadmped5to17per100k": "0.35",
419+
"totalconfc19newadmpedper100k": "0.73",
420+
"numconfc19newadmadult18to49per100k": "0.9",
421+
"totalconfc19newadmadultper100k": "3.73",
422+
"totalconfc19newadmper100k": "3.08",
423+
"totalconfflunewadmpedper100k": "0.03",
424+
"totalconfflunewadmadultper100k": "0.05",
425+
"totalconfflunewadmper100k": "1.79",
426+
"totalconfrsvnewadmpedper100k": "0.05",
427+
"totalconfrsvnewadmadultper100k": "0.02",
428+
"totalconfrsvnewadmper100k": "0.02",
429+
"totalconfc19newadmperchosprepabove80pct": "1",
430+
"totalconfc19newadmperchosprepabove90pct": "1",
431+
"totalconfflunewadmperchosprepabove80pct": "1",
432+
"totalconfflunewadmperchosprepabove90pct": "1",
433+
"totalconfrsvnewadmperchosprepabove80pct": "0",
434+
"totalconfrsvnewadmperchosprepabove90pct": "0"
435+
},
395436
{
396437
"weekendingdate": "2021-08-28T00:00:00.000",
397438
"jurisdiction": "CO",

0 commit comments

Comments
 (0)