-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
51 lines (41 loc) · 1.22 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
from dotenv import load_dotenv
load_dotenv()
from prediksicovidjatim import database, config
from prediksicovidjatim.data.model import ModelDataRepo
from prediksicovidjatim.util import Pool
K_TEST = 3
try:
K_TEST = int(os.getenv("K_TEST"))
except Exception:
pass
PREDICT_DAYS = 30
try:
PREDICT_DAYS = int(os.getenv("PREDICT_DAYS"))
except Exception:
pass
def init():
database.init()
#config.init_plot()
with database.get_conn() as conn, conn.cursor() as cur:
ModelDataRepo.init_weights(cur)
def scrap():
from core import scraping
scraping.scrap_new_data()
def scrap_covid():
from core import scraping
scraping.scrap_new_covid_data()
def scrap_hospital():
from core import scraping
scraping.scrap_new_hospital_data()
def map(any=False, predict_days=PREDICT_DAYS, update_prediction=True, update_real=False):
from core import mapping
mapping.init()
mapping.update_map_all(any=any, predict_days=predict_days, update_prediction=update_prediction, update_real=update_real)
def fit(test=False):
from core import fitting
if test:
test_splits = [K_TEST]
else:
test_splits = []
fitting.fit_all(test_splits)