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
9f252d49
Commit
9f252d49
authored
Sep 21, 2016
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RENAME] journal -> source in hyperdata.
parent
12a3283b
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
49 deletions
+49
-49
nodes.py
gargantext/views/api/nodes.py
+9
-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
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
sources.html
templates/pages/corpora/sources.html
+4
-4
menu.html
templates/pages/menu.html
+4
-4
No files found.
gargantext/views/api/nodes.py
View file @
9f252d49
...
...
@@ -165,7 +165,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'
]
...
...
@@ -280,7 +280,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
)
...
...
@@ -558,12 +558,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...
...
...
@@ -587,7 +587,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'
]
...
...
@@ -609,8 +609,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 @
9f252d49
...
...
@@ -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 @
9f252d49
...
...
@@ -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 @
9f252d49
...
...
@@ -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
...
...
static/lib/gargantext/Docs_dyna_chart_and_table.js
View file @
9f252d49
...
...
@@ -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 @
9f252d49
...
...
@@ -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
)
...
...
@@ -494,21 +494,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 @
9f252d49
...
...
@@ -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/
journal
s.html
→
templates/pages/corpora/
source
s.html
View file @
9f252d49
...
...
@@ -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 @
9f252d49
...
...
@@ -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>
...
...
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