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
0da3e90b
Commit
0da3e90b
authored
Aug 23, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patch n° 1 Crawlers ISTEX PUBMED
parent
0bd9237e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
istex.py
moissonneurs/istex.py
+10
-4
pubmed.py
moissonneurs/pubmed.py
+4
-1
project.html
templates/pages/projects/project.html
+3
-2
No files found.
moissonneurs/istex.py
View file @
0da3e90b
...
@@ -30,7 +30,10 @@ def query( request ):
...
@@ -30,7 +30,10 @@ def query( request ):
if
request
.
method
==
"POST"
:
if
request
.
method
==
"POST"
:
query
=
request
.
POST
[
"query"
]
query
=
request
.
POST
[
"query"
]
N
=
int
(
request
.
POST
[
"N"
])
if
request
.
POST
[
N
]
==
"NaN"
:
N
=
QUERY_SIZE_N_MAX
else
:
N
=
int
(
request
.
POST
[
"N"
])
print
(
"LOG::TIME:_ "
+
datetime
.
datetime
.
now
()
.
isoformat
()
+
" query ="
,
query
)
print
(
"LOG::TIME:_ "
+
datetime
.
datetime
.
now
()
.
isoformat
()
+
" query ="
,
query
)
print
(
"LOG::TIME:_ "
+
datetime
.
datetime
.
now
()
.
isoformat
()
+
" N ="
,
N
)
print
(
"LOG::TIME:_ "
+
datetime
.
datetime
.
now
()
.
isoformat
()
+
" N ="
,
N
)
query_string
=
query
.
replace
(
" "
,
"+"
)
query_string
=
query
.
replace
(
" "
,
"+"
)
...
@@ -77,7 +80,7 @@ def save(request , project_id):
...
@@ -77,7 +80,7 @@ def save(request , project_id):
if
project
.
user_id
!=
user
.
id
:
if
project
.
user_id
!=
user
.
id
:
return
HttpResponseForbidden
()
return
HttpResponseForbidden
()
query_string
=
""
if
request
.
method
==
"POST"
:
if
request
.
method
==
"POST"
:
query
=
"-"
query
=
"-"
query_string
=
"-"
query_string
=
"-"
...
@@ -88,7 +91,10 @@ def save(request , project_id):
...
@@ -88,7 +91,10 @@ def save(request , project_id):
query_string
=
query
.
replace
(
" "
,
"+"
)
# url encoded q
query_string
=
query
.
replace
(
" "
,
"+"
)
# url encoded q
if
"N"
in
request
.
POST
:
if
"N"
in
request
.
POST
:
N
=
int
(
request
.
POST
[
"N"
])
# query_size from views_opti
if
request
.
POST
[
"N"
]
==
"NaN"
:
N
=
QUERY_SIZE_N_MAX
else
:
N
=
int
(
request
.
POST
[
"N"
])
# query_size from views_opti
if
N
>
QUERY_SIZE_N_MAX
:
if
N
>
QUERY_SIZE_N_MAX
:
msg
=
"Invalid sample size N =
%
i (max =
%
i)"
%
(
N
,
QUERY_SIZE_N_MAX
)
msg
=
"Invalid sample size N =
%
i (max =
%
i)"
%
(
N
,
QUERY_SIZE_N_MAX
)
print
(
"ERROR (scrap: istex d/l ): "
,
msg
)
print
(
"ERROR (scrap: istex d/l ): "
,
msg
)
...
@@ -133,7 +139,7 @@ def save(request , project_id):
...
@@ -133,7 +139,7 @@ def save(request , project_id):
if
filename
!=
False
:
if
filename
!=
False
:
# add the uploaded resource to the corpus
# add the uploaded resource to the corpus
corpus
.
add_resource
(
corpus
.
add_resource
(
type
=
get_resource_by_name
(
'ISTex
[ISI]
'
)[
"type"
]
type
=
get_resource_by_name
(
'ISTex'
)[
"type"
]
,
path
=
filename
,
path
=
filename
)
)
dwnldsOK
+=
1
dwnldsOK
+=
1
...
...
moissonneurs/pubmed.py
View file @
0da3e90b
...
@@ -48,7 +48,10 @@ def query( request ):
...
@@ -48,7 +48,10 @@ def query( request ):
if
request
.
method
==
"POST"
:
if
request
.
method
==
"POST"
:
query
=
request
.
POST
[
"query"
]
query
=
request
.
POST
[
"query"
]
N
=
int
(
request
.
POST
[
"N"
])
if
request
.
POST
[
"N"
]
==
"NaN"
:
N
=
QUERY_SIZE_N_MAX
else
:
N
=
int
(
request
.
POST
[
"N"
])
if
N
>
QUERY_SIZE_N_MAX
:
if
N
>
QUERY_SIZE_N_MAX
:
msg
=
"Invalid sample size N =
%
i (max =
%
i)"
%
(
N
,
QUERY_SIZE_N_MAX
)
msg
=
"Invalid sample size N =
%
i (max =
%
i)"
%
(
N
,
QUERY_SIZE_N_MAX
)
...
...
templates/pages/projects/project.html
View file @
0da3e90b
...
@@ -364,6 +364,7 @@
...
@@ -364,6 +364,7 @@
}
}
function
getGlobalResults
(
value
){
function
getGlobalResults
(
value
){
console
.
log
(
"in getGlobalResults()"
)
console
.
log
(
"in getGlobalResults()"
)
// AJAX to django
// AJAX to django
var
pubmedquery
=
$
(
"#id_name"
).
val
()
var
pubmedquery
=
$
(
"#id_name"
).
val
()
...
@@ -376,7 +377,7 @@
...
@@ -376,7 +377,7 @@
var
theType
=
$
(
"#id_type option:selected"
).
html
();
var
theType
=
$
(
"#id_type option:selected"
).
html
();
if
(
theType
==
"Pubmed
(XML format)
"
)
{
if
(
theType
==
"Pubmed
[XML]
"
)
{
$
.
ajax
({
$
.
ajax
({
// contentType: "application/json",
// contentType: "application/json",
url
:
window
.
location
.
origin
+
"/moissonneurs/pubmed/query"
,
url
:
window
.
location
.
origin
+
"/moissonneurs/pubmed/query"
,
...
@@ -388,7 +389,7 @@
...
@@ -388,7 +389,7 @@
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
log
(
"SUCCESS"
)
console
.
log
(
"SUCCESS"
)
console
.
log
(
"in getGlobalResults"
)
console
.
log
(
"in getGlobalResults"
)
//
console.log(data)
console
.
log
(
data
)
console
.
log
(
"enabling "
+
"#"
+
value
.
id
)
console
.
log
(
"enabling "
+
"#"
+
value
.
id
)
$
(
"#"
+
value
.
id
).
attr
(
'onclick'
,
'getGlobalResults(this);'
);
$
(
"#"
+
value
.
id
).
attr
(
'onclick'
,
'getGlobalResults(this);'
);
// $("#submit_thing").prop('disabled' , false)
// $("#submit_thing").prop('disabled' , false)
...
...
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