info.html 6.75 KB
Newer Older
1
2
{{extend 'db_layout.html'}}

3
4
5
{{('message' in globals())}}
{{if 'message' in globals():}}

6
7
{{patient = db.patient[request.vars["id"]]}}

Marc Duez's avatar
Marc Duez committed
8
{{if request.vars["config_id"] and not request.vars["config_id"] == -1 :}}
Marc Duez's avatar
Marc Duez committed
9
    {{config_id = long(request.vars["config_id"])}}
Marc Duez's avatar
Marc Duez committed
10
    {{config = True}}
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    {{
    patient_name = patient.first_name + " " + patient.last_name
    config_name = db.config[request.vars["config_id"]].name

    fused = db(
        (db.fused_file.patient_id == patient)
        & (db.fused_file.config_id == config_id)
    )
    fused_count = fused.count()
    fused_file = fused.select()
    fused_filename = patient_name +"_"+ config_name + ".data"


    analysis = db(
        (db.analysis_file.patient_id == patient)
        & (db.analysis_file.config_id == config_id)
    )
    analysis_count = analysis.count()
    analysis_file = analysis.select()
    analysis_filename = patient_name +"_"+ config_name + ".analysis"
    }}
Marc Duez's avatar
Marc Duez committed
32
{{else:}}
Marc Duez's avatar
Marc Duez committed
33
34
    {{config_id = -1}}
    {{config = False}}
35
    {{fused_count = 0}}
Marc Duez's avatar
Marc Duez committed
36
37
{{pass}}

38

39
{{
40
41
42
43
44
45
46
47
48
query = db(
            (db.sequence_file.patient_id==db.patient.id) 
            & (db.patient.id==request.vars["id"]) 
        ).select(
            left=db.data_file.on(
                (db.data_file.sequence_file_id==db.sequence_file.id) 
                & (db.data_file.config_id==str(config_id) ) 
            ) 
        )
49
}}
50

51
<div>
52
    
53
    <h3>{{=patient.last_name + " " + patient.first_name}}  ({{=request.vars["id"]}})</h3>
54
    
55
    <div class="db_block">
56
      <!--
57
        <div class="db_block_left">
58
59
            file list
        </div>
60
61
      -->

62
        <div class="db_block_right">
63
            config
64
65
            <span>
                <select id="choose_config" name="config" onchange="db.call('patient/info', {'id' :'{{=request.vars['id']}}', 'config_id' : this.value})">
Marc Duez's avatar
Marc Duez committed
66
67
                    <option value="-1" {{if not config :}}selected{{pass}}> --- </option>
                    {{for row in db(db.config).select() :}}
68
69
70
71
72
73
74
                        <option value="{{=row.id }}" {{if row.id==config_id:}}selected{{pass}} >
                            {{=row.name}} 
                        </option>
                    {{pass}}
                </select>
            </span>
        </div>
75
    </div>
76
    
77
</div>
Marc Duez's avatar
Marc Duez committed
78
79
80

<div id="db_table_container">
    <table class="db_table" id="table">
81
        <thead>
82
            <tr><td class="column1"> file name </td>
Marc Duez's avatar
Marc Duez committed
83
                <td class="column5"> </td>
84
                <td class="column2"> sampling date </td>
85
                <td> info </td>
86
87
                <td class="column5"> </td>
                <td class="column5"> </td>
88
89
90
                
                <td class="column_sep"></td>
                
91
                <td class="column2"> last processing </td>
Marc Duez's avatar
Marc Duez committed
92
                <td class="column4">  </td>
93

94
95
96
            </tr>
        </thead>
        <tbody>
Marc Duez's avatar
Marc Duez committed
97
            {{for row in query :}}
98
99
100
101
102
103
            
                {{if row.sequence_file.data_file is None :}}
                    {{filename = ''}}
                {{else:}}
                    {{(filename, str) = db.sequence_file.data_file.retrieve(row.sequence_file.data_file)}}
                {{pass}} 
104
105
106
107
108
109
                
                {{if row.data_file.scheduler_task_id is None :}}
                    {{status = '' }}
                {{else:}}
                    {{status = db.scheduler_task[row.data_file.scheduler_task_id ].status }}
                {{pass}} 
110
            
Marc Duez's avatar
Marc Duez committed
111
                 <tr>
