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
16224708
Commit
16224708
authored
Jun 16, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] View Corpus/Journals, optimization
parent
d7e66d40
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
12 deletions
+16
-12
corpus_views.py
gargantext_web/corpus_views.py
+14
-10
menu.html
templates/corpus/menu.html
+1
-1
project.html
templates/project.html
+1
-1
No files found.
gargantext_web/corpus_views.py
View file @
16224708
...
...
@@ -43,7 +43,9 @@ from scrappers.scrap_pubmed.admin import Logger
from
gargantext_web.db
import
*
from
sqlalchemy
import
or_
,
func
from
sqlalchemy.sql
import
func
from
sqlalchemy
import
desc
,
asc
,
or_
,
and_
,
Date
,
cast
,
select
from
gargantext_web
import
about
...
...
@@ -205,16 +207,18 @@ def test_journals(request , project_id, corpus_id ):
JournalsDict
=
{}
user_id
=
request
.
user
.
id
document_type_id
=
cache
.
NodeType
[
'Document'
]
.
id
documents
=
session
.
query
(
Node
)
.
filter
(
Node
.
user_id
==
user_id
,
Node
.
parent_id
==
corpus_id
,
Node
.
type_id
==
document_type_id
)
.
all
()
for
doc
in
documents
:
if
"journal"
in
doc
.
hyperdata
:
journal
=
doc
.
hyperdata
[
"journal"
]
if
journal
not
in
JournalsDict
:
JournalsDict
[
journal
]
=
0
JournalsDict
[
journal
]
+=
1
return
JsonHttpResponse
(
JournalsDict
)
journal_count
=
(
session
.
query
(
Node
.
hyperdata
[
'journal'
]
.
label
(
"journal"
),
func
.
count
()
.
label
(
"count"
))
.
filter
(
Node
.
parent_id
==
corpus_id
,
Node
.
type_id
==
cache
.
NodeType
[
'Document'
]
.
id
)
.
group_by
(
"journal"
)
.
order_by
(
desc
(
"count"
))
.
all
())
jc
=
dict
()
for
journal
,
count
in
journal_count
:
jc
[
journal
]
=
count
return
JsonHttpResponse
(
jc
)
def
test_ngrams
(
request
,
project_id
,
corpus_id
):
results
=
[
"hola"
,
"mundo"
]
...
...
templates/corpus/menu.html
View file @
16224708
...
...
@@ -11,7 +11,7 @@
<div
class=
"col-md-4"
>
{% if project %}
<h1>
{{ project.name }}
</h1>
<h1>
<a
href=
"/project/{{project.id}}"
>
{{ project.name }}
</a>
</h1>
<h2>
{{ corpus.name }}
</h2>
{% endif %}
<!--<a class="btn btn-primary btn-lg" role="button" href="/admin/documents/corpus/{{ corpus.id }}/">Add file</a> -->
...
...
templates/project.html
View file @
16224708
...
...
@@ -87,7 +87,7 @@
{% ifequal corpus.processing 1 %}
{{corpus.name}} :
<img
width=
"20px"
src=
"{% static "
js
/
libs
/
img2
/
loading-bar
.
gif
"
%}"
></img>
Processing, drink a cup of tea, and refresh the page :)
{% else %}
<a
href=
"/project/{{project.id}}/corpus/{{corpus.id}}"
>
{{corpus.name}}
</a>
, {{ corpus.count }} Documents
<a
href=
"/project/{{project.id}}/corpus/{{corpus.id}}"
>
{{corpus.name}}
, {{ corpus.count }} Documents
</a>
{% endifequal %}
<button
type=
"button"
class=
"btn btn-xs btn-default"
data-container=
"body"
data-toggle=
"popover"
data-placement=
"bottom"
data-content=
'
...
...
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