Skip to content

Commit deb7c95

Browse files
committed
* clearer result presentation. formats for basic requests, description for basic responses
* one to many relationship in view between basic requests and basic responses
1 parent 05ba85f commit deb7c95

15 files changed

+425
-405
lines changed

recastfrontend/admincli.py

+8-11
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
import IPython
33
import os
44
import yaml
5+
import populate_db
56

67
def set_config(config):
78
if config:
89
os.environ['RECASTFRONTEND_CONFIG'] = config
910
from frontendconfig import config as frontendconf
1011

11-
1212
@click.group()
1313
def admincli():
1414
pass
@@ -42,19 +42,16 @@ def drop_db(config):
4242
with app.app_context():
4343
from recastfrontend.server import db
4444
db.drop_all()
45+
click.secho('dropped all at {}'.format(db.engine.url), fg = 'green')
46+
4547

4648
@admincli.command()
4749
@click.option('--config', '-c')
4850
def fill_db(config):
4951
set_config(config)
50-
import populate_db
51-
from recastfrontend.server import db
52-
click.secho('filled database at: {}'.format(db.engine.url), fg='green')
52+
from recastfrontend.server import app
53+
with app.app_context():
54+
from recastfrontend.server import db
55+
populate_db.populate_db(db)
56+
click.secho('filled database at: {}'.format(db.engine.url), fg='green')
5357

54-
@admincli.command()
55-
@click.option('--config', '-c')
56-
def test(config):
57-
set_config(config)
58-
import unittest
59-
tests = unittest.TestLoader().discover('tests')
60-
unittest.TextTestRunner(verbosity=2).run(tests)

recastfrontend/forms.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ class AnalysisSubmitForm(Form):
1515
validators=[DataRequired(message="Collaboration required")])
1616
description = TextAreaField('Description',
1717
validators=[DataRequired(message="Description required")])
18-
e_print = StringField('E print')
19-
journal = StringField('Journal')
18+
arxiv_id = StringField('ArXiv Id')
2019
doi = StringField('DOI')
21-
inspire_URL = StringField('URL')
20+
inspire_id = StringField('INSPIRE ID')
21+
cds_id = StringField('CDS ID')
2222

2323
class UserSubmitForm(Form):
2424
name = StringField('user name', validators=[DataRequired()])

recastfrontend/frontendcli.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ def server(config):
1616
from server import app
1717
port = int(os.environ.get("RECAST_FRONTEND_PORT", 5000))
1818

19-
app.run(host='0.0.0.0', port=port, ssl_context = (os.environ['RECAST_SSL_CERT'],os.environ['RECAST_SSL_KEY']), threaded = True)
19+
ssl_kwargs = dict(
20+
ssl_context = (os.environ['RECAST_SSL_CERT'],os.environ['RECAST_SSL_KEY'])
21+
) if os.environ.get('RECAST_SSL_ENABLE',True) else {}
22+
23+
app.run(host='0.0.0.0', port=port, threaded = True, **ssl_kwargs)
2024

2125
@frontendcli.command()
2226
@click.option('--config','-c')

recastfrontend/populate_db.py

+286-272
Large diffs are not rendered by default.

recastfrontend/server.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def about():
7171

7272
@app.route('/login')
7373
def login_user():
74-
if 'RECAST_DUMMYLOGIN' in os.environ:
75-
user = User(orcid = os.environ['RECAST_ORCID'], fullname = 'Lukas Heinrich', authenticated = True)
74+
if 'RECAST_DUMMYLOGIN' in frontendconf:
75+
user = User(orcid = frontendconf['RECAST_ORCID'], authenticated = True)
7676
login.login_user(user)
7777
return redirect(url_for('home'))
7878

recastfrontend/synctasks.py

+19-16
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,25 @@ def createAnalysisFromForm(app,form,current_user, run_condition_form):
1111
with app.app_context():
1212
user_query = dbmodels.User.query.filter(dbmodels.User.name == current_user.name()).all()
1313
assert len(user_query)==1
14-
run_condition = dbmodels.RunCondition(name = run_condition_form.name.data,
15-
description = run_condition_form.description.data
16-
)
14+
run_condition = dbmodels.RunCondition(
15+
name = run_condition_form.name.data,
16+
description = run_condition_form.description.data
17+
)
1718

1819
db.session.add(run_condition)
1920
db.session.commit()
2021

21-
analysis = dbmodels.Analysis(owner_id = user_query[0].id,
22-
title = form.title.data,
23-
collaboration = form.collaboration.data,
24-
e_print = form.e_print.data,
25-
journal = form.journal.data,
26-
doi = form.doi.data,
27-
inspire_URL = form.inspire_URL.data,
28-
description = form.description.data,
29-
run_condition_id = run_condition.id
30-
)
22+
analysis = dbmodels.Analysis(
23+
owner_id = user_query[0].id,
24+
title = form.title.data,
25+
collaboration = form.collaboration.data,
26+
arxiv_id = form.arxiv_id.data,
27+
doi = form.doi.data,
28+
inspire_id = form.inpire_id.data,
29+
cds_id = form.cds_id.data,
30+
description = form.description.data,
31+
run_condition_id = run_condition.id
32+
)
3133

3234
db.session.add(analysis)
3335
db.session.commit()
@@ -49,9 +51,10 @@ def createModelFromForm(app, form, current_user):
4951

5052
def createRunConditionFromForm(app, form, current_user):
5153
with app.app_context():
52-
run_condition = dbmodels.RunCondition(name = form.name.data,
53-
description = form.description.data
54-
)
54+
run_condition = dbmodels.RunCondition(
55+
name = form.name.data,
56+
description = form.description.data
57+
)
5558

5659
db.session.add(run_condition)
5760
db.session.commit()

recastfrontend/templates/analyses.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ <h1>All Analyses</h1>
1212
<li>
1313
<ul>
1414
<li>description: {{analysis.description_of_original_analysis}}</li>
15-
<li>owner: {{analysis.user.name}}</li>
15+
<li>owner: {{analysis.owner.name}}</li>
1616
<li>run conditions: {{analysis.run_condition.title}}</li>
1717
</ul>
1818
</li>

recastfrontend/templates/analyses_views.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ <h4 class="text-center">
6666
<div class="inline-block text-center">
6767
<span class="badge">
6868
<i class="glyphicon glyphicon-user"></i>
69-
&nbsp;{{analysis.user.name}}
69+
&nbsp;{{analysis.owner.name}}
7070
</span>
7171
<span class="badge">
7272
{{analysis.scan_requests[:]|length}}&nbsp;requests

recastfrontend/templates/analysis.html

+4-12
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,19 @@ <h3 class="card-title" style="margin-top:5px;">{{ analysis.title }} </h3>
8383
<br>
8484
<span class="badge">
8585
<i class="glyphicon glyphicon-user"></i>
86-
&nbsp; {{ analysis.user.name }}
86+
&nbsp; {{ analysis.owner.name }}
8787
</span>
8888
&nbsp;&nbsp;&nbsp;
8989
<span class="label label-primary" style="font-size:13px;">
9090
{{ analysis.collaboration }}
9191
</span>
9292
<br><br>
93-
{% if analysis.e_print %}
93+
{% if analysis.arxiv_id %}
9494
<span class="label label-default">
9595
<i class="glyphicon glyphicon-tag"></i>
9696
&nbsp;
97-
<strong>E print:</strong>
98-
&nbsp;{{ analysis.e_print }}
97+
<strong>ArXiv ID:</strong>
98+
&nbsp;{{ analysis.arxiv_id }}
9999
</span>
100100
{% endif %}
101101
{% if analysis.doi %}
@@ -106,14 +106,6 @@ <h3 class="card-title" style="margin-top:5px;">{{ analysis.title }} </h3>
106106
&nbsp;{{ analysis.doi }}
107107
</span>
108108
{% endif %}
109-
{% if analysis.journal %}
110-
&nbsp;<span class="label label-default">
111-
<i class="glyphicon glyphicon-book"></i>
112-
&nbsp;
113-
<strong>Journal:</strong>
114-
&nbsp;{{ analysis.journal }}
115-
</span>
116-
{% endif %}
117109

118110
<br><br>
119111
<strong>run condition</strong>

recastfrontend/templates/analysis_form.html

+3-4
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@
4343
{{ render_field(form.title, "Required", "required", "fa fa-book") }}
4444
{{ render_field(form.collaboration, "Select collaboration", "required", "fa fa-users") }}
4545
{{ render_field(form.description, "Required", "required", "fa fa-pencil", "rows='16'") }}
46-
{{ render_field(form.e_print, "Optional", "", "fa fa-bookmark") }}
47-
{{ render_field(form.journal, "Optional", "", "fa fa-tag") }}
4846
{{ render_field(form.doi, "Optional", "", "fa fa-link") }}
49-
{{ render_field(form.inspire_URL, "Optional", "", "fa fa-link") }}
47+
{{ render_field(form.arxiv_id, "Optional", "", "fa fa-bookmark") }}
48+
{{ render_field(form.inspire_id, "Optional", "", "fa fa-link") }}
49+
{{ render_field(form.cds_id, "Optional", "", "fa fa-link") }}
5050

51-
5251
<br>
5352
</div>
5453
</div>
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
1-
<div class="col-md-8">
2-
<div class="col-md-12" ng-controller="ParameterViewCtrl as ctrl">
3-
<div class="col-md-12">
4-
<table class="table">
5-
<thead>
6-
<td>-2σ</td>
7-
<td>-1σ</td>
8-
<td>CLs exp.</td>
9-
<td>+1σ</td>
10-
<td>+2σ</td>
11-
<td>CLs obs.</td>
12-
<td>LogL</td>
13-
</thead>
14-
<tbody>
15-
<td>{{ basicresponse.lower_2sig_expected_CLs }}</td>
16-
<td>{{ basicresponse.lower_1sig_expected_CLs }}</td>
17-
<td>{{ basicresponse.expected_CLs }}</td>
18-
<td>{{ basicresponse.upper_1sig_expected_CLs }}</td>
19-
<td>{{ basicresponse.upper_2sig_expected_CLs }}</td>
20-
<td>{{ basicresponse.observed_CLs }}</td>
21-
<td>{{ basicresponse.log_likelihood_at_reference }}</td>
22-
</tbody>
23-
</table>
24-
</div>
25-
26-
</div>
27-
</div>
1+
<table class="table">
2+
<thead>
3+
<td>-2σ</td>
4+
<td>-1σ</td>
5+
<td>CLs exp.</td>
6+
<td>+1σ</td>
7+
<td>+2σ</td>
8+
<td>CLs obs.</td>
9+
<td>LogL</td>
10+
</thead>
11+
<tbody>
12+
<td>{{ basicresponse.lower_2sig_expected_CLs }}</td>
13+
<td>{{ basicresponse.lower_1sig_expected_CLs }}</td>
14+
<td>{{ basicresponse.expected_CLs }}</td>
15+
<td>{{ basicresponse.upper_1sig_expected_CLs }}</td>
16+
<td>{{ basicresponse.upper_2sig_expected_CLs }}</td>
17+
<td>{{ basicresponse.observed_CLs }}</td>
18+
<td>{{ basicresponse.log_likelihood_at_reference }}</td>
19+
</tbody>
20+
</table>

recastfrontend/templates/modal_add_basic_request.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<div class="modal-content">
44
<div class="modal-header">
55
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
6-
<h3 class="modal-title" id="coordinate-model-label">Add Coordinate</h3>
6+
<h3 class="modal-title" id="basicreq-model-label">Add Basic Request </h3>
77
</div>
88

99
<div class="modal-body">
1010

11-
<form id="form-add-coordinate" method="post" class="form-horizontal">
11+
<form id="form-add-basicrequest" method="post" class="form-horizontal">
1212

1313
<div class="form-group required">
1414
<label class="control-label col-md-4" for="zip-file">Zip File:</label>
@@ -24,8 +24,8 @@ <h3 class="modal-title" id="coordinate-model-label">Add Coordinate</h3>
2424
</div><!-- end modal body -->
2525

2626
<div class="modal-footer">
27-
<button class="btn btn-warning pull-left" ng-click="ctrl.hideModal()" id="coordinate-reject-data" type="button"><i class="glyphicon glyphicon-remove"></i>&nbsp;Cancel</button>
28-
<button class="btn btn-primary pull-right" id="coordinate-accept-data" ng-click="ctrl.submit()" type="button"><i class="glyphicon glyphicon-ok"></i>&nbsp;Submit</button>
27+
<button class="btn btn-warning pull-left" ng-click="ctrl.hideModal()" id="basicreq-reject-data" type="button"><i class="glyphicon glyphicon-remove"></i>&nbsp;Cancel</button>
28+
<button class="btn btn-primary pull-right" id="basicreq-accept-data" ng-click="ctrl.submit()" type="button"><i class="glyphicon glyphicon-ok"></i>&nbsp;Submit</button>
2929
</div>
3030

3131

recastfrontend/templates/modal_add_parameter.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<div class="modal-header">
77
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
8-
<h3 class="modal-title" id="modalLabel">Add Parameter</h3>
8+
<h3 class="modal-title" id="modalLabel">Add Parameter Point</h3>
99
</div>
1010

1111
<div class="modal-body">

0 commit comments

Comments
 (0)