info.html 7.71 KB
Newer Older
1
{{extend 'db_layout.html'}}
2
{{import vidjil_utils}}
Marc Duez's avatar
Marc Duez committed
3

4
5


6
<div>
Marc Duez's avatar
Marc Duez committed
7

8
    <h3>{{=vidjil_utils.anon(request.vars['id'], auth.user.id)}}</h3>
Marc Duez's avatar
Marc Duez committed
9

10
    <div class="db_block">
11

12
        <div class="db_block_left">
13
            <span class="button" onclick="db.call('patient/edit', { 'id' : '{{=request.vars["id"]}}' } )" > edit patient info </span>
14
        </div>
15

16

17
        <div class="db_block_right">
18
        {{if auth.has_permission("run", "results_file") :}}
19
            config
20
21
            <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
22
                    <option value="-1" {{if not config :}}selected{{pass}}> --- </option>
23
                    {{for row in db((auth.accessible_query('read', db.config) | auth.accessible_query('admin', db.config) ) ).select(orderby=~db.config.name) :}}
24
                        <option value="{{=row.id }}" {{if row.id==config_id:}}selected{{pass}} >
Marc Duez's avatar
Marc Duez committed
25
                            {{=row.name}}
26
27
28
29
                        </option>
                    {{pass}}
                </select>
            </span>
30
        {{pass}}
31
        </div>
32
    </div>
Marc Duez's avatar
Marc Duez committed
33

34
</div>
Marc Duez's avatar
Marc Duez committed
35
36
37

<div id="db_table_container">
    <table class="db_table" id="table">
38
        <thead>
Mathieu Giraud's avatar
Mathieu Giraud committed
39
            <tr><td class="column_200"> file name </td>
40
                <td class="column2"> sampling date </td>
41
                <td> info </td>
42
                <td> pcr </td>
Marc Duez's avatar
Marc Duez committed
43
                <td class="column1"> size </td>
44
		{{if auth.has_membership('admin'):}} <td class="column_100"> uploader </td> {{pass}}
Marc Duez's avatar
Marc Duez committed
45
                <td class="column5"> </td>
46
47
                <td class="column5"> </td>
                <td class="column5"> </td>
Marc Duez's avatar
Marc Duez committed
48

49
                <td class="column_sep"></td>
Marc Duez's avatar
Marc Duez committed
50

Marc Duez's avatar
Marc Duez committed
51
52
53
54
                <td class="column2">last processing</td>
                <td class="column2">status</td>
                <td class="column5"></td>
                <td class="column4"></td>
55

56
57
58
            </tr>
        </thead>
        <tbody>
Marc Duez's avatar
Marc Duez committed
59
            {{for row in query :}}
Marc Duez's avatar
Marc Duez committed
60
                {{if row.results_file.scheduler_task_id is None or db.scheduler_task[row.results_file.scheduler_task_id ] is None:}}
61
62
                    {{status = '' }}
                {{else:}}
63
                    {{status = db.scheduler_task[row.results_file.scheduler_task_id ].status }}
Marc Duez's avatar
Marc Duez committed
64
65
                {{pass}}

Marc Duez's avatar
Marc Duez committed
66
                 <tr>
Marc Duez's avatar
Marc Duez committed
67
68
                    <td {{if row.sequence_file.data_file == None :}} {{=XML("class='inactive' title='file is missing' ")}}  {{pass}} id="sequence_file_{{=row.sequence_file.id}}">
                         {{=row.sequence_file.filename}}
69
                    </td>
Marc Duez's avatar
Marc Duez committed
70
71
                    <td> {{=row.sequence_file.sampling_date}} </td>
                    <td> {{=row.sequence_file.info}} </td>
72
                    <td> {{=row.sequence_file.pcr}} </td>
73
                    <td {{if row.sequence_file.data_file == None :}} {{=XML("class='inactive' title='file is missing' ")}} {{pass}} >
74
                        {{=vidjil_utils.format_size(row.sequence_file.size_file)}} </td>
75
76
77
78
		    {{if auth.has_membership('admin'):}}
		    <td> {{=row.sequence_file.provider}} {{if row.sequence_file.provider:}}{{=row.sequence_file.provider.last_name}}{{pass}}</td>
		    {{pass}}

79
                    {{if (auth.has_permission('admin', 'patient', request.vars["id"]) ):}}
Mathieu Giraud's avatar
Mathieu Giraud committed
80
81
                        <td class="pointer" onclick="db.call('file/edit', {'id' :'{{=row.sequence_file.id}}', 'patient_id' :'{{=request.vars['id']}}'} )" > e </td>
                        <td class="pointer" onclick="db.call('file/confirm', {'id' :'{{=row.sequence_file.id}}', 'patient_id' :'{{=request.vars['id']}}'} )" > X </td>
82
                        <td> <a {{if row.sequence_file.data_file == None :}} {{=XML("class='inactive' title='file is missing' ")}}
