| 1 |
nino.borges |
820 |
"""
|
| 2 |
|
|
|
| 3 |
|
|
Lilly-DataFlowSearch
|
| 4 |
|
|
|
| 5 |
|
|
Created by:
|
| 6 |
|
|
Emanuel Borges
|
| 7 |
|
|
02.13.2024
|
| 8 |
|
|
|
| 9 |
|
|
Very simple program that will read an XLS file and search for references to specific systems. If found, that entire row will be copied.
|
| 10 |
|
|
|
| 11 |
|
|
"""
|
| 12 |
|
|
|
| 13 |
|
|
import os
|
| 14 |
|
|
from datetime import datetime
|
| 15 |
|
|
from win32com.client import Dispatch
|
| 16 |
|
|
|
| 17 |
|
|
class DataFlowFileSearcher(object):
|
| 18 |
|
|
version = "0.01"
|
| 19 |
|
|
|
| 20 |
|
|
def __init__(self):
|
| 21 |
|
|
self.fileToSearch = r"C:\Users\eborges\OneDrive - Redgrave LLP\Documents\Cases\Eli Lilly\Clinical Data Flow Analysis Req\_working\cmdb_ci_business_app_02022024_EB.xlsx"
|
| 22 |
|
|
|
| 23 |
|
|
|
| 24 |
|
|
|
| 25 |
|
|
#self.searchTermsList = ["Vault EDC","Vault Coder","Vault CDB","CDTS","Argus","LSS","Information Hub","CLUWE","IMPACT","eCTS","CTMS","Adjudication","IQVIA-ECG","Central Laboratory","Covance","Q2 Ithica","Bioagilytix","Immunogenicity","Vault Clinical-CTMS","LabCorp","WuXi","IQVia","ABPM","Biotel","REESE"]
|
| 26 |
|
|
self.searchTermsList = ["LSS","Information Hub","CLUWE","IMPACT","eCTS","CTMS","Adjudication","IQVIA-ECG","Central Laboratory","Covance","Q2 Ithica","Bioagilytix","Immunogenicity","Vault Clinical-CTMS","LabCorp","WuXi","IQVia","ABPM","Biotel","REESE"]
|
| 27 |
|
|
self.workingDir = r"C:\Test_Dir\lili_dataflow"
|
| 28 |
|
|
|
| 29 |
|
|
|
| 30 |
|
|
self.xlApp = Dispatch('Excel.Application')
|
| 31 |
|
|
|
| 32 |
|
|
def PerformDataFlowSearch(self):
|
| 33 |
|
|
wb = self.xlApp.Workbooks.Open(self.fileToSearch)
|
| 34 |
|
|
sht = wb.Worksheets(1)
|
| 35 |
|
|
for keyTerm in self.searchTermsList:
|
| 36 |
|
|
print(f"Now searching for {keyTerm}...")
|
| 37 |
|
|
outputFile = open(os.path.join(self.workingDir,f"{keyTerm}.TXT"),'w')
|
| 38 |
|
|
for rowNumb in range(1,13840):
|
| 39 |
|
|
termFound = False
|
| 40 |
|
|
for colNumb in range(1,4):
|
| 41 |
|
|
cellToSearchValue = sht.Cells(rowNumb,colNumb).Value
|
| 42 |
|
|
if keyTerm.upper() in cellToSearchValue.upper():
|
| 43 |
|
|
termFound = True
|
| 44 |
|
|
if termFound:
|
| 45 |
|
|
fullRow = sht.Range(f"A{rowNumb}:W{rowNumb}")
|
| 46 |
|
|
outputFile.write(f"{fullRow}\n")
|
| 47 |
|
|
outputFile.close()
|
| 48 |
|
|
wb.Close()
|
| 49 |
|
|
|
| 50 |
|
|
|
| 51 |
|
|
|
| 52 |
|
|
if __name__ == '__main__':
|
| 53 |
|
|
dfs = DataFlowFileSearcher()
|
| 54 |
|
|
dfs.PerformDataFlowSearch() |