10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 05:43:46 +01:00

Add Unpublished publications (publications without DOI) support

This commit is contained in:
Mickaël Véril 2020-08-02 16:59:35 +02:00
parent a9c090e24f
commit d295352285
2 changed files with 32 additions and 17 deletions

View File

@ -99,12 +99,12 @@ draft: false
var data= await loadAllData()
window.defaultDats = []
for (const sub of Object.values(data)) {
for (const doi of uniq(sub.map(d => d.DOI.string))) {
const subdoi = sub.filter(d => d.DOI.string === doi)
for (const doi of uniq(sub.map(d => (d.DOI == null ? "" : d.DOI.string)))) {
const subdoi = sub.filter(d => (d.DOI == null ? "" : d.DOI.string) === doi)
for (mol of uniq(subdoi.map(d => d.molecule))) {
const submol = subdoi.filter(d => d.molecule === mol)
const source = submol.find((d) => {
if (d.DOI.string === "10.1021/acs.jctc.8b01205") {
if ((d.DOI == null ? "" : d.DOI.string) === "10.1021/acs.jctc.8b01205") {
return d.method.name === "CASPT2" && d.method.basis === "aug-cc-pVDZ"
} else {
return d.method.isTBE
@ -120,11 +120,24 @@ draft: false
window.defaultDats = window.defaultDats.concat(sub)
}
await doiCache.addRange(Array.from(new Set(window.defaultDats.map(d=>d.DOI.string))))
await doiCache.addRange(Array.from(new Set(window.defaultDats.filter(d=>d.DOI!==null).map(d=>d.DOI.string))))
window.defaultDats = window.defaultDats.sort((datfa,datfb)=>{
const puba = doiCache.get(datfa.DOI.string).format('data', { format: 'object' })[0]
const pubb = doiCache.get(datfb.DOI.string).format('data', { format: 'object' })[0]
return pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb)
const DOIa=datfa.DOI
const DOIb=datfb.DOI
if (DOIa == null && DOIb == null) {
return 0
}
else if (DOIa == null){
return 1
}
else if (DOIb == null){
return -1
}
else {
const puba = doiCache.get(DOIa.string).format('data', { format: 'object' })[0]
const pubb = doiCache.get(DOIb.string).format('data', { format: 'object' })[0]
return pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb)
}
})
processingIndicator.isActive = false
reloadCustomFiles()
@ -194,7 +207,8 @@ draft: false
const sets = await (async () => {
if (name === "DOI") {
const publis = await getPublis()
const sets = publis.sets
var sets = publis.sets
sets.set("","Unknow set")
return sets
}
else {
@ -238,7 +252,7 @@ draft: false
case "basis":
return data.method.basis
case "DOI":
return data.DOI.string
return data.DOI === null ? "" : data.DOI.string
default:
return data[name]
break;
@ -256,7 +270,7 @@ draft: false
if (!(sdatdic.has(key))) {
sdatdic.set(key, new Map())
}
const myT1s = T1ref.get(d.DOI.string).get(d.molecule)
const myT1s = T1ref.get(d.DOI == null ? "" : d.DOI.string).get(d.molecule)
for (const exc of d.excitations) {
var allowT1 = false
const T1Key = JSON.stringify((exc.initial, exc.final))
@ -367,14 +381,14 @@ draft: false
})
})
window.T1ref = new Map()
var dois = new Set(window.filtData.map((d) => d.DOI.string))
var dois = new Set(window.filtData.map((d) =>d.DOI===null ? "" : d.DOI.string))
var mols = new Set(window.filtData.map((d) => d.molecule))
await window.doiCache.addRange(dois)
for (const doi of dois) {
window.T1ref.set(doi, new Map())
for (const mol of mols) {
window.T1ref.get(doi).set(mol, new Map())
var TBESortdat = window.dats.filter(d => d.DOI.string === doi && d.molecule === mol).sort((d1, d2) => {
var TBESortdat = window.dats.filter(d => (d.DOI === null ? "" : d.DOI.string) === doi && d.molecule === mol).sort((d1, d2) => {
if (d1.method.isTBE && !d2.method.isTBE) {
return -1
} else if (!d1.method.isTBE && d2.method.isTBE) {
@ -398,7 +412,7 @@ draft: false
}
}
$(sel_ref).empty()
for (const el of uniq(window.filtData.map(d => [d.method, d.DOI.string]))) {
for (const el of uniq(window.filtData.map(d => [d.method, (d.DOI === null ? null : d.DOI.string)]))) {
op = $("<option/>", {
value: JSON.stringify(el)
}).text(el[0])
@ -413,10 +427,11 @@ draft: false
var data = $("#data")
$(data).empty();
if (window.filtData.length > 0) {
const sets = (await getPublis()).sets
var sets = (await getPublis()).sets
sets.set("","Unknow set")
for (const doi of doiCache.keys()) {
paperdata = window.filtData.filter((d) => {
return d.DOI.string == doi
return (d.DOI === null ? "" : d.DOI.string) == doi
})
var methods = uniq(paperdata.map(d => d.method))
const sortedMethods = methods.sort((a, b) => {
@ -451,7 +466,7 @@ draft: false
datadic = new Map()
for (const dat of paperdata) {
const key1 = dat.molecule;
const myT1s = T1ref.get(dat.DOI.string).get(dat.molecule)
const myT1s = T1ref.get(dat.DOI == null ? "" : dat.DOI.string).get(dat.molecule)
if (!datadic.has(key1)) {
datadic.set(key1, new Map())
}

View File

@ -20,7 +20,7 @@ draft: false
window.onload = async function () {
var div = document.getElementById("publis_div")
const Cite = require("citation-js")
const sdois = uniq(Object.values(await loadAllData()).flat().map(d => d.DOI.string))
const sdois = uniq(Object.values(await loadAllData()).flat().filter(d => d.DOI !== null).map(d => d.DOI.string))
const spubliscite = await Cite.async(sdois)
const pubs = await getPublis()
const uospublis = spubliscite.format('data', { format: 'object' })