12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #a script to modify a patient from list. Current implementation deletes
- #all data for patients identified by study regulatory number from study
- #basic python
- import os
- import subprocess
- import re
- import datetime
- import sys
- import json
- def main(parameterFile):
- fhome=os.path.expanduser('~')
- with open(os.path.join(fhome,".labkey","setup.json")) as f:
- setup=json.load(f)
- sys.path.insert(0,setup["paths"]["nixWrapper"])
- import nixWrapper
- nixWrapper.loadLibrary("labkeyInterface")
- import labkeyInterface
- import labkeyDatabaseBrowser
- import labkeyFileBrowser
- net=labkeyInterface.labkeyInterface()
- net.init(os.path.join(fhome,'.labkey','network.json'))
- db=labkeyDatabaseBrowser.labkeyDB(net)
- #by default uses .labkey/Remote.json configuration
- with open(parameterFile) as f:
- pars=json.load(f)
- project=pars['project']
- schema=pars['schema']
- query=pars['query']
-
- #study section ################
- #select patients enroled under regulatory number
-
- ds=db.selectRows(project,schema,query,[])
- for r in ds['rows']:
- r['View']='[VIEW]'
- db.modifyRows('update',project,schema,query,[r])
- print("Done")
- if __name__ == '__main__':
- main(sys.argv[1])
|