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
339d375b
Commit
339d375b
authored
Jun 08, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documents: new filter for duplicates by title AND date AND source
parent
4504a0b8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
5 deletions
+35
-5
Docs_dyna_chart_and_table.js
static/lib/gargantext/Docs_dyna_chart_and_table.js
+33
-4
titles.html
templates/pages/corpora/titles.html
+2
-1
No files found.
static/lib/gargantext/Docs_dyna_chart_and_table.js
View file @
339d375b
...
@@ -143,6 +143,7 @@ var RecDict={};
...
@@ -143,6 +143,7 @@ var RecDict={};
var
AjaxRecords
=
[]
var
AjaxRecords
=
[]
var
Garbage
=
{}
var
Garbage
=
{}
var
countByTitles
=
{}
// useful for title duplicates
var
countByTitles
=
{}
// useful for title duplicates
var
countByMeta
=
{}
// for title + date + journal duplicates
var
favorites
=
{}
var
favorites
=
{}
function
getRecord
(
rec_id
)
{
function
getRecord
(
rec_id
)
{
...
@@ -287,6 +288,22 @@ function ulWriter(rowIndex, record, columns, cellWriter) {
...
@@ -287,6 +288,22 @@ function ulWriter(rowIndex, record, columns, cellWriter) {
}
}
// creates a unique string defining the document's metadata: title, source, date
// doc Record => string
// (useful for de-duplication of documents with the same meta)
// format: title--source--date
function
metaSignature
(
docRecord
)
{
var
keyStr
=
""
keyStr
=
(
docRecord
.
rawtitle
+
"--"
+
docRecord
.
hyperdata
.
journal
+
"--"
+
docRecord
.
hyperdata
.
publication_date
)
return
keyStr
}
function
Main_test
(
Data
)
{
function
Main_test
(
Data
)
{
var
DistributionDict
=
{}
var
DistributionDict
=
{}
...
@@ -539,7 +556,8 @@ function Main_test(Data) {
...
@@ -539,7 +556,8 @@ function Main_test(Data) {
.
functions
[
'docFilter'
]
=
function
(
record
,
opt
)
{
.
functions
[
'docFilter'
]
=
function
(
record
,
opt
)
{
if
(
opt
==
'filter_all'
)
return
true
if
(
opt
==
'filter_all'
)
return
true
else
if
(
opt
==
'filter_favs'
)
return
favorites
[
record
.
id
]
else
if
(
opt
==
'filter_favs'
)
return
favorites
[
record
.
id
]
else
if
(
opt
==
'filter_dupl'
)
return
(
countByTitles
[
record
.
rawtitle
]
>
1
)
else
if
(
opt
==
'filter_dupl_tit'
)
return
(
countByTitles
[
record
.
rawtitle
]
>
1
)
else
if
(
opt
==
'filter_dupl_all'
)
return
(
countByMeta
[
record
.
signature
]
>
1
)
}
}
// and set this filter's initial status to 'filter_all'
// and set this filter's initial status to 'filter_all'
...
@@ -575,14 +593,14 @@ var dupFlag = false ;
...
@@ -575,14 +593,14 @@ var dupFlag = false ;
$
(
"#div-table"
).
on
(
"dynatable:queries:added"
,
function
(
e
,
qname
,
qval
)
{
$
(
"#div-table"
).
on
(
"dynatable:queries:added"
,
function
(
e
,
qname
,
qval
)
{
// debug
// debug
// console.warn(e)
// console.warn(e)
if
(
!
dupFlag
&&
qname
==
'docFilter'
&&
qval
==
"filter_dupl"
)
{
if
(
!
dupFlag
&&
qname
==
'docFilter'
&&
(
qval
==
"filter_dupl_tit"
||
qval
==
"filter_dupl_all"
)
)
{
MyTable
.
data
(
'dynatable'
).
queries
.
remove
(
'docFilter'
)
MyTable
.
data
(
'dynatable'
).
queries
.
remove
(
'docFilter'
)
// to avoid recursion when we'll call this filter again in 4 lines
// to avoid recursion when we'll call this filter again in 4 lines
dupFlag
=
true
;
dupFlag
=
true
;
// sort alphabetically **before** duplicates filter
// sort alphabetically **before** duplicates filter
MyTable
.
data
(
'dynatable'
).
sorts
.
clear
();
MyTable
.
data
(
'dynatable'
).
sorts
.
clear
();
MyTable
.
data
(
'dynatable'
).
sorts
.
add
(
'rawtitle'
,
-
1
)
// -1 <==> DESC (ASC doesn't work well ?)
MyTable
.
data
(
'dynatable'
).
sorts
.
add
(
'rawtitle'
,
-
1
)
// -1 <==> DESC (ASC doesn't work well ?)
MyTable
.
data
(
'dynatable'
).
queries
.
add
(
'docFilter'
,
'filter_dupl'
)
MyTable
.
data
(
'dynatable'
).
queries
.
add
(
'docFilter'
,
qval
)
MyTable
.
data
(
'dynatable'
).
process
();
MyTable
.
data
(
'dynatable'
).
process
();
}
}
});
});
...
@@ -629,7 +647,7 @@ $.ajax({
...
@@ -629,7 +647,7 @@ $.ajax({
record
.
del
=
false
;
record
.
del
=
false
;
});
});
// initialize
CountByTitle
census
// initialize
countByTitle and countByMeta
census
for
(
var
i
in
maindata
.
records
)
{
for
(
var
i
in
maindata
.
records
)
{
ourTitle
=
maindata
.
records
[
i
][
'rawtitle'
]
;
ourTitle
=
maindata
.
records
[
i
][
'rawtitle'
]
;
if
(
countByTitles
.
hasOwnProperty
(
ourTitle
))
{
if
(
countByTitles
.
hasOwnProperty
(
ourTitle
))
{
...
@@ -638,7 +656,18 @@ $.ajax({
...
@@ -638,7 +656,18 @@ $.ajax({
else
{
else
{
countByTitles
[
ourTitle
]
=
1
;
countByTitles
[
ourTitle
]
=
1
;
}
}
ourSignature
=
metaSignature
(
maindata
.
records
[
i
])
if
(
countByMeta
.
hasOwnProperty
(
ourSignature
))
{
countByMeta
[
ourSignature
]
++
;
}
}
else
{
countByMeta
[
ourSignature
]
=
1
;
}
// also save record's "meta signature" for later lookup
maindata
.
records
[
i
].
signature
=
ourSignature
}
AjaxRecords
=
maindata
.
records
;
// backup-ing in global variable!
AjaxRecords
=
maindata
.
records
;
// backup-ing in global variable!
$
(
"#content_loader"
).
remove
();
$
(
"#content_loader"
).
remove
();
...
...
templates/pages/corpora/titles.html
View file @
339d375b
...
@@ -76,7 +76,8 @@
...
@@ -76,7 +76,8 @@
<select
id=
"docFilter"
name=
"docFilter"
>
<select
id=
"docFilter"
name=
"docFilter"
>
<option
value=
"filter_all"
>
All
</option>
<option
value=
"filter_all"
>
All
</option>
<option
value=
"filter_favs"
>
Favorite documents
</option>
<option
value=
"filter_favs"
>
Favorite documents
</option>
<option
value=
"filter_dupl"
>
Duplicates by title
</option>
<option
value=
"filter_dupl_tit"
>
Duplicates (title)
</option>
<option
value=
"filter_dupl_all"
>
Duplicates (title, date
&
src)
</option>
</select>
</select>
</div>
</div>
</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