Skip to content

Commit

Permalink
Resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytrotsko committed Jun 26, 2023
1 parent 0609700 commit cc5e1c6
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 20 deletions.
4 changes: 1 addition & 3 deletions src/acquisition/cdcp/cdc_dropbox_receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ def get_timestamp_string():

def trigger_further_processing():
"""Add CDCP processing scripts to the Automation run queue."""

# connect
u, p = secrets.db.auto
cnx = mysql.connector.connect(user=u, password=p, database="automation")
cnx = mysql.connector.connect(user=u, password=p, database="automation", host=secrets.db.host)
cur = cnx.cursor()

# add step "Process CDCP Data" to queue
cur.execute("CALL automation.RunStep(46)")

Expand Down
2 changes: 1 addition & 1 deletion src/acquisition/cdcp/cdc_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def extract(first_week=None, last_week=None, test_mode=False):

# connect
u, p = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")
cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
cur = cnx.cursor()

# weeks to update
Expand Down
2 changes: 1 addition & 1 deletion src/acquisition/cdcp/cdc_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
def upload(test_mode):
# connect
u, p = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")
cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
cur = cnx.cursor()

# insert (or update) table `cdc`
Expand Down
4 changes: 2 additions & 2 deletions src/acquisition/ecdc/ecdc_db_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

def ensure_tables_exist():
(u, p) = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")
cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
try:
cursor = cnx.cursor()
cursor.execute(
Expand Down Expand Up @@ -98,7 +98,7 @@ def update_from_file(issue, date, dir, test_mode=False):
# Read ECDC data from CSVs and insert into (or update) the database.
# database connection
u, p = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")
cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
rows1 = get_rows(cnx, "ecdc_ili")
print(f"rows before: {int(rows1)}")
insert = cnx.cursor()
Expand Down
3 changes: 1 addition & 2 deletions src/acquisition/ght/ght_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,10 @@
"WY",
]


def update(locations, terms, first=None, last=None, countries=["US"]):
# connect to the database
u, p = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")
cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
cur = cnx.cursor()

def get_num_rows():
Expand Down
2 changes: 1 addition & 1 deletion src/acquisition/kcdc/kcdc_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

def ensure_tables_exist():
(u, p) = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")
cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
try:
cursor = cnx.cursor()
cursor.execute(
Expand Down
2 changes: 1 addition & 1 deletion src/acquisition/nidss/taiwan_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def update(test_mode=False):

# Database connection
u, p = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")
cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
rows1 = get_rows(cnx)
print(f"rows before (flu): {int(rows1[0])}")
print(f"rows before (dengue): {int(rows1[1])}")
Expand Down
8 changes: 4 additions & 4 deletions src/acquisition/paho/paho_db_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

def ensure_tables_exist():
(u, p) = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")
cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
try:
cursor = cnx.cursor()
cursor.execute(
Expand Down Expand Up @@ -168,8 +168,8 @@ def update_from_file(issue, date, filename, test_mode=False):
# Current code ignores PAHO-given issue, is based on argument 'issue'

# database connection
u, p = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")

cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
rows1 = get_rows(cnx, "paho_dengue")
print(f"rows before: {int(rows1)}")
insert = cnx.cursor()
Expand Down Expand Up @@ -226,7 +226,7 @@ def update_from_file(issue, date, filename, test_mode=False):
rows2 = rows1
else:
cnx.commit()
rows2 = get_rows(cnx)
rows2 = get_rows(cnx, "paho_dengue")
print(f"rows after: {int(rows2)} (added {int(rows2 - rows1)})")
cnx.close()

Expand Down
4 changes: 2 additions & 2 deletions src/acquisition/quidel/quidel_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ def update(locations, first=None, last=None, force_update=False, load_email=True
if not qd.need_update and not force_update:
print("Data not updated, nothing needs change.")
return

qd_data = qd.load_csv()
qd_measurements = qd.prepare_measurements(qd_data, start_weekday=4)
qd_ts = quidel.measurement_to_ts(qd_measurements, 7, startweek=first, endweek=last)
# connect to the database
u, p = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")
cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
cur = cnx.cursor()

def get_num_rows():
Expand Down
2 changes: 1 addition & 1 deletion src/acquisition/twtr/twitter_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
def run():
# connect to the database
u, p = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")
cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
cur = cnx.cursor()

def get_num_rows():
Expand Down
2 changes: 1 addition & 1 deletion src/acquisition/wiki/wiki_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get_timestamp(name):
def run(job_limit=100):
# connect to the database
u, p = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")
cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
cur = cnx.cursor()

# # Some preparation for utf-8, and it is a temporary trick solution. The real solution should change those char set and collation encoding to utf8 permanently
Expand Down
2 changes: 1 addition & 1 deletion src/acquisition/wiki/wiki_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_manifest(year, month, optional=False):
def run():
# connect to the database
u, p = secrets.db.epi
cnx = mysql.connector.connect(user=u, password=p, database="epidata")
cnx = mysql.connector.connect(user=u, password=p, database="epidata", host=secrets.db.host)
cur = cnx.cursor()

# get the most recent job in wiki_raw
Expand Down

0 comments on commit cc5e1c6

Please sign in to comment.