Files
janssen/Feasibility/promote_sipiq_submitted_v1.0.py
2026-06-17 15:05:10 +02:00

64 lines
2.6 KiB
Python

# -*- coding: utf-8 -*-
# =============================================================================
# Nazev: promote_sipiq_submitted_v1.0.py
# Verze: 1.0
# Datum: 2026-06-17
# Popis: Posune dane investigatory (KROK 6 - SIPIQ odeslan) na
# KROK "7 - SIPIQ vyplneny" na zaklade Illuminator exportu
# (status "SIPIQ Submitted"). Illuminator = ultimatni zdroj, protoze
# lekar vyplneni SIPIQ nemusi oznamit e-mailem. Predřadi radek do STATUS.
# Pouziti: python promote_sipiq_submitted_v1.0.py (dry-run)
# python promote_sipiq_submitted_v1.0.py --apply
# =============================================================================
import sys
from pymongo import MongoClient
from bson import ObjectId
MONGO_URI = "mongodb://192.168.1.76:27017"
LINE = ("17JUN2026: SIPIQ VYPLNENY — dle Illuminator exportu (status „SIPIQ "
"Submitted“); lekar vyplneni neoznamil, Illuminator = ultimatni zdroj. KROK 7.")
# 13 investigatoru se SIPIQ Submitted v Illuminatoru, v Mongo zatim KROK 6
IDS = [
("6a19832b5fc2213518257969", "Durina Juraj"),
("6a19832b5fc221351825796e", "Falc Matej"),
("6a19832b5fc2213518257954", "Fedurco Miroslav"),
("6a19832b5fc221351825796c", "Gregar Jan"),
("6a19832b5fc221351825794f", "Hlavaty Tibor"),
("6a19832b5fc2213518257973", "Horvath Frantisek"),
("6a19832b5fc221351825796f", "Konecny Michal"),
("6a19832b5fc2213518257972", "Konecny Stefan"),
("6a1c4275aa46d8b608065cec", "Lukac Ludovit"),
("6a19832b5fc2213518257958", "Mihalkanin Lubomir"),
("6a198b661218c31ab0f5ba41", "Pesta Martin"),
("6a19832b5fc221351825795e", "Stepek David"),
("6a198b661218c31ab0f5ba43", "Tichy Michal"),
]
def main():
apply = "--apply" in sys.argv
col = MongoClient(MONGO_URI)["feasibility"]["investigators"]
n = 0
for hid, label in IDS:
oid = ObjectId(hid)
d = col.find_one({"_id": oid}, {"STATUS": 1, "KROK": 1})
if not d:
print(f" !! {label}: NENALEZEN"); continue
krok = d.get("KROK", "")
if not krok.startswith("6"):
print(f" ~~ {label}: KROK={krok} (neni 6) -> preskakuji"); continue
print(f" [{label}] KROK {krok} -> 7 - SIPIQ vyplneny")
if apply:
new_status = LINE + "\n" + (d.get("STATUS", "") or "")
col.update_one({"_id": oid}, {"$set": {
"KROK": "7 - SIPIQ vyplneny", "STATUS": new_status}})
n += 1
print(f"\n{'ZAPSANO' if apply else 'DRY-RUN'}: {n if apply else len(IDS)}/{len(IDS)}")
if not apply:
print(">>> Pro zapis spust s --apply")
if __name__ == "__main__":
main()