112
                    <td id="sequence_file_{{=row.sequence_file.id}}"> {{=filename}}</td>
113
                    <td> {{if filename != '':}}<a href="{{=URL('patient','download', scheme='https', args=row.sequence_file.data_file)}}" >dl</a>{{pass}}</td>
Marc Duez's avatar
Marc Duez committed
114
115
                    <td> {{=row.sequence_file.sampling_date}} </td>
                    <td> {{=row.sequence_file.info}} </td>
116
117
118
119
120
                    <td onclick="db.call('file/edit', {'id' :'{{=row.sequence_file.id}}', 'patient_id' :'{{=request.vars['id']}}'} )" > e </td>
                    <td onclick="db.call('file/confirm', {'id' :'{{=row.sequence_file.id}}', 'patient_id' :'{{=request.vars['id']}}'} )" > X </td>
                     
                    <td class="column_sep"></td>
                     
Marc Duez's avatar
Marc Duez committed
121
122
                    <td> {{if row.data_file.run_date :}}{{=row.data_file.run_date }}{{pass}} </td>
                    <td> 
Marc Duez's avatar
Marc Duez committed
123
                        {{if filename != '' and config_id != -1:}}
124
                            {{if row.data_file.id == None or ( status != "RUNNING" and status != "QUEUED" and status != "ASSIGNED"):}}
Marc Duez's avatar
Marc Duez committed
125
                            {{if auth.has_permission("run", "data_file") :}}
126
127
128
129
                                <span class="button" onclick="db.call('default/run_request', { 'sequence_file_id' : '{{=row.sequence_file.id}}', 'config_id' : {{=config_id}} } )"> run >> </span>
                                {{else:}}
                                <span class="button inactive" title="you don't have permission to schedule runs"> run >> </span>
                                {{pass}}
Marc Duez's avatar
Marc Duez committed
130
                            {{else:}}
131
                            {{=status}}
Marc Duez's avatar
Marc Duez committed
132
133
                            {{pass}}
                        {{pass}}
Marc Duez's avatar
Marc Duez committed
134
135
                    </td>
                </tr>
136
137
138
            {{pass}}
        </tbody>
    </table>
Marc Duez's avatar
Marc Duez committed
139
140
    <table class="db_table" id="db_fixed_header"></table>
</div>
141

142

143
<div class="db_block">
144
    
145
    <div class="db_block_left">
146
        {{if auth.has_permission("upload", "sequence_file") :}}
Marc Duez's avatar
Marc Duez committed
147
        <span class="button2" onclick="db.call('file/add', { 'id' : '{{=request.vars["id"]}}' } )"> add file </span>
148
149
150
        {{else:}}
        <span class="button2 inactive" onclick="db.call('file/add', { 'id' : '{{=request.vars["id"]}}' } )" title="you don't have permission to upload files"> add file </span>
        {{pass}}
Marc Duez's avatar
Marc Duez committed
151
    </div>
152
153
    
    
Marc Duez's avatar
Marc Duez committed
154
    <div class="db_block_right">
155
156
157
158
159
        result :
        {{for row in db(db.fused_file.patient_id == request.vars["id"]).select() :}}
            <span class="button2" onclick="db.load_data( { 'patient_id' : '{{=request.vars["id"]}}' , 'config_id' : {{=row.config_id}} } )" >
                {{=db.config[row.config_id].name}} </span>
        {{pass}} 
160
    </div>
161
    
Marc Duez's avatar
Marc Duez committed
162
</div>
163

164
{{if fused_count >0:}}
Marc Duez's avatar
Marc Duez committed
165
<div class="db_block">
166
    <div class="db_block_right">
167
        download {{=db.config[config_id].name}}
168
        <a class="button" href={{=URL('default', 'download', scheme='https', args=fused_file[0].fused_file, vars=dict(filename=fused_filename))}} type="application/octet-stream" download> .data </a>
169
        {{if analysis_count >0:}}
170
        <a class="button" href={{=URL('default', 'download', scheme='https', args=analysis_file[0].analysis_file, vars=dict(filename=analysis_filename))}} type="application/octet-stream" download> .analysis </a>
171
        {{pass}}
172
173
    </div>
</div>
Marc Duez's avatar
Marc Duez committed
174
{{pass}}
175

176
177
178
179
180
181
182
</div>

{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}