calculateCenters.py 790 B

123456789101112131415161718192021222324252627282930313233
  1. import analysis
  2. import sys
  3. import os
  4. import getData
  5. import json
  6. import config
  7. def main(configFile):
  8. with open(configFile,'r') as f:
  9. xsetup=json.load(f)
  10. db,fb=getData.connectDB(xsetup['network'])
  11. qfilter=config.getFilter(xsetup)
  12. #getData.downloadPatientFiles(db,fb,xsetup,qfilter)
  13. rows=getData.getPatients(db,xsetup,qfilter)
  14. try:
  15. calculateCenters=xsetup['calculateCenters']
  16. except KeyError:
  17. calculateCenters=True
  18. for r in rows:
  19. #download original files
  20. getData.downloadFiles(fb,r,xsetup)
  21. if calculateCenters:
  22. analysis.calculateRowCenters(r,xsetup)
  23. #upload centers
  24. getData.uploadCenters(fb,r,xsetup)
  25. getData.updateStatus(db,r,xsetup,'calculateCenters')
  26. if __name__=="__main__":
  27. main(sys.argv[1])