Marc Duez's avatar
Marc Duez committed
83
                                {{else:}} href="{{=URL('patient','download', scheme='https', args=row.sequence_file.data_file)}}" {{pass}}  >dl</a></td>
84
                    {{else:}}<td></td><td></td><td></td>{{pass}}
85
86


87
                    <td class="column_sep"></td>
88

Marc Duez's avatar
Marc Duez committed
89
90
91

                   {{if row.results_file.run_date :}}
                       <td class="button" onclick="db.call('results_file/info', { 'results_file_id' : '{{=row.results_file.id}}' } )"> {{=row.results_file.run_date }}</td>
92
                   {{else:}}<td></td>{{pass}}
93
                   <td class="button" onclick="db.call('results_file/info', { 'results_file_id' : '{{=row.results_file.id}}' } )"> {{=status}} </td>
Mathieu Giraud's avatar
Mathieu Giraud committed
94
                   <td class="pointer" onclick="db.call('results_file/confirm', {'results_file_id' :'{{=row.results_file.id}}'})" > X </td>
Marc Duez's avatar
Marc Duez committed
95
                   <td>
Marc Duez's avatar
Marc Duez committed
96
                   {{if row.sequence_file.data_file != None and ( row.results_file.id == None or ( status != "RUNNING" and status != "QUEUED" and status != "ASSIGNED") ):}}
Marc Duez's avatar
Marc Duez committed
97
98
99
100
101
                       {{if auth.has_permission("run", "results_file") :}}
                           <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}}
                   {{pass}}
                   </td>
Marc Duez's avatar
Marc Duez committed
102
                </tr>
103
            {{pass}}
104

105
106
        </tbody>
    </table>
Marc Duez's avatar
Marc Duez committed
107
108
    <table class="db_table" id="db_fixed_header"></table>
</div>
109

110

111
<div class="db_block">
Marc Duez's avatar
Marc Duez committed
112

113
    <div class="db_block_left">
114
115
        {{if auth.has_permission('admin', 'patient', request.vars["id"]):}}
        <span class="button2" onclick="db.call('file/add', { 'id' : '{{=request.vars["id"]}}' } )"> + add file </span>
116
117
118

        {{if not auth.has_permission("run", "results_file") :}}

119
120
        <br /> Once your data are uploaded, please
  <a href="mailto:contact@vidjil.org?Subject=%5Bvidjil%5D%20New%20sequences&Body=%0AHi%2C%0A%0AI%20uploaded%20some%20sequences%20on%20the%20rbx.vidjil.org%20server.%0ACould%20you%20run%20Vidjil%20on%20these%20data%20%3F%0A%0A">request an analysis</a>.
121
        {{pass}}
Vidjil Team's avatar
Vidjil Team committed
122
123
124

        {{pass}}

Marc Duez's avatar
Marc Duez committed
125
    </div>
Marc Duez's avatar
Marc Duez committed
126
127


Marc Duez's avatar
Marc Duez committed
128
    <div class="db_block_right">
Vidjil Team's avatar
Vidjil Team committed
129
        see the result:
130
        {{for row in db(db.fused_file.patient_id == request.vars["id"]).select() :}}
131
            {{filename = vidjil_utils.anon(request.vars["id"], auth.user_id) + " (" + db.config[row.config_id].name + ")"}}
132
            {{if row.fused_file is not None :}}
133
134
135
136
                <a class="button2" href="index.html?patient={{=request.vars["id"]}}&config={{=row.config_id}}" type="text/html"
                      onclick="event.preventDefault()
                               if( event.which == 2 ) { window.open(this.href) }
                               else { db.load_data( { 'patient' : '{{=request.vars["id"]}}' , 'config' : {{=row.config_id}} }, '{{=filename}}' ) }" >
137
            {{pass}}
138
                {{=db.config[row.config_id].name}} </a>
Marc Duez's avatar
Marc Duez committed
139
        {{pass}}
140
    </div>
Marc Duez's avatar
Marc Duez committed
141

Marc Duez's avatar
Marc Duez committed
142
</div>
143

144
{{if fused_count >0:}}
Marc Duez's avatar
Marc Duez committed
145
<div class="db_block">
146
    <div class="db_block_right">
147
148
        {{if row.fused_file is not None :}}
            download {{=db.config[config_id].name}}
149
150
151
        <!--
            <a class="button" href={{=URL('default', 'download_data', scheme='https', vars=dict(patient=request.vars["id"] ,config=request.vars["config_id"], filename=fused_filename ) )}} type="application/octet-stream" download> .data </a>
        -->
152
153
154
155
            <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>
            {{if analysis_count >0:}}
            <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>
            {{pass}}
156
        {{pass}}
157
158
    </div>
</div>
Marc Duez's avatar
Marc Duez committed
159
{{pass}}
160

161
</div>