示例#1
0
def main(unused_argv):
    cfg = config.Config(FLAGS.config,
                        mode=FLAGS.mode,
                        env_path=FLAGS.dotenv_path)
    shdb = gsheets.SheetsDB(cfg.TOKEN_LOC, cfg.SHEET_ID)
    sqldb = sqlite.SQLiteDB(cfg.db.sqlite_path)
    import_sheet = shdb.get_sheet_as_pd("Import")
    sync = synchronizer.Synchronizer(shdb, sqldb)
    sync.sync_icus()
    sync.sync_users()
    sqldb.execute("DELETE FROM bed_updates")
    for row in import_sheet.iterrows():
        row_info = {
            "icu_name": row[1]["Hopital"],
            "n_covid_occ": row[1]["NbCOVID"],
            "n_covid_free": row[1]["NbLitDispo"],
            "n_ncovid_free": 0,
            "n_covid_deaths": row[1]["NbDeces"],
            "n_covid_healed": row[1]["NbSortieVivant"],
            "n_covid_refused": 0,
            "n_covid_transfered": 0,
        }
        icu_id = sqldb.get_icu_id_from_name(row_info["icu_name"])
        row_info["icu_id"] = icu_id
        print(row_info)
        sqldb.update_bedcount(**row_info)
示例#2
0
def main(unused_argv):
    cfg = config.Config(FLAGS.config,
                        mode=FLAGS.mode,
                        env_path=FLAGS.dotenv_path)
    # First we migrate
    mgt = migrator.Migrator(cfg, FLAGS.old_db_path)
    mgt.run()

    # Now we add the region that was not in the old one.
    sheets = gsheets.SheetsDB(cfg.TOKEN_LOC, cfg.SHEET_ID)
    sync = synchronizer.StoreSynchronizer(sheets, mgt.new_db)
    sync.sync_icus()
示例#3
0
def main(unused_argv):
    cfg = config.Config(FLAGS.config, mode=FLAGS.mode)
    sdb = gsheets.SheetsDB(cfg.TOKEN_LOC, cfg.SHEET_ID)
    sender = mb_sender.MBSender(api_key=config.SMS_KEY,
                                originator=cfg.sms.origin)

    users = sdb.get_users()
    print(users)
    for row in users.iterrows():
        print(row)
        tel = row[1]["tel"]
        print(tel)
        sender.send_message(tel, "Test")
示例#4
0
def main(unused_argv):
    cfg = config.Config(FLAGS.config,
                        mode=FLAGS.mode,
                        env_path=FLAGS.dotenv_path)
    shdb = gsheets.SheetsDB(cfg.TOKEN_LOC, cfg.SHEET_ID)
    sqldb = sqlite.SQLiteDB(cfg.db.sqlite_path)
    sync = synchronizer.Synchronizer(shdb, sqldb)
    reply = (str(
        input(
            "!!Are you sure you want to sync, this will drop all users!! (duh/nay)"
        )).lower().strip())
    if reply == "duh":
        sync.sync_icus()
        sync.sync_users()
示例#5
0
 def test_icus(self):
     shdb = gsheets.SheetsDB(self.config.TOKEN_LOC, self.config.SHEET_ID)
     shdb.get_icus()