Commit d8d27f26 authored by PkSM3's avatar PkSM3

[UPDATE] csv parser and date-max+1

parent 1348a4af
...@@ -391,7 +391,12 @@ def newpaginatorJSON(request , corpus_id): ...@@ -391,7 +391,12 @@ def newpaginatorJSON(request , corpus_id):
resdict = {} resdict = {}
resdict["id"] = doc.id resdict["id"] = doc.id
resdict["date"] = realdate resdict["date"] = realdate
resdict["name"] = doc.name resdict["name"] = ""
if doc.name and doc.name!="":
resdict["name"] = doc.name
else:
resdict["name"] = doc.hyperdata["doi"]
filtered_docs.append( resdict ) filtered_docs.append( resdict )
except Exception as e: except Exception as e:
print ("pag2 error01 detail:",e) print ("pag2 error01 detail:",e)
......
...@@ -4,6 +4,9 @@ from .FileParser import FileParser ...@@ -4,6 +4,9 @@ from .FileParser import FileParser
from ..NgramsExtractors import * from ..NgramsExtractors import *
from datetime import datetime from datetime import datetime
from io import BytesIO from io import BytesIO
import csv
import sys
csv.field_size_limit(sys.maxsize)
class CSVParser(FileParser): class CSVParser(FileParser):
...@@ -14,7 +17,7 @@ class CSVParser(FileParser): ...@@ -14,7 +17,7 @@ class CSVParser(FileParser):
import csv import csv
f = open(file , "r") f = open(file , "r")
reader = csv.reader(f) reader = csv.reader(f , delimiter='\t')
counter = 0 counter = 0
for row in reader: for row in reader:
...@@ -36,6 +39,7 @@ class CSVParser(FileParser): ...@@ -36,6 +39,7 @@ class CSVParser(FileParser):
pub["publication_year"] = "2014" pub["publication_year"] = "2014"
pub["publication_month"] = "01" pub["publication_month"] = "01"
pub["publication_day"] = "01" pub["publication_day"] = "01"
pub["language_iso3"] = "eng"
pub["authors"] = [ authors ] pub["authors"] = [ authors ]
hyperdata_list.append(pub) hyperdata_list.append(pub)
......
...@@ -84,6 +84,7 @@ function Final_UpdateTable( action ) { ...@@ -84,6 +84,7 @@ function Final_UpdateTable( action ) {
var dataini = TheBuffer[0].toISOString().split("T")[0] var dataini = TheBuffer[0].toISOString().split("T")[0]
var datafin = TheBuffer[1].toISOString().split("T")[0] var datafin = TheBuffer[1].toISOString().split("T")[0]
pr("show me the pubs of the selected period") pr("show me the pubs of the selected period")
console.log( TheBuffer )
pr("\tfrom ["+dataini+"] to ["+datafin+"]") pr("\tfrom ["+dataini+"] to ["+datafin+"]")
TimeRange = [] TimeRange = []
...@@ -295,8 +296,7 @@ function Main_test( Data , SearchFilter ) { ...@@ -295,8 +296,7 @@ function Main_test( Data , SearchFilter ) {
latest = t1; latest = t1;
TheBuffer = [new Date(t0[0],(t0[1]-1),t0[2]), new Date(t1[0],(t1[1]-1),t1[2])]; TheBuffer = [new Date(t0[0],(t0[1]-1),t0[2]), new Date(t1[0],(t1[1]-1),t1[2]+1)];
var arrayd3 = [] var arrayd3 = []
for(var e in Data) { for(var e in Data) {
......
...@@ -406,7 +406,7 @@ function Main_test( data , initial) { ...@@ -406,7 +406,7 @@ function Main_test( data , initial) {
.title(function (d) { .title(function (d) {
var value = d.value.avg ? d.value.avg : d.value; var value = d.value.avg ? d.value.avg : d.value;
if (isNaN(value)) value = 0; if (isNaN(value)) value = 0;
return value+" ngrams with "+FirstScore+"="+Number(d.key); return value+" journals with "+Number(d.key)+" publications";
}) })
.xAxis(); .xAxis();
LineChart.yAxis().ticks(5) LineChart.yAxis().ticks(5)
......
...@@ -408,6 +408,7 @@ $("#Save_All").click(function(){ ...@@ -408,6 +408,7 @@ $("#Save_All").click(function(){
}, },
success: function(data){ success: function(data){
console.log(data) console.log(data)
location.reload()
}, },
error: function(result) { error: function(result) {
console.log("Data not found in #Save_All"); console.log("Data not found in #Save_All");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment