Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flask-covid19
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas Wöhlke
flask-covid19
Commits
de4daf19
Commit
de4daf19
authored
4 years ago
by
thomaswoehlke
Browse files
Options
Downloads
Patches
Plain Diff
work
parent
76235ba0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
org/woehlke/covid19/europe/europe_model.py
+23
-1
23 additions, 1 deletion
org/woehlke/covid19/europe/europe_model.py
org/woehlke/covid19/europe/europe_service_update.py
+4
-14
4 additions, 14 deletions
org/woehlke/covid19/europe/europe_service_update.py
with
27 additions
and
15 deletions
org/woehlke/covid19/europe/europe_model.py
+
23
−
1
View file @
de4daf19
from
sqlalchemy
import
and_
from
sqlalchemy
import
and_
from
datetime
import
date
from
database
import
db
,
ITEMS_PER_PAGE
from
database
import
db
,
ITEMS_PER_PAGE
...
@@ -16,7 +17,6 @@ class EuropeDataImportTable(db.Model):
...
@@ -16,7 +17,6 @@ class EuropeDataImportTable(db.Model):
country_territory_code
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
)
country_territory_code
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
)
continent_exp
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
)
continent_exp
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
)
notification_rate_per_100000_population_14days
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
)
notification_rate_per_100000_population_14days
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
)
row_imported
=
db
.
Column
(
db
.
Boolean
,
nullable
=
False
,
default
=
False
)
@classmethod
@classmethod
def
remove_all
(
cls
):
def
remove_all
(
cls
):
...
@@ -90,6 +90,28 @@ class EuropeDateReported(db.Model):
...
@@ -90,6 +90,28 @@ class EuropeDateReported(db.Model):
datum
=
db
.
Column
(
db
.
Date
,
nullable
=
False
,
unique
=
True
)
datum
=
db
.
Column
(
db
.
Date
,
nullable
=
False
,
unique
=
True
)
date_rep
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
,
unique
=
True
)
date_rep
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
,
unique
=
True
)
year_week
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
,
unique
=
True
)
year_week
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
,
unique
=
True
)
week_of_year
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
)
year
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
)
month
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
)
day_of_month
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
)
@classmethod
def
create_new_object_factory
(
cls
,
my_date_rep
,
my_year_week
):
my_date_reported
=
my_date_rep
.
split
(
'
/
'
)
my_week_of_year
=
int
(
my_year_week
.
split
(
"
-
"
)[
1
])
my_year
=
int
(
my_date_reported
[
2
])
my_month
=
int
(
my_date_reported
[
1
])
my_day_of_month
=
int
(
my_date_reported
[
0
])
my_datum
=
date
(
year
=
my_year
,
month
=
my_month
,
day
=
my_day_of_month
)
return
EuropeDateReported
(
datum
=
my_datum
,
date_rep
=
my_date_rep
,
year_week
=
my_year_week
,
week_of_year
=
my_week_of_year
,
year
=
my_year
,
month
=
my_month
,
day_of_month
=
my_day_of_month
)
@classmethod
@classmethod
def
remove_all
(
cls
):
def
remove_all
(
cls
):
...
...
This diff is collapsed.
Click to expand it.
org/woehlke/covid19/europe/europe_service_update.py
+
4
−
14
View file @
de4daf19
import
os
import
os
from
datetime
import
date
from
database
import
db
,
app
from
database
import
db
,
app
from
org.woehlke.covid19.europe.europe_model
import
EuropeDataImportTable
,
\
from
org.woehlke.covid19.europe.europe_model
import
EuropeDataImportTable
,
\
EuropeDateReported
,
EuropeContinent
,
EuropeCountry
,
EuropeData
EuropeDateReported
,
EuropeContinent
,
EuropeCountry
,
EuropeData
...
@@ -19,14 +18,6 @@ class EuropeServiceUpdate:
...
@@ -19,14 +18,6 @@ class EuropeServiceUpdate:
app
.
logger
.
info
(
"
------------------------------------------------------------
"
)
app
.
logger
.
info
(
"
------------------------------------------------------------
"
)
app
.
logger
.
info
(
"
Europe Service Update [ready]
"
)
app
.
logger
.
info
(
"
Europe Service Update [ready]
"
)
def
__transform_datum
(
my_date
):
my_date_reported
=
my_date
.
split
(
'
/
'
)
my_year
=
int
(
my_date_reported
[
2
])
my_month
=
int
(
my_date_reported
[
1
])
my_day
=
int
(
my_date_reported
[
0
])
my_datum
=
date
(
year
=
my_year
,
month
=
my_month
,
day
=
my_day
)
return
my_datum
def
__update_date_reported
(
self
):
def
__update_date_reported
(
self
):
app
.
logger
.
info
(
"
__update_date_reported [begin]
"
)
app
.
logger
.
info
(
"
__update_date_reported [begin]
"
)
app
.
logger
.
info
(
"
------------------------------------------------------------
"
)
app
.
logger
.
info
(
"
------------------------------------------------------------
"
)
...
@@ -36,13 +27,12 @@ class EuropeServiceUpdate:
...
@@ -36,13 +27,12 @@ class EuropeServiceUpdate:
k
+=
1
k
+=
1
my_date_rep
=
result_item
[
'
date_rep
'
]
my_date_rep
=
result_item
[
'
date_rep
'
]
my_year_week
=
result_item
[
'
year_week
'
]
my_year_week
=
result_item
[
'
year_week
'
]
app
.
logger
.
info
(
"
|
"
+
my_date_rep
+
"
|
"
+
my_year_week
+
"
| (
"
+
k
+
"
)
"
)
o
=
EuropeDateReported
.
create_new_object_factory
(
o
=
EuropeDateReported
(
my_date_rep
=
my_date_rep
,
date_rep
=
my_date_rep
,
my_year_week
=
my_year_week
year_week
=
my_year_week
,
datum
=
self
.
__transform_datum
(
my_date_rep
)
)
)
db
.
session
.
add
(
o
)
db
.
session
.
add
(
o
)
app
.
logger
.
info
(
"
|
"
+
my_date_rep
+
"
|
"
+
my_year_week
+
"
|
"
+
k
+
"
rows
"
)
db
.
session
.
commit
()
db
.
session
.
commit
()
app
.
logger
.
info
(
"
__update_date_reported [done]
"
)
app
.
logger
.
info
(
"
__update_date_reported [done]
"
)
app
.
logger
.
info
(
"
------------------------------------------------------------
"
)
app
.
logger
.
info
(
"
------------------------------------------------------------
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment