Commit a880ab95 authored by Marc Duez's avatar Marc Duez

database : add pcr/sequencer/producer to sequence_file table

-update controller file.py
-update views add.html and edit.html
parent 45782fc8
......@@ -28,6 +28,9 @@ def add_form():
if error=="" :
id = db.sequence_file.insert(sampling_date=request.vars['sampling_date'],
info=request.vars['file_info'],
pcr=request.vars['pcr'],
sequencer=request.vars['sequencer'],
producer=request.vars['producer'],
patient_id=request.vars['patient_id'])
res = {"file_id" : id,
......@@ -57,20 +60,19 @@ def edit_form():
if error=="" :
mes = "file " + request.vars['id'] + " : "
if request.vars['sampling_date'] != None :
db.sequence_file[request.vars["id"]] = dict(sampling_date=request.vars['sampling_date'])
mes += "sampling date saved, "
if request.vars['file_info'] != None :
db.sequence_file[request.vars["id"]] = dict(info=request.vars['file_info'])
mes += "info saved, "
if request.vars['sampling_date'] != None and request.vars['file_info'] != None :
db.sequence_file[request.vars["id"]] = dict(sampling_date=request.vars['sampling_date'],
info=request.vars['file_info'],
pcr=request.vars['pcr'],
sequencer=request.vars['sequencer'],
producer=request.vars['producer'])
patient_id = db.sequence_file[request.vars["id"]].patient_id
res = {"file_id" : request.vars['id'],
"redirect": "patient/info",
"args" : { "id" : patient_id},
"message": mes}
"message": "change saved"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def upload():
......
......@@ -101,6 +101,9 @@ db.define_table('sequence_file',
Field('sampling_date','date'),
Field('info','text'),
Field('filename','text'),
Field('pcr','text'),
Field('sequencer','text'),
Field('producer','text'),
Field('size_file','integer'),
Field('data_file', 'upload', length=1000000000000))
......
......@@ -21,34 +21,35 @@
<table>
<tbody>
<tr>
<td>
<label for="sampling_date" id="sampling_date__label">sampling date: </label>
</td>
<td>
<input class="date" id="sampling_date" name="sampling_date" type="text" value="">
<span>(format: yyyy-mm-dd)</span>
</td>
<td>
</td>
<td><label for="sampling_date" id="sampling_date__label">sampling date: </label></td>
<td><input class="date" id="sampling_date" name="sampling_date" type="text" value="">
<span>(format: yyyy-mm-dd)</span></td>
<td></td>
</tr>
<tr>
<td>
<label for="file_info" id="file_info__label">Info: </label>
</td>
<td>
<textarea class="text" cols="40" id="file_info" name="file_info" rows="10"></textarea>
</td>
<td>
</td>
<td><label for="file_info" id="file_info__label">Info: </label></td>
<td><textarea class="text" id="file_info" name="file_info" cols="40" rows="10"></textarea></td>
<td></td>
</tr>
<tr>
<td>
</td>
<td >
<input type="submit" value="Soumettre" class="btn">
</td>
<td>
</td>
<td><label for="pcr" id="pcr__label">pcr: </label></td>
<td><input class="text" id="pcr" name="pcr" type="text" size="40" value=""></td>
<td></td>
</tr>
<tr>
<td><label for="sequencer" id="sequencer__label">sequencer: </label></td>
<td><input class="text" id="sequencer" name="sequencer" type="text" size="40" value=""></td>
<td></td>
</tr>
<tr>
<td><label for="producer" id="producer__label">producer: </label></td>
<td><input class="text" id="producer" name="producer" type="text" size="40" value=""></td>
<td></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Soumettre" class="btn"></td>
<td></td>
</tr>
</tbody>
</table>
......
......@@ -31,6 +31,21 @@ info = db.sequence_file[request.vars["id"]]
<td> <textarea class="text" cols="40" id="file_info" name="file_info" rows="10">{{=info.info}}</textarea> </td>
<td> </td>
</tr>
<tr>
<td><label for="pcr" id="pcr__label">pcr: </label></td>
<td><input class="text" id="pcr" name="pcr" type="text" size="40" value="{{=info.pcr}}"></td>
<td></td>
</tr>
<tr>
<td><label for="sequencer" id="sequencer__label">sequencer: </label></td>
<td><input class="text" id="sequencer" name="sequencer" type="text" size="40" value="{{=info.sequencer}}"></td>
<td></td>
</tr>
<tr>
<td><label for="producer" id="producer__label">producer: </label></td>
<td><input class="text" id="producer" name="producer" type="text" size="40" value="{{=info.producer}}"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> <input type="submit" value="Soumettre" class="btn"> </td>
......
......@@ -12,7 +12,9 @@
{{pass}}
{{
patient = db.patient[request.vars["id"]]
configh = db.config[request.vars["config_id"]]
query = db(
(db.sequence_file.patient_id==db.patient.id)
......@@ -31,6 +33,7 @@ fused = db(
fused_count = fused.count()
fused_file = fused.select()
analysis = db(
(db.analysis_file.patient_id == patient)
& (db.analysis_file.config_id == config_id)
......
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