@@ -34,57 +34,10 @@ class Meta:
3434 verbose_name_plural = _ ('Statistics' )
3535
3636
37- class Province (models .Model ):
38-
39- locationId = models .IntegerField (_ ('locationId' ))
40- provinceName = models .CharField (_ ('provinceName' ), max_length = 50 )
41- provinceShortName = models .CharField (_ ('provinceShortName' ), max_length = 20 )
42- currentConfirmedCount = models .IntegerField (_ ('currentConfirmedCount' ), default = 0 )
43- confirmedCount = models .IntegerField (_ ('confirmedCount' ), default = 0 )
44- suspectedCount = models .IntegerField (_ ('suspectedCount' ), default = 0 )
45- curedCount = models .IntegerField (_ ('curedCount' ), default = 0 )
46- deadCount = models .IntegerField (_ ('deadCount' ), default = 0 )
47- comment = models .CharField (_ ('comment' ), max_length = 200 )
48- statisticsData = models .CharField (_ ('statisticsData' ), max_length = 500 )
49- dailyData = models .TextField (_ ('dailyData' ))
50- createTime = models .DateTimeField (_ ('createTime' ), auto_now_add = True , editable = False )
51- modifyTime = models .DateTimeField (_ ('modifyTime' ), auto_now = True , editable = False )
52-
53- class Meta :
54- verbose_name = _ ('Province' )
55- verbose_name_plural = _ ('Province' )
56-
57-
58- class City (models .Model ):
59-
60- locationId = models .IntegerField (_ ('locationId' ))
61- cityName = models .CharField (_ ('cityName' ), max_length = 50 )
62- currentConfirmedCount = models .IntegerField (_ ('currentConfirmedCount' ), default = 0 )
63- confirmedCount = models .IntegerField (_ ('confirmedCount' ), default = 0 )
64- suspectedCount = models .IntegerField (_ ('suspectedCount' ), default = 0 )
65- curedCount = models .IntegerField (_ ('curedCount' ), default = 0 )
66- deadCount = models .IntegerField (_ ('deadCount' ), default = 0 )
67- createTime = models .DateTimeField (_ ('createTime' ), auto_now_add = True , editable = False )
68- modifyTime = models .DateTimeField (_ ('modifyTime' ), auto_now = True , editable = False )
69- province = models .ForeignKey (
70- "Province" , verbose_name = _ ('province' ), on_delete = models .CASCADE ,
71- related_name = "cities" , db_column = "provinceId"
72- )
73-
74- @property
75- def provinceName (self ):
76- return self .province .provinceName
77-
78- class Meta :
79- verbose_name = _ ('City' )
80- verbose_name_plural = _ ('City' )
81-
82-
8337class Country (models .Model ):
8438
85- locationId = models .IntegerField ()
8639 continents = models .CharField (max_length = 50 )
87- countryShortCode = models .CharField (max_length = 20 )
40+ countryCode = models .CharField (max_length = 20 )
8841 countryName = models .CharField (max_length = 50 )
8942 countryFullName = models .CharField (max_length = 50 )
9043 currentConfirmedCount = models .IntegerField (default = 0 )
@@ -113,44 +66,41 @@ class Meta:
11366 verbose_name_plural = _ ('Country' )
11467
11568
116- class State (models .Model ):
117-
118- countryShortCode = models .CharField (max_length = 20 )
119- stateName = models .CharField (max_length = 50 , null = False )
120- currentUrl = models .URLField (max_length = 200 , null = True , blank = True )
121- dailyUrl = models .URLField (max_length = 200 , null = True , blank = True )
122- dailyData = models .TextField (default = '[]' ) # save daily data here
123-
124- # fields in covidtracking api
125- state = models .CharField (max_length = 10 , null = False )
126- positive = models .IntegerField (null = True , blank = True )
127- negative = models .IntegerField (null = True , blank = True )
128- positiveScore = models .IntegerField (null = True , blank = True )
129- negativeScore = models .IntegerField (null = True , blank = True )
130- negativeRegularScore = models .IntegerField (null = True , blank = True )
131- commercialScore = models .IntegerField (null = True , blank = True )
132- score = models .IntegerField (null = True , blank = True )
133- notes = models .TextField (null = True , blank = True )
134- dataQualityGrade = models .CharField (max_length = 20 , null = True , blank = True )
135- pending = models .IntegerField (null = True , blank = True )
136- hospitalizedCurrently = models .IntegerField (null = True , blank = True )
137- hospitalizedCumulative = models .IntegerField (null = True , blank = True )
138- inIcuCurrently = models .IntegerField (null = True , blank = True )
139- inIcuCumulative = models .IntegerField (null = True , blank = True )
140- onVentilatorCurrently = models .IntegerField (null = True , blank = True )
141- onVentilatorCumulative = models .IntegerField (null = True , blank = True )
142- recovered = models .IntegerField (null = True , blank = True )
143- lastUpdateEt = models .CharField (max_length = 20 , null = True , blank = True )
144- checkTimeEt = models .CharField (max_length = 20 , null = True , blank = True )
145- death = models .IntegerField (null = True , blank = True )
146- hospitalized = models .IntegerField (null = True , blank = True )
147- totalTestResults = models .IntegerField (null = True , blank = True )
148- posNeg = models .IntegerField (null = True , blank = True )
149- fips = models .CharField (max_length = 20 , null = True , blank = True )
150- dateModified = models .CharField (max_length = 50 , null = True , blank = True )
151- dateChecked = models .CharField (max_length = 50 , null = True , blank = True )
152- hash = models .CharField (max_length = 100 , null = True , blank = True )
69+ class Province (models .Model ):
70+
71+ countryCode = models .CharField (_ ('countryCode' ), max_length = 20 )
72+ provinceName = models .CharField (_ ('provinceName' ), max_length = 50 )
73+ provinceCode = models .CharField (_ ('provinceCode' ), max_length = 20 )
74+ currentConfirmedCount = models .IntegerField (_ ('currentConfirmedCount' ), default = 0 )
75+ confirmedCount = models .IntegerField (_ ('confirmedCount' ), default = 0 )
76+ suspectedCount = models .IntegerField (_ ('suspectedCount' ), default = 0 )
77+ curedCount = models .IntegerField (_ ('curedCount' ), default = 0 )
78+ deadCount = models .IntegerField (_ ('deadCount' ), default = 0 )
79+ dailyUrl = models .URLField (_ ('dailyUrl' ), null = True , blank = True )
80+ currentUrl = models .URLField (_ ('currentUrl' ), null = True , blank = True )
81+ dailyData = models .TextField (_ ('dailyData' ), default = '[]' )
82+ createTime = models .DateTimeField (_ ('createTime' ), auto_now_add = True , editable = False )
83+ modifyTime = models .DateTimeField (_ ('modifyTime' ), auto_now = True , editable = False )
84+
85+ class Meta :
86+ verbose_name = _ ('Province' )
87+ verbose_name_plural = _ ('Province' )
88+
89+
90+ class City (models .Model ):
91+
92+ countryCode = models .CharField (_ ('countryCode' ), max_length = 20 )
93+ provinceCode = models .CharField (_ ('provinceCode' ), max_length = 20 )
94+ provinceName = models .CharField (_ ('provinceName' ), max_length = 50 )
95+ cityName = models .CharField (_ ('cityName' ), max_length = 50 )
96+ currentConfirmedCount = models .IntegerField (_ ('currentConfirmedCount' ), default = 0 )
97+ confirmedCount = models .IntegerField (_ ('confirmedCount' ), default = 0 )
98+ suspectedCount = models .IntegerField (_ ('suspectedCount' ), default = 0 )
99+ curedCount = models .IntegerField (_ ('curedCount' ), default = 0 )
100+ deadCount = models .IntegerField (_ ('deadCount' ), default = 0 )
101+ createTime = models .DateTimeField (_ ('createTime' ), auto_now_add = True , editable = False )
102+ modifyTime = models .DateTimeField (_ ('modifyTime' ), auto_now = True , editable = False )
153103
154104 class Meta :
155- verbose_name = _ ('State ' )
156- verbose_name_plural = _ ('State ' )
105+ verbose_name = _ ('City ' )
106+ verbose_name_plural = _ ('City ' )
0 commit comments