Skip to content
GitLab
Explore
Sign in
Commits on Source (6)
Basic mark detail popup on the search page
· 54e5378e
Marco De Donno
authored
Feb 14, 2020
54e5378e
Set the 'pianosendpoint' value to None if no PiAnoS server is available
· 066c10fa
Marco De Donno
authored
Feb 16, 2020
066c10fa
Split the configuration file to run on localhost
· b9fabd30
Marco De Donno
authored
Feb 16, 2020
b9fabd30
Retrieve all marks from the database, even if no additinal informations is present
· c3726368
Marco De Donno
authored
Feb 17, 2020
c3726368
Add the names for the writer palms
· 53c099c7
Marco De Donno
authored
Feb 17, 2020
53c099c7
Add the reference preview for the marks search page
· e154fd8c
Marco De Donno
authored
Feb 17, 2020
e154fd8c
Hide whitespace changes
Inline
Side-by-side
config.py
View file @
e154fd8c
...
...
@@ -49,6 +49,7 @@ try:
pianosendpoint
=
os
.
environ
.
get
(
"
PIANOS_ENDPOINT
"
,
"
/pianos
"
)
except
:
pianosdb
=
None
pianosendpoint
=
None
dburl
=
os
.
environ
.
get
(
"
DB_URL
"
,
"
pgsql://icnml:icnml@db:5432/icnml
"
)
db
=
Database
(
dburl
)
...
...
@@ -67,15 +68,20 @@ sender = os.environ.get( "SMTP_SENDER", "icnml@unil.ch" )
POPPLER_PATH
=
os
.
environ
.
get
(
"
POPPLER_PATH
"
,
""
)
SESSION_COOKIE_SECURE
=
True
SESSION_COOKIE_SAMESITE
=
"
Strict
"
if
envtype
!=
"
DEV
"
:
SESSION_COOKIE_SECURE
=
True
SESSION_COOKIE_SAMESITE
=
"
Strict
"
domain
=
"
https://icnml.unil.ch
"
RP_ID
=
"
icnml.unil.ch
"
else
:
domain
=
"
http://localhost
"
RP_ID
=
"
localhost
"
domain
=
"
https://icnml.unil.ch
"
baseurl
=
os
.
environ
.
get
(
"
BASEURL
"
,
""
)
fulldomain
=
domain
+
baseurl
cdn
=
fulldomain
+
"
/cdn
"
RP_ID
=
"
icnml.unil.ch
"
ORIGIN
=
domain
rp_name
=
"
ICNML
"
...
...
sql/install/21-pc.sql
View file @
e154fd8c
...
...
@@ -71,6 +71,8 @@ INSERT INTO public.pc (id, name) VALUES (11, 'Right thumb slap');
INSERT
INTO
public
.
pc
(
id
,
name
)
VALUES
(
12
,
'Left thumb slap'
);
INSERT
INTO
public
.
pc
(
id
,
name
)
VALUES
(
13
,
'Right control slap'
);
INSERT
INTO
public
.
pc
(
id
,
name
)
VALUES
(
14
,
'Left control slap'
);
INSERT
INTO
public
.
pc
(
id
,
name
)
VALUES
(
22
,
'Right writer palm'
);
INSERT
INTO
public
.
pc
(
id
,
name
)
VALUES
(
24
,
'Left writer palm'
);
INSERT
INTO
public
.
pc
(
id
,
name
)
VALUES
(
1000
,
'All rolled'
);
...
...
views/trainer/__init__.py
View file @
e154fd8c
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from
flask
import
Blueprint
from
_collections
import
defaultdict
import
json
from
const
import
pfsp
import
config
from
flask
import
Blueprint
import
config
from
const
import
pfsp
from
utils.decorator
import
login_required
from
utils.template
import
my_render_template
from
MDmisc.RecursiveDefaultDict
import
edefaultdict
,
defDict
trainer_view
=
Blueprint
(
"
trainer
"
,
__name__
,
template_folder
=
"
templates
"
)
@trainer_view.route
(
"
/trainer/search
"
)
...
...
@@ -21,18 +23,40 @@ def search():
"""
sql
=
"""
SELECT
mark_info.*,
files.id,
files.uuid,
mark_info.pfsp,
mark_info.detection_technic,
mark_info.surface,
files.note,
submissions.uuid AS submission_uuid,
users.username
FROM
mark_info
INNER
JOIN
files
ON mark_info.uuid = files.uuid
FROM
files
LEFT
JOIN
mark_info
ON mark_info.uuid = files.uuid
LEFT JOIN submissions ON files.folder = submissions.id
LEFT JOIN users ON submissions.donor_id = users.id
ORDER BY id ASC
WHERE ( files.type = 3 OR files.type = 4 )
ORDER BY files.id ASC
"""
marks
=
config
.
db
.
query_fetchall
(
sql
)
sql
=
"""
SELECT
submissions.uuid AS submissions_uuid,
segments_locations.fpc,
segments_locations.tenprint_id
FROM segments_locations
INNER JOIN files ON segments_locations.tenprint_id = files.uuid
LEFT JOIN submissions ON files.folder = submissions.id
ORDER BY fpc
"""
ref_list
=
config
.
db
.
query_fetchall
(
sql
)
refs
=
defDict
()
for
ref
in
ref_list
:
refs
[
ref
[
"
submissions_uuid
"
]
][
ref
[
"
fpc
"
]
]
=
ref
[
"
tenprint_id
"
]
all_detection_technics
=
config
.
db
.
query_fetchall
(
"
SELECT * FROM detection_technics ORDER BY name ASC
"
)
surfaces
=
config
.
db
.
query_fetchall
(
"
SELECT * FROM surfaces ORDER BY name ASC
"
)
...
...
@@ -46,9 +70,30 @@ def search():
v
[
"
username
"
]
=
v
[
"
username
"
].
replace
(
"
_
"
,
"
"
)
# PFSP zones to fpc
pfsp2fpc
=
defaultdict
(
list
)
for
pfc
in
xrange
(
1
,
11
):
for
loc
in
[
"
tip
"
,
"
distal
"
]:
pfsp2fpc
[
"
F{}-{}
"
.
format
(
pfc
,
loc
)
].
append
(
pfc
)
pfsp2fpc
[
"
F1-tip
"
].
append
(
11
)
pfsp2fpc
[
"
F1-distal
"
].
append
(
11
)
pfsp2fpc
[
"
F6-tip
"
].
append
(
12
)
pfsp2fpc
[
"
F6-distal
"
].
append
(
12
)
for
side
,
fpc
in
[
(
"
Right
"
,
25
),
(
"
Left
"
,
27
)
]:
for
z
in
[
"
grasp
"
,
"
carpal_delta_area
"
,
"
wrist_bracelet
"
,
"
thenar
"
,
"
hypothenar
"
,
"
interdigital
"
,
"
writer_palm
"
]:
pfsp2fpc
[
"
{}-{}
"
.
format
(
side
,
z
)
].
append
(
fpc
)
pfsp2fpc
[
"
Right-writer_palm
"
].
append
(
22
)
pfsp2fpc
[
"
Left-writer_palm
"
].
append
(
24
)
#
return
my_render_template
(
"
trainer/search.html
"
,
marks
=
marks
,
refs
=
refs
,
pfsp2fpc
=
pfsp2fpc
,
all_detection_technics
=
all_detection_technics
,
surfaces
=
surfaces
,
all_pfsp
=
pfsp
.
zones
...
...
views/trainer/templates/trainer/search.html
View file @
e154fd8c
...
...
@@ -63,6 +63,20 @@
grid-column-gap
:
20px
;
grid-template-columns
:
auto
1
fr
;
}
.icnml_mark_detail
{
display
:
grid
;
grid-gap
:
10px
;
grid-template-columns
:
1
fr
1
fr
;
height
:
100%
;
}
#icnml_mark_detail_left
,
#icnml_mark_detail_right
{
height
:
100%
;
background-size
:
contain
;
background-position
:
center
;
background-repeat
:
no-repeat
;
}
</style>
<script
type=
"text/javascript"
>
...
...
@@ -74,6 +88,7 @@
"
uuid
"
:
"
{{ mark[ 'uuid' ] }}
"
,
"
id
"
:
"
{{ mark[ 'id' ] }}
"
,
"
pfsp
"
:
"
{{ mark[ 'pfsp' ] }}
"
.
split
(
"
,
"
),
"
submission_uuid
"
:
"
{{ mark[ 'submission_uuid' ] }}
"
,
"
dt
"
:
"
{{ mark[ 'detection_technic' ] }}
"
.
split
(
"
,
"
),
"
surface
"
:
"
{{ mark[ 'surface' ] }}
"
.
split
(
"
,
"
),
"
note
"
:
"
{{ mark[ 'note' ] | default( '', true ) }}
"
...
...
@@ -99,6 +114,16 @@
pfsp_sel
[
"
{{ pfsp[ 'desc' ] }}
"
]
=
tmp
;
{
%
endfor
%
}
var
pfsp2fpc
=
{};
{
%
for
pfsp
,
fpc
in
pfsp2fpc
.
iteritems
()
%
}
pfsp2fpc
[
"
{{ pfsp }}
"
]
=
[];
{
%
for
f
in
fpc
%
}
pfsp2fpc
[
"
{{ pfsp }}
"
].
push
(
"
{{ f }}
"
);
{
%
endfor
%
}
{
%
endfor
%
}
var
update_filter_detection
=
function
(
arg
)
{
var
selected
=
$
(
this
).
val
();
...
...
@@ -177,6 +202,78 @@
}
}
);
}
var
mark_details
=
function
(
event
)
{
var
target
=
event
.
currentTarget
.
id
.
replace
(
"
outer_div_mark_
"
,
""
);
var
target_ref
=
[];
var
target_fpc
=
[];
_
.
forEach
(
marks
[
target
][
"
pfsp
"
],
function
(
pfsp
)
{
_
.
forEach
(
pfsp2fpc
[
pfsp
],
function
(
fpc
)
{
target_ref
.
push
(
refs
[
marks
[
target
][
"
submission_uuid
"
]
][
fpc
]
);
target_fpc
.
push
(
fpc
);
}
);
}
);
target_ref
=
target_ref
[
0
];
target_fpc
=
target_fpc
[
0
];
$
(
"
<div />
"
)
.
attr
(
"
id
"
,
"
mark_details_dialog
"
)
.
append
(
$
(
"
<div/>
"
)
.
attr
(
"
class
"
,
"
icnml_mark_detail
"
)
.
append
(
$
(
"
<div/>
"
)
.
append
(
$
(
"
<div />
"
)
.
attr
(
"
id
"
,
"
icnml_mark_detail_left
"
)
.
attr
(
"
style
"
,
"
background-image:url( {{ url_for( 'image.image_file_serve', file_id = 'uuid' ) }} )
"
.
replace
(
"
uuid
"
,
target
)
)
)
)
.
append
(
$
(
"
<div/>
"
)
.
attr
(
"
id
"
,
"
icnml_mark_detail_right
"
)
.
attr
(
"
style
"
,
"
background-image:url( {{ url_for( 'image.image_segment_serve', tenprint_id = 'uuid', pc = 'fpc' ) }} )
"
.
replace
(
"
uuid
"
,
target_ref
).
replace
(
"
fpc
"
,
target_fpc
)
)
)
)
.
dialog
(
{
title
:
"
Details about the mark 'Mark
"
+
marks
[
target
][
'
id
'
]
+
"
'
"
,
modal
:
true
,
resizable
:
false
,
width
:
$
(
window
).
width
()
*
0.8
,
height
:
$
(
window
).
height
()
*
0.8
,
buttons
:
{
"
OK
"
:
function
(){
$
(
this
).
dialog
(
"
close
"
);
}
},
close
:
function
()
{
$
(
this
).
remove
();
},
open
:
function
()
{
$
(
"
.ui-widget-overlay
"
).
bind
(
"
click
"
,
function
()
{
$
(
"
#mark_details_dialog
"
).
dialog
(
"
close
"
);
}
);
}
}
);
}
var
refs
=
{};
{
%
for
submission_id
,
value
in
refs
.
iteritems
()
%
}
var
tmp
=
{};
{
%
for
fpc
,
tenprint_id
in
value
.
iteritems
()
%
}
tmp
[
"
{{ fpc }}
"
]
=
"
{{ tenprint_id }}
"
;
{
%
endfor
%
}
refs
[
"
{{ submission_id }}
"
]
=
tmp
;
{
%
endfor
%
}
</script>
</head>
<body
class=
"icnml_main_layout"
>
...
...
@@ -293,6 +390,8 @@
$
(
"
#filter_notes_input
"
).
on
(
"
keyup
"
,
update_filter_note
);
$
(
"
.mark_outer
"
).
on
(
"
click
"
,
mark_details
);
$
(
"
#icnml_navigation_trainersearch
"
)
.
addClass
(
"
activated
"
);
</script>
...
...