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
e906897e
Commit
e906897e
authored
Sep 21, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'testing' into romain-testing
(adds the new 'source' names that were formerly known as 'journal')
parents
6f3032d5
5e27f308
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
139 additions
and
67 deletions
+139
-67
CERN.py
gargantext/util/parsers/CERN.py
+1
-1
EUROPRESSE.py
gargantext/util/parsers/EUROPRESSE.py
+3
-3
ISI.py
gargantext/util/parsers/ISI.py
+1
-1
ISTEX.py
gargantext/util/parsers/ISTEX.py
+1
-1
PUBMED.py
gargantext/util/parsers/PUBMED.py
+1
-1
REPEC.py
gargantext/util/parsers/REPEC.py
+1
-1
RIS.py
gargantext/util/parsers/RIS.py
+2
-2
nodes.py
gargantext/views/api/nodes.py
+69
-9
urls.py
gargantext/views/api/urls.py
+1
-1
corpora.py
gargantext/views/pages/corpora.py
+9
-9
urls.py
gargantext/views/pages/urls.py
+3
-3
bridgeness.py
graph/bridgeness.py
+3
-0
graph.py
graph/graph.py
+2
-2
rest.py
graph/rest.py
+4
-1
views.py
graph/views.py
+9
-3
Docs_dyna_chart_and_table.js
static/lib/gargantext/Docs_dyna_chart_and_table.js
+9
-9
Sources_dyna_chart_and_table.js
static/lib/gargantext/Sources_dyna_chart_and_table.js
+4
-4
extras_explorerjs.js
static/lib/graphExplorer/extras_explorerjs.js
+6
-6
myGraphs.html
templates/pages/corpora/myGraphs.html
+1
-1
sources.html
templates/pages/corpora/sources.html
+4
-4
menu.html
templates/pages/menu.html
+5
-5
No files found.
gargantext/util/parsers/CERN.py
View file @
e906897e
...
...
@@ -24,7 +24,7 @@ class CernParser(Parser):
"773"
:{
"c"
:
"pages"
,
"n"
:
"issue"
,
"p"
:
"
journal
"
,
"p"
:
"
source
"
,
"v"
:
"volume"
,
"y"
:
"publication_year"
},
...
...
gargantext/util/parsers/EUROPRESSE.py
View file @
e906897e
...
...
@@ -159,11 +159,11 @@ class EuropresseParser(Parser):
try
:
pub_name
=
html_article
.
xpath
(
name_xpath
)[
0
]
.
text
name
=
pub_name
.
split
(
', '
)
hyperdata
[
'
journal
'
]
=
name
[
0
]
hyperdata
[
'number'
]
=
name
[
1
]
hyperdata
[
'
source
'
]
=
name
[
0
]
hyperdata
[
'number'
]
=
name
[
1
]
except
:
try
:
hyperdata
[
'
journal
'
]
=
pub_name
.
strip
()
hyperdata
[
'
source
'
]
=
pub_name
.
strip
()
except
:
pass
...
...
gargantext/util/parsers/ISI.py
View file @
e906897e
...
...
@@ -10,7 +10,7 @@ class ISIParser(RISParser):
"TI"
:
{
"type"
:
"hyperdata"
,
"key"
:
"title"
,
"separator"
:
" "
},
"AU"
:
{
"type"
:
"hyperdata"
,
"key"
:
"authors"
,
"separator"
:
", "
},
"DI"
:
{
"type"
:
"hyperdata"
,
"key"
:
"doi"
},
"SO"
:
{
"type"
:
"hyperdata"
,
"key"
:
"
journal
"
},
"SO"
:
{
"type"
:
"hyperdata"
,
"key"
:
"
source
"
},
"PY"
:
{
"type"
:
"hyperdata"
,
"key"
:
"publication_year"
},
"PD"
:
{
"type"
:
"hyperdata"
,
"key"
:
"publication_month"
},
"LA"
:
{
"type"
:
"hyperdata"
,
"key"
:
"language_fullname"
},
...
...
gargantext/util/parsers/ISTEX.py
View file @
e906897e
...
...
@@ -64,7 +64,7 @@ class ISTexParser(Parser):
hyperdata
[
"publication_date"
]
.
append
(
hyperdata
[
"host"
][
"pubdate"
]
)
if
"title"
in
hyperdata
[
"host"
]:
hyperdata
[
"
journal
"
]
=
hyperdata
[
"host"
][
"title"
]
hyperdata
[
"
source
"
]
=
hyperdata
[
"host"
][
"title"
]
authors
=
False
if
"authorsRAW"
in
hyperdata
:
...
...
gargantext/util/parsers/PUBMED.py
View file @
e906897e
...
...
@@ -7,7 +7,7 @@ from io import BytesIO
class
PubmedParser
(
Parser
):
hyperdata_path
=
{
"
journal"
:
'MedlineCitation/Article/Journal/Title'
,
"
source"
:
'MedlineCitation/Article/Journal/Title'
,
"title"
:
'MedlineCitation/Article/ArticleTitle'
,
"abstract"
:
'MedlineCitation/Article/Abstract/AbstractText'
,
"title2"
:
'MedlineCitation/Article/VernacularTitle'
,
...
...
gargantext/util/parsers/REPEC.py
View file @
e906897e
...
...
@@ -19,7 +19,7 @@ class RepecParser(Parser):
b
"T1"
:
{
"type"
:
"hyperdata"
,
"key"
:
"title"
,
"separator"
:
" "
},
b
"ST"
:
{
"type"
:
"hyperdata"
,
"key"
:
"subtitle"
,
"separator"
:
" "
},
b
"A1"
:
{
"type"
:
"hyperdata"
,
"key"
:
"authors"
,
"separator"
:
"
\n
"
},
b
"JO"
:
{
"type"
:
"hyperdata"
,
"key"
:
"
journal
"
},
b
"JO"
:
{
"type"
:
"hyperdata"
,
"key"
:
"
source
"
},
b
"UR"
:
{
"type"
:
"hyperdata"
,
"key"
:
"doi"
},
b
"Y1"
:
{
"type"
:
"hyperdata"
,
"key"
:
"publication_year"
},
b
"PD"
:
{
"type"
:
"hyperdata"
,
"key"
:
"publication_month"
},
...
...
gargantext/util/parsers/RIS.py
View file @
e906897e
...
...
@@ -15,8 +15,8 @@ class RISParser(Parser):
"ST"
:
{
"type"
:
"hyperdata"
,
"key"
:
"subtitle"
,
"separator"
:
" "
},
"AU"
:
{
"type"
:
"hyperdata"
,
"key"
:
"authors"
,
"separator"
:
"
\n
"
},
"JO"
:
{
"type"
:
"hyperdata"
,
"key"
:
"
journal
"
},
"T2"
:
{
"type"
:
"hyperdata"
,
"key"
:
"
journal
"
},
"JO"
:
{
"type"
:
"hyperdata"
,
"key"
:
"
source
"
},
"T2"
:
{
"type"
:
"hyperdata"
,
"key"
:
"
source
"
},
# "T2": variant of JO (if together only last will be kept)
"UR"
:
{
"type"
:
"hyperdata"
,
"key"
:
"doi"
},
...
...
gargantext/views/api/nodes.py
View file @
e906897e
...
...
@@ -143,6 +143,11 @@ class Status(APIView):
'''API endpoint that represent the current status of the node'''
renderer_classes
=
(
JSONRenderer
,
BrowsableAPIRenderer
)
def
get
(
self
,
request
,
node_id
):
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
user
=
cache
.
User
[
request
.
user
.
id
]
check_rights
(
request
,
node_id
)
node
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
node_id
,
Node
.
user_id
==
user
.
id
)
.
first
()
...
...
@@ -157,9 +162,19 @@ class Status(APIView):
return
Response
(
context
)
def
post
(
self
,
request
,
data
):
'''create a new status for node'''
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
raise
NotImplementedError
def
put
(
self
,
request
,
data
):
'''update status for node'''
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
user
=
cache
.
User
[
request
.
user
.
id
]
check_rights
(
request
,
node_id
)
node
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
node_id
)
.
first
()
...
...
@@ -170,6 +185,11 @@ class Status(APIView):
def
delete
(
self
,
request
):
'''delete status for node'''
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
user
=
cache
.
User
[
request
.
user
.
id
]
check_rights
(
request
,
node_id
)
node
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
node_id
)
.
first
()
...
...
@@ -187,6 +207,11 @@ class NodeListResource(APIView):
def
get
(
self
,
request
):
"""Displays the list of nodes corresponding to the query.
"""
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
parameters
,
query
,
count
=
_query_nodes
(
request
)
if
parameters
[
'formated'
]
==
'json'
:
...
...
@@ -211,7 +236,7 @@ class NodeListResource(APIView):
writer
=
csv
.
writer
(
response
,
delimiter
=
'
\t
'
,
quoting
=
csv
.
QUOTE_MINIMAL
)
keys
=
[
'title'
,
'
journal
'
keys
=
[
'title'
,
'
source
'
,
'publication_year'
,
'publication_month'
,
'publication_day'
,
'abstract'
,
'authors'
]
...
...
@@ -236,10 +261,15 @@ class NodeListResource(APIView):
"""
def
delete
(
self
,
request
):
"""Removes the list of nodes corresponding to the query.
TODO : Should be a delete method!
"""
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
parameters
=
get_parameters
(
request
)
parameters
=
validate
(
parameters
,
{
'ids'
:
list
}
)
try
:
...
...
@@ -267,6 +297,11 @@ class NodeListHaving(APIView):
2016-09: add total counts to output json
'''
def
get
(
self
,
request
,
corpus_id
):
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
parameters
=
get_parameters
(
request
)
parameters
=
validate
(
parameters
,
{
'score'
:
str
,
'ngram_ids'
:
list
}
)
...
...
@@ -316,7 +351,7 @@ class NodeListHaving(APIView):
'id'
:
node
.
id
,
'score'
:
score
,
}
for
key
in
(
'title'
,
'publication_date'
,
'
journal
'
,
'authors'
,
'fields'
):
for
key
in
(
'title'
,
'publication_date'
,
'
source
'
,
'authors'
,
'fields'
):
if
key
in
node
.
hyperdata
:
node_dict
[
key
]
=
node
.
hyperdata
[
key
]
nodes_list
.
append
(
node_dict
)
...
...
@@ -332,6 +367,11 @@ class NodeResource(APIView):
# contains a check on user.id (within _query_nodes)
def
get
(
self
,
request
,
node_id
):
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
parameters
,
query
,
count
=
_query_nodes
(
request
,
node_id
)
if
not
len
(
query
):
raise
Http404
()
...
...
@@ -341,6 +381,11 @@ class NodeResource(APIView):
# contains a check on user.id (within _query_nodes)
def
delete
(
self
,
request
,
node_id
):
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
parameters
,
query
,
count
=
_query_nodes
(
request
,
node_id
)
if
not
len
(
query
):
raise
Http404
()
...
...
@@ -363,6 +408,11 @@ class NodeResource(APIView):
TODO 1 factorize with .projects.ProjectView.put and .post (thx c24b)
TODO 2 allow other changes than name
"""
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
# contains a check on user.id (within _query_nodes)
parameters
,
query
,
count
=
_query_nodes
(
request
,
node_id
)
...
...
@@ -435,6 +485,11 @@ class CorpusFavorites(APIView):
(will test if docs 53 and 54 are among the favorites of corpus 2)
(returns the intersection of fav docs with [53,54])
"""
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
fav_node
=
self
.
_get_fav_node
(
corpus_id
)
req_params
=
validate
(
...
...
@@ -573,12 +628,12 @@ class CorpusFavorites(APIView):
class
CorpusFacet
(
APIView
):
"""Loop through a corpus node's docs => do counts by a hyperdata field
(url: /api/nodes/<node_id>/facets?hyperfield=<
journal
>)
(url: /api/nodes/<node_id>/facets?hyperfield=<
source
>)
"""
# - old url: '^project/(\d+)/corpus/(\d+)/
journals/journal
s.json$',
# - old view: tests.ngramstable.views.get_
journal
s_json()
# - old url: '^project/(\d+)/corpus/(\d+)/
source/source
s.json$',
# - old view: tests.ngramstable.views.get_
sources
s_json()
# - now generalized for various hyperdata field:
# ->
journal
# ->
source
# -> publication_year
# -> rubrique
# -> language...
...
...
@@ -586,6 +641,11 @@ class CorpusFacet(APIView):
def
get
(
self
,
request
,
node_id
):
# check that the node is a corpus
# ? faster from cache than: corpus = session.query(Node)...
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
corpus
=
cache
.
Node
[
node_id
]
if
corpus
.
typename
!=
'CORPUS'
:
raise
ValidationException
(
...
...
@@ -597,7 +657,7 @@ class CorpusFacet(APIView):
# check that the hyperfield parameter makes sense
_facet_available_subfields
=
[
'
journal
'
,
'publication_year'
,
'rubrique'
,
'
source
'
,
'publication_year'
,
'rubrique'
,
'language_iso2'
,
'language_iso3'
,
'language_name'
,
'authors'
]
...
...
@@ -619,8 +679,8 @@ class CorpusFacet(APIView):
'by'
:
{
subfield
:
xcounts
}
})
def
_ndocs_by_facet
(
self
,
subfield
=
'
journal
'
):
"""for example on '
journal
'
def
_ndocs_by_facet
(
self
,
subfield
=
'
source
'
):
"""for example on '
source
'
xcounts = {'j good sci' : 25, 'nature' : 32, 'j bla bla' : 1... }"""
xcounts
=
defaultdict
(
int
)
...
...
gargantext/views/api/urls.py
View file @
e906897e
...
...
@@ -20,7 +20,7 @@ urlpatterns = [ url(r'^nodes$' , nodes.NodeListResource.as_view()
#?view=docs
#Corpora
,
url
(
r'^projects/(\d+)/corpora/(\d+)$'
,
corpora
.
CorpusView
.
as_view
()
)
#?view=
journal
#?view=
source
#?view=title
#?view=analytics
#Sources
...
...
gargantext/views/pages/corpora.py
View file @
e906897e
...
...
@@ -46,11 +46,11 @@ def docs_by_titles(request, project_id, corpus_id):
)
@
requires_auth
def
docs_by_
journal
s
(
request
,
project_id
,
corpus_id
):
def
docs_by_
source
s
(
request
,
project_id
,
corpus_id
):
'''
Browse
journal
titles for a given corpus
NB: javascript in page will GET counts from our api: facets?subfield=
journal
# TODO refactor
Journal
s_dyna_charts_and_table.js
Browse
source
titles for a given corpus
NB: javascript in page will GET counts from our api: facets?subfield=
source
# TODO refactor
Source
s_dyna_charts_and_table.js
'''
# we pass our corpus to mark it's a corpora page
corpus
=
cache
.
Node
[
corpus_id
]
...
...
@@ -60,9 +60,9 @@ def docs_by_journals(request, project_id, corpus_id):
source_type
=
corpus
.
resources
()[
0
][
'type'
]
# rendered page :
journal
s.html
# rendered page :
source
s.html
return
render
(
template_name
=
'pages/corpora/
journal
s.html'
,
template_name
=
'pages/corpora/
source
s.html'
,
request
=
request
,
context
=
{
'debug'
:
settings
.
DEBUG
,
...
...
@@ -70,7 +70,7 @@ def docs_by_journals(request, project_id, corpus_id):
'project'
:
project
,
'corpus'
:
corpus
,
'resourcename'
:
get_resource
(
source_type
)[
'name'
],
'view'
:
'
journal
s'
'view'
:
'
source
s'
},
)
...
...
@@ -79,7 +79,7 @@ def docs_by_authors(request, project_id, corpus_id):
'''
Browse authors for a given corpus
NB: javascript in page will GET counts from our api: facets?subfield=author
# TODO refactor Author &&
Journal
s_dyna_charts_and_table.js
# TODO refactor Author &&
Source
s_dyna_charts_and_table.js
'''
# we pass our corpus to mark it's a corpora page
corpus
=
cache
.
Node
[
corpus_id
]
...
...
@@ -89,7 +89,7 @@ def docs_by_authors(request, project_id, corpus_id):
source_type
=
corpus
.
resources
()[
0
][
'type'
]
# rendered page :
journal
s.html
# rendered page :
source
s.html
return
render
(
template_name
=
'pages/corpora/authors.html'
,
request
=
request
,
...
...
gargantext/views/pages/urls.py
View file @
e906897e
...
...
@@ -24,10 +24,10 @@ urlpatterns = [
# corpora
url
(
r'^projects/(\d+)/corpora/(\d+)/?$'
,
corpora
.
docs_by_titles
),
# corpus by
journal
s
url
(
r'^projects/(\d+)/corpora/(\d+)/
journals/?$'
,
corpora
.
docs_by_journal
s
),
# corpus by
source
s
url
(
r'^projects/(\d+)/corpora/(\d+)/
sources/?$'
,
corpora
.
docs_by_source
s
),
# corpus by
journal
s
# corpus by
author
s
url
(
r'^projects/(\d+)/corpora/(\d+)/authors/?$'
,
corpora
.
docs_by_authors
),
# terms table for the corpus
...
...
graph/bridgeness.py
View file @
e906897e
...
...
@@ -7,6 +7,9 @@ from collections import defaultdict
from
networkx.readwrite
import
json_graph
def
filterByBridgeness
(
G
,
partition
,
ids
,
weight
,
bridgeness
,
type
,
field1
,
field2
):
'''
What is bridgeness ?
'''
# Data are stored in a dict(), (== hashmap by default for Python)
data
=
dict
()
if
type
==
"node_link"
:
...
...
graph/graph.py
View file @
e906897e
...
...
@@ -71,8 +71,8 @@ def get_graph( request=None , corpus=None
return
{
'state'
:
"mapListError"
,
"length"
:
mapList_size
}
# case of corpus not big enough
# ==============================
#
Instantiate query for
case of corpus not big enough
# ==============================
=====================
corpus_size_query
=
(
session
.
query
(
Node
)
.
filter
(
Node
.
typename
==
"DOCUMENT"
)
.
filter
(
Node
.
parent_id
==
corpus
.
id
)
...
...
graph/rest.py
View file @
e906897e
...
...
@@ -56,7 +56,6 @@ def format_html(link):
# TODO check authentication
class
Graph
(
APIView
):
'''
REST part for graphs.
...
...
@@ -69,6 +68,10 @@ class Graph(APIView):
graph?field1=ngrams&field2=ngrams&start=''&end=''
'''
if
not
request
.
user
.
is_authenticated
():
# can't use @requires_auth because of positional 'self' within class
return
HttpResponse
(
'Unauthorized'
,
status
=
401
)
# Get the node we are working with
corpus
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
corpus_id
)
.
first
()
...
...
graph/views.py
View file @
e906897e
...
...
@@ -61,14 +61,20 @@ def myGraphs(request, project_id, corpus_id):
coocs_count
=
dict
()
for
cooc
in
coocs
:
# FIXME : approximativ number of nodes (not exactly what user sees in explorer)
cooc_nodes
=
(
session
.
query
(
Ngram
.
id
)
# Need to be connected with Graph Clustering
cooc_nodes
=
(
session
.
query
(
Ngram
.
id
,
func
.
count
(
Ngram
.
id
))
.
join
(
NodeNgramNgram
,
NodeNgramNgram
.
ngram1_id
==
Ngram
.
id
)
.
filter
(
NodeNgramNgram
.
node_id
==
cooc
.
id
)
.
filter
(
NodeNgramNgram
.
weight
>
0
)
.
filter
(
NodeNgramNgram
.
weight
>=
1
)
.
group_by
(
Ngram
.
id
)
.
all
()
)
coocs_count
[
cooc
.
id
]
=
len
(
set
(
cooc_nodes
))
#for n in cooc_nodes:
# print(n)
#coocs_count[cooc.id] = len(cooc_nodes)
coocs_count
[
cooc
.
id
]
=
len
([
cooc_node
for
cooc_node
in
cooc_nodes
if
cooc_node
[
1
]
>
1
])
return
render
(
template_name
=
'pages/corpora/myGraphs.html'
,
...
...
static/lib/gargantext/Docs_dyna_chart_and_table.js
View file @
e906897e
...
...
@@ -143,7 +143,7 @@ var RecDict={};
var
AjaxRecords
=
[]
var
Garbage
=
{}
var
countByTitles
=
{}
// useful for title duplicates
var
countByMeta
=
{}
// for title + date +
journal
duplicates
var
countByMeta
=
{}
// for title + date +
source
duplicates
var
favorites
=
{}
function
getRecord
(
rec_id
)
{
...
...
@@ -197,7 +197,7 @@ function transformContent2(rec_id, trClass) {
if
(
elem
[
"del"
])
{
result
[
"id"
]
=
elem
[
"id"
]
result
[
"short_date"
]
=
'<strike>'
+
elem
[
"short_date"
]
+
'</strike>'
result
[
"hyperdata.
journal"
]
=
'<strike><small><i>'
+
elem
[
"hyperdata"
][
"journal
"
]
+
'</small></i></strike>'
result
[
"hyperdata.
source"
]
=
'<strike><small><i>'
+
elem
[
"hyperdata"
][
"source
"
]
+
'</small></i></strike>'
result
[
"docurl"
]
=
'<strike>'
+
elem
[
"docurl"
]
+
'</strike>'
result
[
"isFavorite"
]
=
favstatusToStar
(
rec_id
,
elem
[
"isFavorite"
],
boolStrike
=
true
)
result
[
"rawtitle"
]
=
elem
[
"rawtitle"
]
...
...
@@ -211,7 +211,7 @@ function transformContent2(rec_id, trClass) {
}
else
{
result
[
"id"
]
=
elem
[
"id"
]
result
[
"short_date"
]
=
elem
[
"short_date"
]
result
[
"hyperdata.
journal"
]
=
'<small><i>'
+
elem
[
"hyperdata"
][
"journal
"
]
+
'</i></small>'
result
[
"hyperdata.
source"
]
=
'<small><i>'
+
elem
[
"hyperdata"
][
"source
"
]
+
'</i></small>'
result
[
"docurl"
]
=
elem
[
"docurl"
]
result
[
"isFavorite"
]
=
favstatusToStar
(
rec_id
,
elem
[
"isFavorite"
])
result
[
"rawtitle"
]
=
elem
[
"rawtitle"
]
...
...
@@ -350,7 +350,7 @@ function metaSignature(docRecord) {
var
keyStr
=
""
keyStr
=
(
docRecord
.
rawtitle
+
"--"
+
docRecord
.
hyperdata
.
journal
docRecord
.
hyperdata
.
source
+
"--"
+
docRecord
.
hyperdata
.
publication_date
)
...
...
@@ -376,7 +376,7 @@ function Main_test(Data) {
div_table
+=
"
\
t"
+
"
\
t"
+
'<span class="glyphicon glyphicon-calendar"></span> Date</th>'
+
"
\n
"
div_table
+=
"
\
t"
+
"
\
t"
+
'<th data-dynatable-column="docurl">'
+
"
\n
"
div_table
+=
"
\
t"
+
"
\
t"
+
'<span class="glyphicon glyphicon-text-size"></span> Title</th>'
+
"
\n
"
div_table
+=
"
\
t"
+
"
\
t"
+
'<th width="100px;" data-dynatable-column="hyperdata.
journal
">'
+
"
\n
"
div_table
+=
"
\
t"
+
"
\
t"
+
'<th width="100px;" data-dynatable-column="hyperdata.
source
">'
+
"
\n
"
div_table
+=
"
\
t"
+
"
\
t"
+
'<span class="glyphicon glyphicon-book"></span> Source</th>'
+
"
\n
"
div_table
+=
"
\
t"
+
"
\
t"
+
'<th data-dynatable-column="isFavorite">'
+
"
\n
"
div_table
+=
"
\
t"
+
"
\
t"
+
'<span class="glyphicon glyphicon-star"></span>'
+
"
\n
"
...
...
@@ -553,7 +553,7 @@ function Main_test(Data) {
sortTypes
:
{
signature
:
'signatureSort'
,
docurl
:
'rawtitleSort'
,
'hyperdata.
journal'
:
'journal
Sort'
'hyperdata.
source'
:
'source
Sort'
}
},
features
:
{
...
...
@@ -628,10 +628,10 @@ function Main_test(Data) {
MyTable
.
data
(
'dynatable'
).
sorts
.
functions
[
"rawtitleSort"
]
=
makeAlphaSortFunctionOnProperty
(
'rawtitle'
)
MyTable
.
data
(
'dynatable'
).
sorts
.
functions
[
"signatureSort"
]
=
makeAlphaSortFunctionOnProperty
(
'signature'
)
MyTable
.
data
(
'dynatable'
).
sorts
.
functions
[
"
journalSort"
]
=
function
journal
Sort
(
rec1
,
rec2
,
attr
,
direction
)
{
MyTable
.
data
(
'dynatable'
).
sorts
.
functions
[
"
sourceSort"
]
=
function
source
Sort
(
rec1
,
rec2
,
attr
,
direction
)
{
// like rawtitle but nested property
if
(
direction
==
1
)
return
rec1
.
hyperdata
.
journal
.
localeCompare
(
rec2
.
hyperdata
.
journal
)
else
return
rec2
.
hyperdata
.
journal
.
localeCompare
(
rec1
.
hyperdata
.
journal
)
if
(
direction
==
1
)
return
rec1
.
hyperdata
.
source
.
localeCompare
(
rec2
.
hyperdata
.
source
)
else
return
rec2
.
hyperdata
.
source
.
localeCompare
(
rec1
.
hyperdata
.
source
)
}
// hook on page change
...
...
static/lib/gargantext/
Journal
s_dyna_chart_and_table.js
→
static/lib/gargantext/
Source
s_dyna_chart_and_table.js
View file @
e906897e
...
...
@@ -397,7 +397,7 @@ function Main_test( data , initial) {
.
title
(
function
(
d
)
{
var
value
=
d
.
data
.
value
.
avg
?
d
.
data
.
value
.
avg
:
d
.
data
.
value
;
if
(
isNaN
(
value
))
value
=
0
;
return
value
+
"
journal
s with "
+
Number
(
d
.
key
)
+
" publications"
;
return
value
+
"
source
s with "
+
Number
(
d
.
key
)
+
" publications"
;
})
.
xAxis
();
LineChart
.
yAxis
().
ticks
(
5
)
...
...
@@ -493,21 +493,21 @@ console.log(window.location.href)
// match corpus_id in the url
var
corpus_id
;
rematch
=
window
.
location
.
href
.
match
(
/corpora
\/(\d
+
)\/
journal
s
\/?
$/
)
rematch
=
window
.
location
.
href
.
match
(
/corpora
\/(\d
+
)\/
source
s
\/?
$/
)
if
(
rematch
)
{
corpus_id
=
rematch
[
1
]
;
$
.
ajax
({
url
:
window
.
location
.
origin
+
"/api/nodes/"
+
corpus_id
+
"/facets?hyperfield=
journal
"
,
+
"/facets?hyperfield=
source
"
,
success
:
function
(
data
){
console
.
log
(
data
)
$
(
"#content_loader"
).
remove
()
// // Initializing the Charts and Table
var
result
=
Main_test
(
data
.
by
.
journal
,
"FirstScore"
)
var
result
=
Main_test
(
data
.
by
.
source
,
"FirstScore"
)
console
.
log
(
result
)
$
(
"#content_loader"
).
remove
()
...
...
static/lib/graphExplorer/extras_explorerjs.js
View file @
e906897e
...
...
@@ -524,9 +524,9 @@ function genericGetTopPapers(theids , corpus_id , thediv) {
var
gquery
=
"https://search.iscpif.fr/?categories=general&q="
+
pub
[
"title"
].
replace
(
" "
+
"+"
)
var
getpubAPI
=
window
.
location
.
origin
+
"/nodeinfo/"
+
pub
[
"id"
]
var
if
journal
=
""
,
ifauthors
=
""
,
ifkeywords
=
""
,
ifdate
=
""
,
iftitle
=
""
;
var
if
source
=
""
,
ifauthors
=
""
,
ifkeywords
=
""
,
ifdate
=
""
,
iftitle
=
""
;
if
(
pub
[
"
journal"
])
ifjournal
=
"<br>Published in <a>"
+
pub
[
"journal
"
]
+
"</a>"
;
if
(
pub
[
"
source"
])
ifsource
=
"<br>Published in <a>"
+
pub
[
"source
"
]
+
"</a>"
;
if
(
pub
[
"authors"
])
{
ifauthors
=
"By "
+
pub
[
"authors"
]
+
""
;
if
(
pub
[
"authors"
]
==
"not found"
)
{
...
...
@@ -542,7 +542,7 @@ function genericGetTopPapers(theids , corpus_id , thediv) {
var
jsparams
=
'height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no'
jsstuff
+=
"wnws_buffer = window.open('"
+
getpubAPI
+
"', 'popUpWindow' , '"
+
jsparams
+
"')"
;
output
+=
"<li><a onclick=
\"
"
+
jsstuff
+
"
\"
target=_blank>"
+
pub
[
"title"
]
+
"</a>. "
+
ifauthors
+
". "
+
if
journal
+
". "
+
ifkeywords
+
". "
+
ifdate
+
"
\n
"
;
output
+=
"<li><a onclick=
\"
"
+
jsstuff
+
"
\"
target=_blank>"
+
pub
[
"title"
]
+
"</a>. "
+
ifauthors
+
". "
+
if
source
+
". "
+
ifkeywords
+
". "
+
ifdate
+
"
\n
"
;
output
+=
'<a href="'
+
gquery
+
'" target=_blank><img title="Query the anonymous web" src="'
+
window
.
location
.
origin
+
'/static/img/searx.png"></img></a>'
output
+=
"</li>
\n
"
;
// for(var j in pub) {
...
...
@@ -624,9 +624,9 @@ function getTopPapers(type){
// link to matching document (with focus=selections_ids param)
var
getpubAPI
=
window
.
location
.
origin
+
'/projects/'
+
url_mainIDs
[
"projects"
]
+
'/corpora/'
+
url_mainIDs
[
"corpora"
]
+
'/documents/'
+
pub
[
"id"
]
+
'/focus='
+
theids
.
join
(
","
)
var
if
journal
=
""
,
ifauthors
=
""
,
ifkeywords
=
""
,
ifdate
=
""
,
iftitle
=
""
;
var
if
source
=
""
,
ifauthors
=
""
,
ifkeywords
=
""
,
ifdate
=
""
,
iftitle
=
""
;
if
(
pub
[
"
journal"
])
ifjournal
=
"<br>Published in <a>"
+
pub
[
"journal
"
]
+
"</a>"
;
if
(
pub
[
"
source"
])
ifsource
=
"<br>Published in <a>"
+
pub
[
"source
"
]
+
"</a>"
;
if
(
pub
[
"authors"
])
{
ifauthors
=
"By "
+
pub
[
"authors"
]
+
""
;
if
(
pub
[
"authors"
]
==
"not found"
)
{
...
...
@@ -642,7 +642,7 @@ function getTopPapers(type){
var
jsparams
=
'height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no'
jsstuff
+=
"wnws_buffer = window.open('"
+
getpubAPI
+
"', 'popUpWindow' , '"
+
jsparams
+
"')"
;
output
+=
"<li><a onclick=
\"
"
+
jsstuff
+
"
\"
target=_blank>"
+
pub
[
"title"
]
+
"</a>. "
+
ifauthors
+
". "
+
if
journal
+
". "
+
ifkeywords
+
". "
+
ifdate
+
"
\n
"
;
output
+=
"<li><a onclick=
\"
"
+
jsstuff
+
"
\"
target=_blank>"
+
pub
[
"title"
]
+
"</a>. "
+
ifauthors
+
". "
+
if
source
+
". "
+
ifkeywords
+
". "
+
ifdate
+
"
\n
"
;
output
+=
'<a href="'
+
gquery
+
'" target=_blank><img title="Query the web" src="'
+
window
.
location
.
origin
+
'/static/img/searx.png"></img></a>'
output
+=
"</li>
\n
"
;
// for(var j in pub) {
...
...
templates/pages/corpora/myGraphs.html
View file @
e906897e
...
...
@@ -37,7 +37,7 @@
<li>
From: {% if not cooc.hyperdata.start %} begin of corpus {% else %} {{cooc.hyperdata.start}} {% endif %}
, To: {% if not cooc.hyperdata.end %} end of corpus {% else %} {{cooc.hyperdata.end}} {% endif %}
</li>
<li>
{{ value }} nodes with distances:
<li>
~
{{ value }} nodes with distances:
<ul>
<li>
<a
href=
"/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=distributional&bridgeness=5"
>
...
...
templates/pages/corpora/
journal
s.html
→
templates/pages/corpora/
source
s.html
View file @
e906897e
...
...
@@ -28,8 +28,8 @@
<!--<a class="btn btn-xs btn-default" role="button" href="/chart/corpus/{{ corpus.id }}/data.csv">Save</a>-->
<a
class=
"btn btn-xs btn-default"
href=
"javascript:volumeChart.filterAll();dc.redrawAll();"
>
Reset
</a></p>
<!-- <p style="font-size:70%">
<b>x</b>: amount of documents for the
journal
<b>y</b>: number of
journal
s with that amount
<b>x</b>: amount of documents for the
source
<b>y</b>: number of
source
s with that amount
</p> -->
<div
class=
"clearfix"
></div>
</center>
...
...
@@ -70,7 +70,7 @@
<div
class=
"panel-body"
>
<div
id=
"div-table"
>
<!-- (table id="my-ajax-table") dynamically set by
Journal
s_dyna_chart_and_table -->
<!-- (table id="my-ajax-table") dynamically set by
Source
s_dyna_chart_and_table -->
</div>
</div>
...
...
@@ -86,6 +86,6 @@
<script
type=
"text/javascript"
src=
"{% static "
lib
/
jquery
/
dynatable
/
jquery
.
dynatable
.
js
"
%}"
></script>
<!-- custom-lib for dynatable.js and dc.js -->
<script
type=
"text/javascript"
src=
"{% static "
lib
/
gargantext
/
Journal
s_dyna_chart_and_table
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
lib
/
gargantext
/
Source
s_dyna_chart_and_table
.
js
"
%}"
></script>
{% endblock %}
templates/pages/menu.html
View file @
e906897e
...
...
@@ -117,11 +117,11 @@
</li>
<li>
<a
type=
"button"
class=
"btn btn-default {% if view == '
journal
s' %} active {% endif %}"
onclick=
"javascript:location.href='/projects/{{project.id}}/corpora/{{ corpus.id }}/
journal
s'"
<a
type=
"button"
class=
"btn btn-default {% if view == '
source
s' %} active {% endif %}"
onclick=
"javascript:location.href='/projects/{{project.id}}/corpora/{{ corpus.id }}/
source
s'"
data-target=
'#'
href=
'#'
>
<span
class=
"glyphicon glyphicon-globe"
aria-hidden=
"true"
></span>
Journal
s
Source
s
</a>
</li>
...
...
@@ -245,7 +245,7 @@
{% else %}
<!-- TODO export
journal
table -->
<!-- TODO export
source
table -->
{% endif %}
</div>
</div>
...
...
@@ -294,7 +294,7 @@
<p>
Gargantext
<span
class=
"glyphicon glyphicon-registration-mark"
aria-hidden=
"true"
></span>
, version 3.0.5.
3
,
, version 3.0.5.
4
,
<a
href=
"http://www.cnrs.fr"
target=
"blank"
title=
"Institution that enables this project."
>
Copyrights
<span
class=
"glyphicon glyphicon-copyright-mark"
aria-hidden=
"true"
></span>
...
...
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