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
407d6778
Commit
407d6778
authored
Oct 01, 2015
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FACTORISATION] gargantext_web.api -> rest.api Be careful for your merge
parent
1b3d8259
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
32 additions
and
40 deletions
+32
-40
views.py
annotations/views.py
+1
-1
corpus_views.py
gargantext_web/corpus_views.py
+1
-1
urls.py
gargantext_web/urls.py
+26
-12
views.py
gargantext_web/views.py
+1
-9
views_optimized.py
gargantext_web/views_optimized.py
+1
-1
lists.py
ngram/lists.py
+0
-13
__init__.py
rest/__init__.py
+0
-0
__init__.py
rest/analyses/__init__.py
+0
-0
api.py
rest/api.py
+0
-1
__init__.py
rest/crawls/__init__.py
+0
-0
__init__.py
rest/lists/__init__.py
+0
-0
ngrams.py
rest/ngrams.py
+0
-0
__init__.py
rest/nodes/__init__.py
+0
-0
views.py
scrappers/scrap_pubmed/views.py
+1
-1
views.py
tests/ngramstable/views.py
+1
-1
No files found.
annotations/views.py
View file @
407d6778
...
...
@@ -16,7 +16,7 @@ from rest_framework.authentication import SessionAuthentication, BasicAuthentica
from
node.models
import
Node
from
gargantext_web.db
import
*
from
ngram.lists
import
listIds
,
listNgramIds
from
gargantext_web
.api
import
JsonHttpResponse
from
rest
.api
import
JsonHttpResponse
@
login_required
...
...
gargantext_web/corpus_views.py
View file @
407d6778
...
...
@@ -49,7 +49,7 @@ from sqlalchemy import desc, asc, or_, and_, Date, cast, select
from
gargantext_web
import
about
from
gargantext_web
.api
import
JsonHttpResponse
from
rest
.api
import
JsonHttpResponse
from
ngram.lists
import
listIds
,
listNgramIds
,
ngramList
,
doList
...
...
gargantext_web/urls.py
View file @
407d6778
...
...
@@ -7,8 +7,8 @@ from gargantext_web import views, views_optimized
from
annotations
import
urls
as
annotations_urls
from
annotations.views
import
main
as
annotations_main_view
import
gargantext_web.api
import
api.ngrams
import
rest.ngrams
import
rest.api
import
scrappers.scrap_pubmed.views
as
pubmedscrapper
...
...
@@ -88,16 +88,30 @@ urlpatterns = patterns('',
############################################################################
# Data management
#url(r'^api$', gargantext_web.api.Root), # = ?
url
(
r'^api/nodes$'
,
gargantext_web
.
api
.
NodesList
.
as_view
()),
url
(
r'^api/nodes/(\d+)$'
,
gargantext_web
.
api
.
Nodes
.
as_view
()),
url
(
r'^api/nodes/(\d+)/children/ngrams$'
,
gargantext_web
.
api
.
NodesChildrenNgrams
.
as_view
()),
# => repeated children ?
url
(
r'^api/node/(\d+)/ngrams$'
,
api
.
ngrams
.
Ngrams
.
as_view
()),
# => repeated children ?
url
(
r'^api/nodes/(\d+)/children/hyperdata$'
,
gargantext_web
.
api
.
NodesChildrenMetatadata
.
as_view
()),
url
(
r'^api/nodes/(\d+)/children/queries$'
,
gargantext_web
.
api
.
NodesChildrenQueries
.
as_view
()),
url
(
r'^api/nodes/(\d+)/children/duplicates$'
,
gargantext_web
.
api
.
NodesChildrenDuplicates
.
as_view
()),
# url(r'^api/nodes/(\d+)/children/duplicates/delete$', gargantext_web.api.NodesChildrenDuplicates.delete ),
url
(
r'^api/nodes/(\d+)/ngrams$'
,
gargantext_web
.
api
.
CorpusController
.
ngrams
),
#url(r'^api$', rest.api.Root), # = ?
url
(
r'^api/nodes$'
,
rest
.
api
.
NodesList
.
as_view
()),
url
(
r'^v1.0/nodes$'
,
rest
.
api
.
NodesList
.
as_view
()),
url
(
r'^api/nodes/(\d+)$'
,
rest
.
api
.
Nodes
.
as_view
()),
url
(
r'^v1.0/nodes/(\d+)$'
,
rest
.
api
.
Nodes
.
as_view
()),
url
(
r'^api/nodes/(\d+)/children/ngrams$'
,
rest
.
api
.
NodesChildrenNgrams
.
as_view
()),
# => repeated children ?
url
(
r'^v1.0/nodes/(\d+)/children/ngrams$'
,
rest
.
api
.
NodesChildrenNgrams
.
as_view
()),
# => repeated children ?
url
(
r'^api/node/(\d+)/ngrams$'
,
rest
.
ngrams
.
Ngrams
.
as_view
()),
url
(
r'^v1.0/node/(\d+)/ngrams$'
,
rest
.
ngrams
.
Ngrams
.
as_view
()),
url
(
r'^api/nodes/(\d+)/children/hyperdata$'
,
rest
.
api
.
NodesChildrenMetatadata
.
as_view
()),
url
(
r'^v1.0/nodes/(\d+)/children/hyperdata$'
,
rest
.
api
.
NodesChildrenMetatadata
.
as_view
()),
url
(
r'^api/nodes/(\d+)/children/queries$'
,
rest
.
api
.
NodesChildrenQueries
.
as_view
()),
url
(
r'^v1.0/nodes/(\d+)/children/queries$'
,
rest
.
api
.
NodesChildrenQueries
.
as_view
()),
url
(
r'^api/nodes/(\d+)/children/duplicates$'
,
rest
.
api
.
NodesChildrenDuplicates
.
as_view
()),
url
(
r'^v1.0/nodes/(\d+)/children/duplicates$'
,
rest
.
api
.
NodesChildrenDuplicates
.
as_view
()),
# url(r'^api/nodes/(\d+)/children/duplicates/delete$', rest.api.NodesChildrenDuplicates.delete ),
url
(
r'^api/nodes/(\d+)/ngrams$'
,
rest
.
api
.
CorpusController
.
ngrams
),
url
(
r'^v1.0/nodes/(\d+)/ngrams$'
,
rest
.
api
.
CorpusController
.
ngrams
),
# Provisory tests
url
(
r'^ngrams$'
,
views
.
ngrams
),
# to be removed
...
...
gargantext_web/views.py
View file @
407d6778
...
...
@@ -320,7 +320,6 @@ def update_nodes(request, project_id, corpus_id, view=None):
# )
#
def
corpus
(
request
,
project_id
,
corpus_id
):
if
not
request
.
user
.
is_authenticated
():
return
redirect
(
'/login/?next=
%
s'
%
request
.
path
)
...
...
@@ -362,7 +361,6 @@ def corpus(request, project_id, corpus_id):
return
HttpResponse
(
html
)
def
newpaginatorJSON
(
request
,
corpus_id
):
results
=
[
"hola"
,
"mundo"
]
...
...
@@ -429,7 +427,6 @@ def empty_trash():
node
.
delete
()
def
move_to_trash
(
node_id
):
try
:
node
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
node_id
)
.
first
()
...
...
@@ -443,8 +440,6 @@ def move_to_trash(node_id):
except
Exception
as
error
:
print
(
"can not move to trash Node"
+
node_id
+
":"
+
error
)
def
move_to_trash_multiple
(
request
):
user
=
request
.
user
if
not
user
.
is_authenticated
():
...
...
@@ -467,8 +462,6 @@ def move_to_trash_multiple(request):
return
JsonHttpResponse
(
results
)
def
delete_node
(
request
,
node_id
):
# do we have a valid user?
...
...
@@ -492,7 +485,6 @@ def delete_node(request, node_id):
empty_trash
()
def
delete_corpus
(
request
,
project_id
,
node_id
):
# ORM Django
with
transaction
.
atomic
():
...
...
@@ -692,7 +684,7 @@ def send_csv(request, corpus_id):
return
response
# To get the data
from
gargantext_web
.api
import
JsonHttpResponse
from
rest
.api
import
JsonHttpResponse
from
analysis.functions
import
get_cooc
def
node_link
(
request
,
corpus_id
):
'''
...
...
gargantext_web/views_optimized.py
View file @
407d6778
...
...
@@ -16,7 +16,7 @@ from threading import Thread
from
node.admin
import
CustomForm
from
gargantext_web.db
import
*
from
gargantext_web.settings
import
DEBUG
,
MEDIA_ROOT
from
gargantext_web
.api
import
JsonHttpResponse
from
rest
.api
import
JsonHttpResponse
import
json
import
re
...
...
ngram/lists.py
View file @
407d6778
...
...
@@ -11,7 +11,6 @@ from sqlalchemy import literal_column
from
sqlalchemy.orm
import
aliased
def
listIds
(
typeList
=
None
,
user_id
=
None
,
corpus_id
=
None
):
'''
nodeList : get or create NodeList.
...
...
@@ -60,7 +59,6 @@ def listIds(typeList=None, user_id=None, corpus_id=None):
# Some functions to manage ngrams according to the lists
def
listNgramIds
(
list_id
=
None
,
typeList
=
None
,
corpus_id
=
None
,
doc_id
=
None
,
user_id
=
None
):
'''
...
...
@@ -115,7 +113,6 @@ def listNgramIds(list_id=None, typeList=None,
return
(
query
.
all
())
def
ngramList
(
do
,
list_id
,
ngram_ids
=
None
)
:
'''
ngramList :: ([Int], Int, String) -> Bool
...
...
@@ -160,9 +157,7 @@ def ngramList(do, list_id, ngram_ids=None) :
session
.
commit
()
return
(
results
)
# Some functions to manage automatically the lists
def
doStopList
(
user_id
=
None
,
corpus_id
=
None
,
stop_id
=
None
,
reset
=
False
,
limit
=
None
):
'''
Compute automatically the stopList and returns its Node.id
...
...
@@ -175,7 +170,6 @@ def doStopList(user_id=None, corpus_id=None, stop_id=None, reset=False, limit=No
typeList
=
'StopList'
)[
0
]
# according to type of corpus, choose the right default stopList
def
ngrams2miam
(
user_id
=
None
,
corpus_id
=
None
):
'''
Create a Miam List only
...
...
@@ -204,7 +198,6 @@ def ngrams2miam(user_id=None, corpus_id=None):
from
gargantext_web.db
import
get_or_create_node
from
analysis.lists
import
Translations
,
UnweightedList
def
ngrams2miamBis
(
corpus
):
'''
Create a Miam List only
...
...
@@ -213,8 +206,6 @@ def ngrams2miamBis(corpus):
miam_id
=
get_or_create_node
(
corpus
=
corpus
,
nodetype
=
'MiamList'
)
stop_id
=
get_or_create_node
(
corpus
=
corpus
,
nodetype
=
'StopList'
)
query
=
(
session
.
query
(
literal_column
(
str
(
miam_id
))
.
label
(
"node_id"
),
Ngram
.
id
,
...
...
@@ -232,10 +223,6 @@ def ngrams2miamBis(corpus):
)
bulk_insert
(
NodeNgram
,
[
'node_id'
,
'ngram_id'
,
'weight'
],
query
)
def
doList
(
type_list
=
'MiamList'
,
user_id
=
None
,
corpus_id
=
None
,
...
...
api
/__init__.py
→
rest
/__init__.py
View file @
407d6778
File moved
api
/analyses/__init__.py
→
rest
/analyses/__init__.py
View file @
407d6778
File moved
gargantext_web
/api.py
→
rest
/api.py
View file @
407d6778
...
...
@@ -15,7 +15,6 @@ from gargantext_web.db import session, Node, NodeNgram, NodeNgramNgram, NodeNode
from
gargantext_web.validation
import
validate
,
ValidationException
from
node
import
models
def
DebugHttpResponse
(
data
):
return
HttpResponse
(
'<html><body style="background:#000;color:#FFF"><pre>
%
s</pre></body></html>'
%
(
str
(
data
),
))
...
...
api
/crawls/__init__.py
→
rest
/crawls/__init__.py
View file @
407d6778
File moved
api
/lists/__init__.py
→
rest
/lists/__init__.py
View file @
407d6778
File moved
api
/ngrams.py
→
rest
/ngrams.py
View file @
407d6778
File moved
api
/nodes/__init__.py
→
rest
/nodes/__init__.py
View file @
407d6778
File moved
scrappers/scrap_pubmed/views.py
View file @
407d6778
...
...
@@ -30,7 +30,7 @@ import threading
from
node.admin
import
CustomForm
from
gargantext_web.db
import
*
from
gargantext_web.settings
import
DEBUG
,
MEDIA_ROOT
from
gargantext_web
.api
import
JsonHttpResponse
from
rest
.api
import
JsonHttpResponse
from
parsing.corpustools
import
add_resource
,
parse_resources
,
extract_ngrams
from
ngram.tfidf
import
compute_tfidf
...
...
tests/ngramstable/views.py
View file @
407d6778
...
...
@@ -50,7 +50,7 @@ from sqlalchemy import or_, func
from
gargantext_web
import
about
from
gargantext_web
.api
import
JsonHttpResponse
from
rest
.api
import
JsonHttpResponse
from
ngram.lists
import
listIds
,
listNgramIds
,
ngramList
,
doList
...
...
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