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