From ebf18f19e8fcf66a54242ab9d17411f31ee47c95 Mon Sep 17 00:00:00 2001
From: Askill
Date: Thu, 19 Mar 2020 19:11:04 +0100
Subject: [PATCH] validate UI done?
---
application/endpoints.py | 20 +++++++++++----
application/static/main.js | 42 ++++++--------------------------
application/static/render.js | 9 +++++++
application/templates/index.html | 1 +
4 files changed, 33 insertions(+), 39 deletions(-)
diff --git a/application/endpoints.py b/application/endpoints.py
index a8228ff..324f23e 100644
--- a/application/endpoints.py
+++ b/application/endpoints.py
@@ -49,12 +49,22 @@ class PersonList(Resource):
session = Session()
+ # this indicates that the captured face should be use for identification / validation
if "useFace" in args and args["useFace"]:
-
- # replace by Biometric function
- data = list(session.query(Person).all())[1].serialize()
- return flask.make_response(flask.jsonify({'data': data}), 200)
-
+ if id is not None:
+ # validate
+ data = list(session.query(Person).filter_by(person_id=id))[0].serialize()
+ data["matching_score"] = 0.95
+ # return identified person object + matching score
+ return flask.make_response(flask.jsonify({'data': data}), 200)
+ else:
+ # replace by Biometric function
+ # identify
+ # return identified person object + matching score
+ data = list(session.query(Person).all())[1].serialize()
+ data["matching_score"] = 0.95
+ return flask.make_response(flask.jsonify({'data': data}), 200)
+
if id is None:
data = list(session.query(Person).all())
else:
diff --git a/application/static/main.js b/application/static/main.js
index 1835318..9bbc4a7 100644
--- a/application/static/main.js
+++ b/application/static/main.js
@@ -19,8 +19,6 @@ function focusPerson(id) {
renderPersonRight()
}
-
-
function loadPersonList(data) {
console.log(data)
data = data["data"]
@@ -38,6 +36,7 @@ function loadPersonList(data) {
Gender: ${item["gender"]}
YoB: ${item["yob"]}
Available FP: ${item["fingerprints"].length}
+
@@ -61,10 +60,12 @@ function renderPersonRight(data){
- Gender: ${data["gender"]}
- YoB: ${data["yob"]}
- Available FP: ${data["fingerprints"].length}
-
+ Gender: ${data["gender"]}
+ YoB: ${data["yob"]}
+ Available FP: ${data["fingerprints"].length}
+ Score: ${data["matching_score"]}
+
+
`
mr.innerHTML = string;
}
@@ -81,7 +82,7 @@ function identify(){
function validate(){
snapShot()
- getJSON(rootKontext + "/api/v1/person/?useFace=True&?validateId="+selected,
+ getJSON(rootKontext + "/api/v1/person/" + selected + "?useFace=True",
function (error, data) {
data = data["data"]
renderPersonRight(data)
@@ -89,33 +90,6 @@ function validate(){
);
}
-function renderValidate(){
- string = `
-
-
-
-
- `
- ml.innerHTML = string;
-}
-
-function renderChange(){
- console.log("change")
-}
-function renderEnrole(){
- console.log("enrole")
-}
-function renderIdentify(){
- string = `
-
-
-
-
- `
- ml.innerHTML = string;
-}
-
-
function loadStream() {
string = `
diff --git a/application/static/render.js b/application/static/render.js
index b842845..6f346fc 100644
--- a/application/static/render.js
+++ b/application/static/render.js
@@ -1,4 +1,10 @@
+function clearMiddle(){
+ ml.innerHTML = ""
+ mr.innerHTML = ""
+}
+
function renderValidate(){
+ clearMiddle()
string = `
@@ -9,12 +15,15 @@ function renderValidate(){
}
function renderChange(){
+ clearMiddle()
console.log("change")
}
function renderEnrole(){
+ clearMiddle()
console.log("enrole")
}
function renderIdentify(){
+ clearMiddle()
string = `
diff --git a/application/templates/index.html b/application/templates/index.html
index 43c5bfc..f447829 100644
--- a/application/templates/index.html
+++ b/application/templates/index.html
@@ -22,6 +22,7 @@
+