Main Script

clone / install pkg

!git clone https://github_pat_...@github.com/.../srs_updates.git
%cd './srs_updates'
!pip install -e ".[dev]"

init

import re

import pandas as pd
from loguru import logger as lg

from srs_updates import srs_specific as ss
from srs_updates import update_xl as uxl
from srs_updates.core import loadSerializedLog
from srs_updates.export import exportFiles

fxs


loadDat

 loadDat ()

checkCodes

 checkCodes ()

checkSpouseDeaths

 checkSpouseDeaths ()

checkMbrDeaths

 checkMbrDeaths ()

preliminary checks

load dat

loadDat()

check if RBP and ID is in database

# warn if not in address file
chk = af[["Emp ID #1", "Updated"]].copy()
ids = df["Emp ID #1"].tolist()

m = chk["Emp ID #1"].isin(ids)
chk = chk[m].copy()

for _id in ids:
    if _id not in chk["Emp ID #1"].tolist():
        lg.warning(f"{_id} not in address file")
# warn if currently flagged as RBP
chk.columns = ["id", "updated"]

chk.updated = chk.updated.fillna("1-jan-2017")  # placeholder
chk["updated"] = pd.to_datetime(chk["updated"], errors="coerce")
m = chk["updated"].isna()
for _id in chk[m]["id"].tolist():
    lg.warning(f"{_id} currently flagged as RBP in address file")

check codes

checkCodes()

check deaths

For spouse death, ensure name is provided (either in note, or already in database). Also check if we already have a DOD in the database.

checkSpouseDeaths()

For member death, check if we already have DOD in the database.

checkMbrDeaths()

export files

notes_list = df.full_note.tolist()
len(notes_list)
updates = ss.Updates(notes_list=notes_list)
exportFiles(updates)
# export log to double check warnings
_log = loadSerializedLog("./updates.log")
_log.to_excel("_log.xlsx", index=False)

generate update files for internal update

  • includes changelog
uxl.main(
    "Emp ID #1", ["Postal", "Bene/MB/Alt. Postal Code", "Spouse's SIN"], "Book1.xlsx"
)