Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
f5443d84
Commit
f5443d84
authored
Dec 05, 2014
by
Mathieu Rodic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEATURE] Added 'authors' metadata support
[ANOMALY] Fixed buggy behaviour of query type 'fields'
parent
8735df68
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
12 deletions
+15
-12
MatInit.py
MatInit.py
+0
-4
api.py
gargantext_web/api.py
+5
-5
PubmedFileParser.py
parsing/FileParsers/PubmedFileParser.py
+10
-3
No files found.
MatInit.py
View file @
f5443d84
...
@@ -10,10 +10,6 @@ os.environ.setdefault("DJANGO_HSTORE_GLOBAL_REGISTER", "False")
...
@@ -10,10 +10,6 @@ os.environ.setdefault("DJANGO_HSTORE_GLOBAL_REGISTER", "False")
from
node.models
import
*
from
node.models
import
*
# Node.objects.get(id=26514).children.all().make_metadata_filterable()
# exit()
# Reset: all data
# Reset: all data
tables_to_empty
=
[
tables_to_empty
=
[
...
...
gargantext_web/api.py
View file @
f5443d84
...
@@ -428,11 +428,11 @@ class NodesChildrenQueries(APIView):
...
@@ -428,11 +428,11 @@ class NodesChildrenQueries(APIView):
# TODO: date_trunc (psql) -> index also
# TODO: date_trunc (psql) -> index also
# groupping
# groupping
authorized_aggregates
=
{
'count'
:
func
.
count
(
Node
.
id
)}
if
retrieve
[
'type'
]
==
'aggregates'
:
for
field_name
in
fields_names
:
authorized_aggregates
=
{
'count'
:
func
.
count
(
Node
.
id
)}
if
field_name
not
in
authorized_aggregat
es
:
for
field_name
in
fields_nam
es
:
# query = query.group_by(text(field_name))
if
field_name
not
in
authorized_aggregates
:
query
=
query
.
group_by
(
'"
%
s"'
%
(
field_name
,
))
query
=
query
.
group_by
(
'"
%
s"'
%
(
field_name
,
))
# sorting
# sorting
sort_fields_names
=
request
.
DATA
.
get
(
'sort'
,
[
'id'
])
sort_fields_names
=
request
.
DATA
.
get
(
'sort'
,
[
'id'
])
...
...
parsing/FileParsers/PubmedFileParser.py
View file @
f5443d84
...
@@ -25,13 +25,20 @@ class PubmedFileParser(FileParser):
...
@@ -25,13 +25,20 @@ class PubmedFileParser(FileParser):
"publication_year"
:
'MedlineCitation/DateCreated/Year'
,
"publication_year"
:
'MedlineCitation/DateCreated/Year'
,
"publication_month"
:
'MedlineCitation/DateCreated/Month'
,
"publication_month"
:
'MedlineCitation/DateCreated/Month'
,
"publication_day"
:
'MedlineCitation/DateCreated/Day'
,
"publication_day"
:
'MedlineCitation/DateCreated/Day'
,
"authors"
:
'MedlineCitation/Article/AuthorList'
,
}
}
for
key
,
path
in
metadata_path
.
items
():
for
key
,
path
in
metadata_path
.
items
():
try
:
try
:
node
=
xml_article
.
find
(
path
)
xml_node
=
xml_article
.
find
(
path
)
metadata
[
key
]
=
node
.
text
if
key
==
'authors'
:
metadata
[
key
]
=
', '
.
join
([
xml_author
.
find
(
'ForeName'
)
.
text
+
' '
+
xml_author
.
find
(
'LastName'
)
.
text
for
xml_author
in
xml_node
])
else
:
metadata
[
key
]
=
xml_node
.
text
except
:
except
:
metadata
[
key
]
=
""
pass
metadata_list
.
append
(
metadata
)
metadata_list
.
append
(
metadata
)
# return the list of metadata
# return the list of metadata
return
metadata_list
return
metadata_list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment