Migrate IWRS from MySQL to MongoDB

- Add IWRS/common/mongo_writer.py with shared connection, indexes,
  upsert+snapshot helpers
- Add IWRS/Patients/import_to_mongo.py (subject_summary + visits)
- Add IWRS/Patients/import_notifications_to_mongo.py: parse PDF/JSON
  directly to Mongo (incl. PDF as BinData), replaces 2-step MySQL flow
- Add IWRS/Drugs/import_to_mongo.py (shipments, items, inventory,
  destruction)
- Add IWRS/backfill_mysql_to_mongo.py: one-shot history backfill
- Switch IWRS/Patients/run_all.py and IWRS/Drugs/run_all.py to Mongo
- Rewrite IWRS/Drugs/create_report.py data loaders to read from Mongo
- 8 main collections (upsert = latest state) + 5 snapshot collections
  (append-only with import_id) under studie database; notifications and
  destruction are immutable and need no snapshots

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 07:24:36 +02:00
parent 681095d557
commit ea9d611719
2080 changed files with 9465 additions and 172 deletions
@@ -0,0 +1,10 @@
{
"pk": 6545,
"title": "Screening",
"label": "Janssen 42847922MDD3003 Subject CZ100080002 has been screened at site S10-CZ10008",
"event": "Screen",
"actual_date": "2025-08-05",
"subject": "CZ100080002",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticalshttps://janssen.4gclinical.com\nSubject CZ100080002 has been screened.\n \nSite Details \nLocation: CZE \nSite: S10-CZ10008 \nInvestigator: Solle, Zdenek \n\n \nSubject Details \nSubject: CZ100080002 \nIRT Subject Status: Screened \nCohort: Part 1\nInformed Consent Date at Screening: 04-Aug-2025 \n\nDate of Screening in IRT: 05-Aug-2025 \nTransaction Date/Time (site local): 05-Aug-2025 09:24:09\nTransaction Date/Time (system local): 05-Aug-2025 07:24:09\n\nTransaction performed by: v.smidkova@clintrial.cz\n \nIf you have questions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 6760,
"title": "Screening",
"label": "Janssen 42847922MDD3003 Subject CZ100040001 has been screened at site S10-CZ10004",
"event": "Screen",
"actual_date": "2025-08-08",
"subject": "CZ100040001",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticalshttps://janssen.4gclinical.com\nSubject CZ100040001 has been screened.\n \nSite Details \nLocation: CZE \nSite: S10-CZ10004 \nInvestigator: Herman, Erik \n\n \nSubject Details \nSubject: CZ100040001 \nIRT Subject Status: Screened \nCohort: Part 1\nInformed Consent Date at Screening: 08-Aug-2025 \n\nDate of Screening in IRT: 08-Aug-2025 \nTransaction Date/Time (site local): 08-Aug-2025 09:39:48\nTransaction Date/Time (system local): 08-Aug-2025 07:39:48\n\nTransaction performed by: gnovotna@email.cz\n \nIf you have questions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 7427,
"title": "Dispensation",
"label": "Janssen 42847922MDD3003 Subject CZ100080002 dispensing confirmation has occurred at site S10-CZ10008",
"event": "uv_disp_conf",
"actual_date": "2025-08-26",
"subject": "CZ100080002",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticals\nhttps://janssen.4gclinical.com\n\n Confirmation of dispensing medication(s) for Subject CZ100080002 has\nbeen performed for the following medication IDs:\n\nMedication No: 1019782\n\nProduct Label Type: Seltorexant 20mg or placebo\nMedication status:\n Dispensed\nDispensation date: 26-Aug-2025\nNote (only collected if Not Dispensed):\n \n\nMedication No: 1020699\n\nProduct Label Type: Seltorexant 20mg or placebo\nMedication status:\n Dispensed\nDispensation date: 26-Aug-2025\nNote (only collected if Not Dispensed):\n \n\nSite Details \nLocation: CZE \nSite:\nS10-CZ10008 \nInvestigator: Solle, Zdenek \n\nSubject Details \nSubject:\nCZ100080002 \nIRT Subject Status: Randomized Part 1 \n\nTransaction Date/Time (site local): 26-Aug-2025 13:17:53\n\nTransaction Date/Time (system local): 26-Aug-2025 11:17:53 \nTransaction performed by: v.smidkova@clintrial.cz\n\nIf you have\nquestions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 7426,
"title": "Randomized_Part_1",
"label": "Janssen 42847922MDD3003 Subject CZ100080002 randomized into Part 1 at site S10-CZ10008",
"event": "Rand",
"actual_date": "2025-08-26",
"subject": "CZ100080002",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticalshttps://janssen.4gclinical.com\nSubject CZ100080002 has been randomized into Part 1.\n \nThe following medication(s) has been assigned to the subject:\n\nMedication NoMedication TypePackaged Lot NoExpiration Date1019782Seltorexant 20mg or placeboT38028505-Apr-20261020699Seltorexant 20mg or placeboT38028505-Apr-2026\n\n \nSite Details \nLocation: CZE \nSite: S10-CZ10008 \nInvestigator: Solle, Zdenek \n\n \nSubject Details \nSubject: CZ100080002 \nIRT Subject Status: Randomized Part 1 \n\nTransaction Date/Time (site local): 26-Aug-2025 13:03:37\nTransaction Date/Time (system local): 26-Aug-2025 11:03:37\nTransaction performed by: v.smidkova@clintrial.cz\n \nIf you have questions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 7414,
"title": "Screening",
"label": "Janssen 42847922MDD3003 Subject CZ100080004 has been screened at site S10-CZ10008",
"event": "Screen",
"actual_date": "2025-08-26",
"subject": "CZ100080004",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticalshttps://janssen.4gclinical.com\nSubject CZ100080004 has been screened.\n \nSite Details \nLocation: CZE \nSite: S10-CZ10008 \nInvestigator: Solle, Zdenek \n\n \nSubject Details \nSubject: CZ100080004 \nIRT Subject Status: Screened \nCohort: Part 1\nInformed Consent Date at Screening: 25-Aug-2025 \n\nDate of Screening in IRT: 26-Aug-2025 \nTransaction Date/Time (site local): 26-Aug-2025 09:33:38\nTransaction Date/Time (system local): 26-Aug-2025 07:33:38\n\nTransaction performed by: m.deif@clintrial.cz\n \nIf you have questions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 7772,
"title": "Screening",
"label": "Janssen 42847922MDD3003 Subject CZ100120002 has been screened at site S10-CZ10012",
"event": "Screen",
"actual_date": "2025-09-03",
"subject": "CZ100120002",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticalshttps://janssen.4gclinical.com\nSubject CZ100120002 has been screened.\n \nSite Details \nLocation: CZE \nSite: S10-CZ10012 \nInvestigator: Urban, Ales \n\n \nSubject Details \nSubject: CZ100120002 \nIRT Subject Status: Screened \nCohort: Part 1\nInformed Consent Date at Screening: 03-Sep-2025 \n\nDate of Screening in IRT: 03-Sep-2025 \nTransaction Date/Time (site local): 03-Sep-2025 13:44:09\nTransaction Date/Time (system local): 03-Sep-2025 11:44:09\n\nTransaction performed by: marcelasedlackova@seznam.cz\n \nIf you have questions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 7946,
"title": "Randomized_Part_1",
"label": "Janssen 42847922MDD3003 Subject CZ100040001 randomized into Part 1 at site S10-CZ10004",
"event": "Rand",
"actual_date": "2025-09-05",
"subject": "CZ100040001",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticalshttps://janssen.4gclinical.com\nSubject CZ100040001 has been randomized into Part 1.\n \nThe following medication(s) has been assigned to the subject:\n\nMedication NoMedication TypePackaged Lot NoExpiration Date1109895Seltorexant 20mg or placeboT38028505-Apr-20261125335Seltorexant 20mg or placeboT38028505-Apr-2026\n\n \nSite Details \nLocation: CZE \nSite: S10-CZ10004 \nInvestigator: Herman, Erik \n\n \nSubject Details \nSubject: CZ100040001 \nIRT Subject Status: Randomized Part 1 \n\nTransaction Date/Time (site local): 05-Sep-2025 10:23:26\nTransaction Date/Time (system local): 05-Sep-2025 08:23:26\nTransaction performed by: gnovotna@email.cz\n \nIf you have questions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 8056,
"title": "Dispensation",
"label": "Janssen 42847922MDD3003 Subject CZ100080002 dispensing confirmation has occurred at site S10-CZ10008",
"event": "uv_disp_conf",
"actual_date": "2025-09-09",
"subject": "CZ100080002",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticals\nhttps://janssen.4gclinical.com\n\n Confirmation of dispensing medication(s) for Subject CZ100080002 has\nbeen performed for the following medication IDs:\n\nMedication No: 1043808\n\nProduct Label Type: Seltorexant 20mg or placebo\nMedication status:\n Dispensed\nDispensation date: 09-Sep-2025\nNote (only collected if Not Dispensed):\n \n\nMedication No: 1056387\n\nProduct Label Type: Seltorexant 20mg or placebo\nMedication status:\n Dispensed\nDispensation date: 09-Sep-2025\nNote (only collected if Not Dispensed):\n \n\nSite Details \nLocation: CZE \nSite:\nS10-CZ10008 \nInvestigator: Solle, Zdenek \n\nSubject Details \nSubject:\nCZ100080002 \nIRT Subject Status: Randomized Part 1 \n\nTransaction Date/Time (site local): 09-Sep-2025 12:10:27\n\nTransaction Date/Time (system local): 09-Sep-2025 10:10:27 \nTransaction performed by: m.deif@clintrial.cz\n\nIf you have\nquestions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 8055,
"title": "Assignment",
"label": "Janssen 42847922MDD3003 Subject CZ100080002 has been assigned medication for visit Double Blind Part 1 Visit 6 at site S10-CZ10008",
"event": "DB_P1_V6",
"actual_date": "2025-09-09",
"subject": "CZ100080002",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticalshttps://janssen.4gclinical.com\nSubject CZ100080002 has been assigned the following medication(s) for visit Double Blind Part 1 Visit 6:\n\nMedication NoMedication TypePackaged Lot NoExpiration Date1043808Seltorexant 20mg or placeboT38028505-Apr-20261056387Seltorexant 20mg or placeboT38028505-Apr-2026\n\n \nSite Details \nLocation: CZE \nSite: S10-CZ10008 \nInvestigator: Solle, Zdenek \n\n \nSubject Details \nSubject: CZ100080002 \nIRT Subject Status: Randomized Part 1 \n\nTransaction Date/Time (site local): 09-Sep-2025 12:09:34 \nTransaction Date/Time (system local): 09-Sep-2025 10:09:34 \nTransaction performed by: m.deif@clintrial.cz\n \nIf you have questions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 8124,
"title": "Screening",
"label": "Janssen 42847922MDD3003 Subject CZ100080005 has been screened at site S10-CZ10008",
"event": "Screen",
"actual_date": "2025-09-10",
"subject": "CZ100080005",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticalshttps://janssen.4gclinical.com\nSubject CZ100080005 has been screened.\n \nSite Details \nLocation: CZE \nSite: S10-CZ10008 \nInvestigator: Solle, Zdenek \n\n \nSubject Details \nSubject: CZ100080005 \nIRT Subject Status: Screened \nCohort: Part 1\nInformed Consent Date at Screening: 09-Sep-2025 \n\nDate of Screening in IRT: 10-Sep-2025 \nTransaction Date/Time (site local): 10-Sep-2025 10:44:50\nTransaction Date/Time (system local): 10-Sep-2025 08:44:50\n\nTransaction performed by: v.smidkova@clintrial.cz\n \nIf you have questions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 8351,
"title": "Dispensation",
"label": "Janssen 42847922MDD3003 Subject CZ100080004 dispensing confirmation has occurred at site S10-CZ10008",
"event": "uv_disp_conf",
"actual_date": "2025-09-16",
"subject": "CZ100080004",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticals\nhttps://janssen.4gclinical.com\n\n Confirmation of dispensing medication(s) for Subject CZ100080004 has\nbeen performed for the following medication IDs:\n\nMedication No: 1076269\n\nProduct Label Type: Seltorexant 20mg or placebo\nMedication status:\n Dispensed\nDispensation date: 16-Sep-2025\nNote (only collected if Not Dispensed):\n \n\nMedication No: 1094935\n\nProduct Label Type: Seltorexant 20mg or placebo\nMedication status:\n Dispensed\nDispensation date: 16-Sep-2025\nNote (only collected if Not Dispensed):\n \n\nSite Details \nLocation: CZE \nSite:\nS10-CZ10008 \nInvestigator: Solle, Zdenek \n\nSubject Details \nSubject:\nCZ100080004 \nIRT Subject Status: Randomized Part 1 \n\nTransaction Date/Time (site local): 16-Sep-2025 12:54:42\n\nTransaction Date/Time (system local): 16-Sep-2025 10:54:42 \nTransaction performed by: m.deif@clintrial.cz\n\nIf you have\nquestions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 8350,
"title": "Randomized_Part_1",
"label": "Janssen 42847922MDD3003 Subject CZ100080004 randomized into Part 1 at site S10-CZ10008",
"event": "Rand",
"actual_date": "2025-09-16",
"subject": "CZ100080004",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticalshttps://janssen.4gclinical.com\nSubject CZ100080004 has been randomized into Part 1.\n \nThe following medication(s) has been assigned to the subject:\n\nMedication NoMedication TypePackaged Lot NoExpiration Date1076269Seltorexant 20mg or placeboT38028505-Apr-20261094935Seltorexant 20mg or placeboT38028505-Apr-2026\n\n \nSite Details \nLocation: CZE \nSite: S10-CZ10008 \nInvestigator: Solle, Zdenek \n\n \nSubject Details \nSubject: CZ100080004 \nIRT Subject Status: Randomized Part 1 \n\nTransaction Date/Time (site local): 16-Sep-2025 12:53:29\nTransaction Date/Time (system local): 16-Sep-2025 10:53:29\nTransaction performed by: m.deif@clintrial.cz\n \nIf you have questions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 8335,
"title": "Screening",
"label": "Janssen 42847922MDD3003 Subject CZ100080006 has been screened at site S10-CZ10008",
"event": "Screen",
"actual_date": "2025-09-16",
"subject": "CZ100080006",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticalshttps://janssen.4gclinical.com\nSubject CZ100080006 has been screened.\n \nSite Details \nLocation: CZE \nSite: S10-CZ10008 \nInvestigator: Solle, Zdenek \n\n \nSubject Details \nSubject: CZ100080006 \nIRT Subject Status: Screened \nCohort: Part 1\nInformed Consent Date at Screening: 15-Sep-2025 \n\nDate of Screening in IRT: 16-Sep-2025 \nTransaction Date/Time (site local): 16-Sep-2025 09:14:53\nTransaction Date/Time (system local): 16-Sep-2025 07:14:53\n\nTransaction performed by: v.smidkova@clintrial.cz\n \nIf you have questions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 8636,
"title": "Assignment",
"label": "Janssen 42847922MDD3003 Subject CZ100040001 has been assigned medication for visit Double Blind Part 1 Visit 6 at site S10-CZ10004",
"event": "DB_P1_V6",
"actual_date": "2025-09-19",
"subject": "CZ100040001",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticalshttps://janssen.4gclinical.com\nSubject CZ100040001 has been assigned the following medication(s) for visit Double Blind Part 1 Visit 6:\n\nMedication NoMedication TypePackaged Lot NoExpiration Date1077721Seltorexant 20mg or placeboT38028505-Apr-20261173637Seltorexant 20mg or placeboT38028505-Apr-2026\n\n \nSite Details \nLocation: CZE \nSite: S10-CZ10004 \nInvestigator: Herman, Erik \n\n \nSubject Details \nSubject: CZ100040001 \nIRT Subject Status: Randomized Part 1 \n\nTransaction Date/Time (site local): 19-Sep-2025 11:44:36 \nTransaction Date/Time (system local): 19-Sep-2025 09:44:36 \nTransaction performed by: gnovotna@email.cz\n \nIf you have questions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}
@@ -0,0 +1,10 @@
{
"pk": 8681,
"title": "Dispensation",
"label": "Janssen 42847922MDD3003 Subject CZ100040001 dispensing confirmation has occurred at site S10-CZ10004",
"event": "uv_disp_conf",
"actual_date": "2025-09-22",
"subject": "CZ100040001",
"study": "42847922MDD3003",
"text": "42847922MDD3003\nJanssen Pharmaceuticals\nhttps://janssen.4gclinical.com\n\n Confirmation of dispensing medication(s) for Subject CZ100040001 has\nbeen performed for the following medication IDs:\n\nMedication No: 1077721\n\nProduct Label Type: Seltorexant 20mg or placebo\nMedication status:\n Dispensed\nDispensation date: 19-Sep-2025\nNote (only collected if Not Dispensed):\n \n\nMedication No: 1173637\n\nProduct Label Type: Seltorexant 20mg or placebo\nMedication status:\n Dispensed\nDispensation date: 19-Sep-2025\nNote (only collected if Not Dispensed):\n \n\nMedication No: 1109895\n\nProduct Label Type: Seltorexant 20mg or placebo\nMedication status:\n Dispensed\nDispensation date: 05-Sep-2025\nNote (only collected if Not Dispensed):\n \n\nMedication No: 1125335\n\nProduct Label Type: Seltorexant 20mg or placebo\nMedication status:\n Dispensed\nDispensation date: 05-Sep-2025\nNote (only collected if Not Dispensed):\n \n\nSite Details \nLocation: CZE \nSite:\nS10-CZ10004 \nInvestigator: Herman, Erik \n\nSubject Details \nSubject:\nCZ100040001 \nIRT Subject Status: Randomized Part 1 \n\nTransaction Date/Time (site local): 22-Sep-2025 09:50:51\n\nTransaction Date/Time (system local): 22-Sep-2025 07:50:51 \nTransaction performed by: veronika@brezinova.cz\n\nIf you have\nquestions about this notification, please contact 4G Clinical Support at \nhttps://support.4gclinical.com"
}

Some files were not shown because too many files have changed in this diff Show More