@@ -74,9 +74,6 @@ def pvt_cdc(
74
74
"""Fetch CDC page hits."""
75
75
epiweeks = get_wildcard_equivalent_dates (epiweeks , "day" )
76
76
77
- if auth is None or epiweeks is None or locations is None :
78
- raise InvalidArgumentException ("`auth`, `epiweeks`, and `locations` are all required" )
79
-
80
77
return self ._create_call (
81
78
"cdc/" ,
82
79
{"auth" : auth , "epiweeks" : epiweeks , "locations" : locations },
@@ -140,18 +137,15 @@ def pub_covid_hosp_facility(
140
137
) -> CALL_TYPE :
141
138
"""Fetch COVID hospitalization data for specific facilities."""
142
139
143
- if hospital_pks is None or collection_weeks is None :
144
- raise InvalidArgumentException ("`hospital_pks` and `collection_weeks` are both required" )
145
-
146
140
collection_weeks = get_wildcard_equivalent_dates (collection_weeks , "day" )
147
141
148
142
# Confusingly, the endpoint expects `collection_weeks` to be in day format,
149
143
# but correspond to epiweeks. Allow `collection_weeks` to be provided in
150
144
# either day or week format.
151
145
if isinstance (collection_weeks , EpiRange ):
152
- collection_weeks = reformat_epirange (collection_weeks , to_type = "day" )
146
+ parsed_weeks = reformat_epirange (collection_weeks , to_type = "day" )
153
147
elif isinstance (collection_weeks , (str , int )):
154
- collection_weeks = parse_api_week (collection_weeks )
148
+ parsed_weeks = parse_api_week (collection_weeks )
155
149
156
150
fields_string = [
157
151
"hospital_pk" ,
@@ -255,7 +249,7 @@ def pub_covid_hosp_facility(
255
249
"covid_hosp_facility/" ,
256
250
{
257
251
"hospital_pks" : hospital_pks ,
258
- "collection_weeks" : collection_weeks ,
252
+ "collection_weeks" : parsed_weeks ,
259
253
"publication_dates" : publication_dates ,
260
254
},
261
255
[
@@ -277,9 +271,6 @@ def pub_covid_hosp_state_timeseries(
277
271
) -> CALL_TYPE :
278
272
"""Fetch COVID hospitalization data."""
279
273
280
- if states is None or dates is None :
281
- raise InvalidArgumentException ("`states` and `dates` are both required" )
282
-
283
274
if issues is not None and as_of is not None :
284
275
raise InvalidArgumentException ("`issues` and `as_of` are mutually exclusive" )
285
276
@@ -465,20 +456,6 @@ def pub_covidcast(
465
456
lag : Optional [int ] = None ,
466
457
) -> CALL_TYPE :
467
458
"""Fetch Delphi's COVID-19 Surveillance Streams"""
468
- if any (
469
- v is None
470
- for v in (
471
- data_source ,
472
- signals ,
473
- time_type ,
474
- geo_type ,
475
- time_values ,
476
- geo_values ,
477
- )
478
- ):
479
- raise InvalidArgumentException (
480
- "`data_source`, `signals`, `time_type`, `geo_type`, `time_values`, and `geo_values` are all required."
481
- )
482
459
if sum ([issues is not None , lag is not None , as_of is not None ]) > 1 :
483
460
raise InvalidArgumentException ("`issues`, `lag`, and `as_of` are mutually exclusive." )
484
461
@@ -504,8 +481,6 @@ def pub_covidcast(
504
481
def pub_delphi (self , system : str , epiweek : Union [int , str ]) -> CALL_TYPE :
505
482
"""Fetch Delphi's forecast."""
506
483
507
- if system is None or epiweek is None :
508
- raise InvalidArgumentException ("`system` and `epiweek` are both required" )
509
484
return self ._create_call (
510
485
"delphi/" ,
511
486
{"system" : system , "epiweek" : epiweek },
@@ -521,9 +496,6 @@ def pub_dengue_nowcast(self, locations: StringParam, epiweeks: EpiRangeParam = "
521
496
"""Fetch Delphi's dengue nowcast."""
522
497
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
523
498
524
- if locations is None or epiweeks is None :
525
- raise InvalidArgumentException ("`locations` and `epiweeks` are both required" )
526
-
527
499
return self ._create_call (
528
500
"dengue_nowcast/" ,
529
501
{"locations" : locations , "epiweeks" : epiweeks },
@@ -545,9 +517,6 @@ def pvt_dengue_sensors(
545
517
"""Fetch Delphi's digital surveillance sensors."""
546
518
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
547
519
548
- if auth is None or names is None or locations is None or epiweeks is None :
549
- raise InvalidArgumentException ("`auth`, `names`, `locations`, and `epiweeks` are all required" )
550
-
551
520
return self ._create_call (
552
521
"dengue_sensors/" ,
553
522
{
@@ -574,9 +543,6 @@ def pub_ecdc_ili(
574
543
"""Fetch ECDC ILI data."""
575
544
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
576
545
577
- if regions is None or epiweeks is None :
578
- raise InvalidArgumentException ("`regions` and `epiweeks` are both required" )
579
-
580
546
if issues is not None and lag is not None :
581
547
raise InvalidArgumentException ("`issues` and `lag` are mutually exclusive" )
582
548
@@ -603,9 +569,6 @@ def pub_flusurv(
603
569
"""Fetch FluSurv data."""
604
570
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
605
571
606
- if locations is None or epiweeks is None :
607
- raise InvalidArgumentException ("`locations` and `epiweeks` are both required" )
608
-
609
572
if issues is not None and lag is not None :
610
573
raise InvalidArgumentException ("`issues` and `lag` are mutually exclusive" )
611
574
@@ -642,9 +605,6 @@ def pub_fluview_clinical(
642
605
"""Fetch FluView clinical data."""
643
606
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
644
607
645
- if regions is None or epiweeks is None :
646
- raise InvalidArgumentException ("`regions` and `epiweeks` are both required" )
647
-
648
608
if issues is not None and lag is not None :
649
609
raise InvalidArgumentException ("`issues` and `lag` are mutually exclusive" )
650
610
@@ -687,9 +647,6 @@ def pub_fluview(
687
647
) -> CALL_TYPE :
688
648
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
689
649
690
- if regions is None or epiweeks is None :
691
- raise InvalidArgumentException ("`regions` and `epiweeks` are both required" )
692
-
693
650
if issues is not None and lag is not None :
694
651
raise InvalidArgumentException ("`issues` and `lag` are mutually exclusive" )
695
652
@@ -725,9 +682,6 @@ def pub_gft(self, locations: StringParam, epiweeks: EpiRangeParam = "*") -> CALL
725
682
"""Fetch Google Flu Trends data."""
726
683
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
727
684
728
- if locations is None or epiweeks is None :
729
- raise InvalidArgumentException ("`locations` and `epiweeks` are both required" )
730
-
731
685
return self ._create_call (
732
686
"gft/" ,
733
687
{"locations" : locations , "epiweeks" : epiweeks },
@@ -746,7 +700,7 @@ def pvt_ght(
746
700
query : str = "" ,
747
701
) -> CALL_TYPE :
748
702
"""Fetch Google Health Trends data."""
749
- if auth is None or locations is None or epiweeks is None or query == "" :
703
+ if auth is None or locations is None or query == "" :
750
704
raise InvalidArgumentException ("`auth`, `locations`, `epiweeks`, and `query` are all required" )
751
705
752
706
return self ._create_call (
@@ -774,8 +728,6 @@ def pub_kcdc_ili(
774
728
"""Fetch KCDC ILI data."""
775
729
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
776
730
777
- if regions is None or epiweeks is None :
778
- raise InvalidArgumentException ("`regions` and `epiweeks` are both required" )
779
731
if issues is not None and lag is not None :
780
732
raise InvalidArgumentException ("`issues` and `lag` are mutually exclusive" )
781
733
@@ -794,8 +746,6 @@ def pub_kcdc_ili(
794
746
795
747
def pvt_meta_norostat (self , auth : str ) -> CALL_TYPE :
796
748
"""Fetch NoroSTAT metadata."""
797
- if auth is None :
798
- raise InvalidArgumentException ("`auth` is required" )
799
749
return self ._create_call (
800
750
"meta_norostat/" ,
801
751
{"auth" : auth },
@@ -814,9 +764,6 @@ def pub_nidss_dengue(self, locations: StringParam, epiweeks: EpiRangeParam = "*"
814
764
"""Fetch NIDSS dengue data."""
815
765
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
816
766
817
- if locations is None or epiweeks is None :
818
- raise InvalidArgumentException ("`locations` and `epiweeks` are both required" )
819
-
820
767
return self ._create_call (
821
768
"nidss_dengue/" ,
822
769
{"locations" : locations , "epiweeks" : epiweeks },
@@ -837,8 +784,6 @@ def pub_nidss_flu(
837
784
"""Fetch NIDSS flu data."""
838
785
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
839
786
840
- if regions is None or epiweeks is None :
841
- raise InvalidArgumentException ("`regions` and `epiweeks` are both required" )
842
787
if issues is not None and lag is not None :
843
788
raise InvalidArgumentException ("`issues` and `lag` are mutually exclusive" )
844
789
@@ -860,9 +805,6 @@ def pvt_norostat(self, auth: str, location: str, epiweeks: EpiRangeParam = "*")
860
805
"""Fetch NoroSTAT data (point data, no min/max)."""
861
806
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
862
807
863
- if auth is None or location is None or epiweeks is None :
864
- raise InvalidArgumentException ("`auth`, `location`, and `epiweeks` are all required" )
865
-
866
808
return self ._create_call (
867
809
"norostat/" ,
868
810
{"auth" : auth , "epiweeks" : epiweeks , "location" : location },
@@ -877,9 +819,6 @@ def pub_nowcast(self, locations: StringParam, epiweeks: EpiRangeParam = "*") ->
877
819
"""Fetch Delphi's wILI nowcast."""
878
820
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
879
821
880
- if locations is None or epiweeks is None :
881
- raise InvalidArgumentException ("`locations` and `epiweeks` are both required" )
882
-
883
822
return self ._create_call (
884
823
"nowcast/" ,
885
824
{"locations" : locations , "epiweeks" : epiweeks },
@@ -901,8 +840,6 @@ def pub_paho_dengue(
901
840
"""Fetch PAHO Dengue data."""
902
841
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
903
842
904
- if regions is None or epiweeks is None :
905
- raise InvalidArgumentException ("`regions` and `epiweeks` are both required" )
906
843
if issues is not None and lag is not None :
907
844
raise InvalidArgumentException ("`issues` and `lag` are mutually exclusive" )
908
845
@@ -928,9 +865,6 @@ def pvt_quidel(self, auth: str, locations: StringParam, epiweeks: EpiRangeParam
928
865
"""Fetch Quidel data."""
929
866
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
930
867
931
- if auth is None or epiweeks is None or locations is None :
932
- raise InvalidArgumentException ("`auth`, `epiweeks`, and `locations` are all required" )
933
-
934
868
return self ._create_call (
935
869
"quidel/" ,
936
870
{"auth" : auth , "epiweeks" : epiweeks , "locations" : locations },
@@ -951,9 +885,6 @@ def pvt_sensors(
951
885
"""Fetch Delphi's digital surveillance sensors."""
952
886
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
953
887
954
- if auth is None or names is None or locations is None or epiweeks is None :
955
- raise InvalidArgumentException ("`auth`, `names`, `locations`, and `epiweeks` are all required" )
956
-
957
888
return self ._create_call (
958
889
"sensors/" ,
959
890
{
@@ -987,12 +918,6 @@ def pvt_twitter(
987
918
dates = None
988
919
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
989
920
990
- if auth is None or locations is None :
991
- raise InvalidArgumentException ("`auth` and `locations` are both required" )
992
-
993
- if not (dates is None ) ^ (epiweeks is None ):
994
- raise InvalidArgumentException ("exactly one of `dates` and `epiweeks` is required" )
995
-
996
921
time_field = (
997
922
EpidataFieldInfo ("date" , EpidataFieldType .date )
998
923
if dates
@@ -1034,18 +959,6 @@ def pub_wiki(
1034
959
dates = None
1035
960
epiweeks = get_wildcard_equivalent_dates (epiweeks , "week" )
1036
961
1037
- if articles is None :
1038
- raise InvalidArgumentException ("`articles` is required" )
1039
-
1040
- if not (dates is None ) ^ (epiweeks is None ):
1041
- raise InvalidArgumentException ("exactly one of `dates` and `epiweeks` is required" )
1042
-
1043
- time_field = (
1044
- EpidataFieldInfo ("date" , EpidataFieldType .date )
1045
- if dates
1046
- else EpidataFieldInfo ("epiweek" , EpidataFieldType .epiweek )
1047
- )
1048
-
1049
962
return self ._create_call (
1050
963
"wiki/" ,
1051
964
{
@@ -1057,7 +970,11 @@ def pub_wiki(
1057
970
},
1058
971
[
1059
972
EpidataFieldInfo ("article" , EpidataFieldType .text ),
1060
- time_field ,
973
+ (
974
+ EpidataFieldInfo ("date" , EpidataFieldType .date )
975
+ if dates
976
+ else EpidataFieldInfo ("epiweek" , EpidataFieldType .epiweek )
977
+ ),
1061
978
EpidataFieldInfo ("count" , EpidataFieldType .int ),
1062
979
EpidataFieldInfo ("total" , EpidataFieldType .int ),
1063
980
EpidataFieldInfo ("hour" , EpidataFieldType .int ),
0 commit comments