This repository has been archived by the owner on Mar 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
person.py
68 lines (60 loc) · 1.92 KB
/
person.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from datetime import datetime
from flask import make_response, abort
def get_timestamp():
return datetime.now().strftime(("%Y-%m-%d %H:%M:%S"))
DOCUMENTS_SOFTWARE = {
"Q93068": {
"id": "Q93068",
"software": [
{
"id": "E280",
"documents": [
{
"document": { "doi": "https://doi.org/10.1093/pcp/pcg126",
"url": "",
"sha1": ""}
},
{
"document": { "doi": "https://doi.org/10.1038/s41699-018-0076-0",
"url": "",
"sha1": ""}
}
]
},
{
"id": "Q8029",
"documents": [
{
"document": { "doi": "https://doi.org/10.1038/s41699-018-0076-0",
"url": "",
"sha1": ""}
}
]
}
]
}
}
def disambiguate(json_person_name):
response = {
"id": "Q93068",
"conf": 0.96
}
response["date"] = get_timestamp()
return response
def software(id):
"""
This function responds to a request for /api/person/{id}/software
with one matching id from all persons
:param id: identifier of the person to find
:return: lists the software entities having the person as author or co-author,
and for each software the citing documents supporting the authorship
"""
if id in SOFTWARE:
soft = SOFTWARE.get(id)
soft["date"] = get_timestamp()
# otherwise nope
else:
abort(
404, "Document with identifier {id} not found".format(id=id)
)
return soft