Commit 9cd621a5 authored by Ryan Herbert's avatar Ryan Herbert
Browse files

patient.py run.py remove some unused routes

these functions are no longer in use since sample_set.py provides the
desired behaviour
parent d633dae7
......@@ -14,60 +14,3 @@ ACCESS_DENIED = "access denied"
def download():
return response.download(request, db)
#
def confirm():
if (auth.can_modify_patient(request.vars["id"]) ):
log.debug('request patient deletion')
return dict(message=T('confirm patient deletion'))
else :
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
#
def delete():
if (auth.can_modify_patient(request.vars["id"]) ):
patient = db.patient[request.vars["id"]]
if patient is None:
res = {"message": 'An error occured. This patient may have already been deleted'}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
sample_set_id = patient.sample_set_id
#delete data file
query = db( (db.sample_set_membership.sample_set_id == sample_set_id)
& (db.sequence_file.id == db.sample_set_membership.sequence_file_id)
).select(db.sequence_file.id)
for row in query :
db(db.results_file.sequence_file_id == row.id).delete()
#delete sequence file
query = db((db.sequence_file.id == db.sample_set_membership.sequence_file_id)
& (db.sample_set_membership.sample_set_id == sample_set_id)
).select(db.sequence_file.id)
for row in query :
db(db.sequence_file.id == row.id).delete()
#delete patient
db(db.patient.id == request.vars["id"]).delete()
#delete patient sample_set
db(db.sample_set.id == sample_set_id).delete()
res = {"redirect": "patient/index",
"success": "true",
"message": "patient ("+str(request.vars["id"])+") deleted"}
log.info(res, extra={'user_id': auth.user.id, 'record_id': request.vars["id"], 'table_name': 'patient'})
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -9,84 +9,6 @@ if request.env.http_origin:
response.headers['Access-Control-Max-Age'] = 86400
ACCESS_DENIED = "access denied"
## return form to create new run
def add():
if (auth.can_create_patient()):
sequencer_list = db(
db.run.id>0
).select(
db.run.sequencer,
distinct=True
)
pcr_list = db(
db.run.id>0
).select(
db.run.pcr,
distinct=True
)
creation_group_tuple = get_default_creation_group(auth)
groups = creation_group_tuple[0]
max_group = creation_group_tuple[1]
return dict(message=T('add run'),
sequencer_list = sequencer_list,
pcr_list = pcr_list, groups=groups, master_group=max_group)
else :
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def confirm():
if (auth.can_modify_run(request.vars["id"]) ):
log.debug('request patient deletion')
return dict(message=T('confirm patient deletion'))
else :
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def delete():
if (auth.can_modify_run(request.vars["id"]) ):
sample_set_id = db.run[request.vars["id"]].sample_set_id
#delete data file
'''
query = db( (db.sample_set_membership.sample_set_id == sample_set_id)
& (db.sequence_file.id == db.sample_set_membership.sequence_file_id)
).select(db.sequence_file.id)
for row in query :
db(db.results_file.sequence_file_id == row.id).delete()
#delete sequence file
query = db((db.sequence_file.id == db.sample_set_membership.sequence_file_id)
& (db.sample_set_membership.sample_set_id == sample_set_id)
).select(db.sequence_file.id)
for row in query :
db(db.sequence_file.id == row.id).delete()
'''
#delete patient
db(db.run.id == request.vars["id"]).delete()
#delete patient sample_set
db(db.sample_set.id == sample_set_id).delete()
res = {"redirect": "sample_set/all",
"args" : { "type" : 'run' },
"success": "true",
"message": "run ("+str(request.vars["id"])+") deleted"}
log.info(res, extra={'user_id': auth.user.id, 'record_id': request.vars['id'], 'table_name': 'run'})
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def info():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment