mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-12-25 13:53:48 +01:00
New publis handling with sets which support multiple publications
This commit is contained in:
parent
5904358ecf
commit
62acffa870
@ -23,6 +23,7 @@ draft: false
|
|||||||
<script src="/js/numberRangeChange.js"></script>
|
<script src="/js/numberRangeChange.js"></script>
|
||||||
<script src="/js/DebugMode.js"></script>
|
<script src="/js/DebugMode.js"></script>
|
||||||
<script src="/js/numberUtils.js"></script>
|
<script src="/js/numberUtils.js"></script>
|
||||||
|
<script src="/js/PubliDB.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function adjustSticky() {
|
function adjustSticky() {
|
||||||
const height = $("nav").height()
|
const height = $("nav").height()
|
||||||
@ -194,31 +195,52 @@ draft: false
|
|||||||
selectSelectAll(afters.first())
|
selectSelectAll(afters.first())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function getAllVals(select) {
|
||||||
|
var baseval = $(select).val()
|
||||||
|
switch (select.name) {
|
||||||
|
case "DOI":
|
||||||
|
vals=baseval.reduce((accumulator,currentValue)=>accumulator.concat(JSON.parse(currentValue)),[])
|
||||||
|
return vals
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return baseval
|
||||||
|
}
|
||||||
|
}
|
||||||
async function reloadSelect(name) {
|
async function reloadSelect(name) {
|
||||||
clearSelect(name)
|
clearSelect(name)
|
||||||
var selects = getAllSelectBefore(name, true)
|
var selects = getAllSelectBefore(name, true)
|
||||||
var currentselect = selects.last()
|
var currentselect = selects.last()
|
||||||
selects = selects.slice(0, selects.length - 1)
|
selects = selects.slice(0, selects.length - 1)
|
||||||
const vals = uniq(window.dats.filter(d => {
|
var vals = uniq(window.dats.filter(d => {
|
||||||
return Array.from(selects).every((el) => {
|
return Array.from(selects).every((el) => {
|
||||||
return $(el).val().includes(getSelectValue(d, el.name))
|
return getAllVals(el).includes(getSelectValue(d, el.name))
|
||||||
})
|
})
|
||||||
}).map((d) => getSelectValue(d, name)))
|
}).map((d) => getSelectValue(d, name)))
|
||||||
const sets = await (async () => {
|
const publis = await (async () => {
|
||||||
if (name === "DOI") {
|
if (name === "DOI") {
|
||||||
const publis = await getPublis()
|
const publis = await publiDB.loadAsync()
|
||||||
var sets = publis.sets
|
return publis
|
||||||
sets.set("","Unknow set")
|
|
||||||
return sets
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
|
if (name === "DOI") {
|
||||||
|
let newvals = []
|
||||||
|
for (const val of vals) {
|
||||||
|
for (const set of publis.sets.values()) {
|
||||||
|
if (set.includes(val)) {
|
||||||
|
newvals.push(set)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vals = newvals
|
||||||
|
}
|
||||||
textSelctor = function (value) {
|
textSelctor = function (value) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "DOI":
|
case "DOI":
|
||||||
return sets.has(value) ? sets.get(value) : value.toString()
|
setname = publis.findNameFromSet(value, true)
|
||||||
|
return setname === null ? value.toString() : setname
|
||||||
break;
|
break;
|
||||||
case "molecule":
|
case "molecule":
|
||||||
const mhchemCE = /^\\ce\{(.*)\}$/
|
const mhchemCE = /^\\ce\{(.*)\}$/
|
||||||
@ -233,17 +255,25 @@ draft: false
|
|||||||
return value.toString()
|
return value.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
valueSelector = function (value) {
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
return JSON.stringify(value)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
}
|
||||||
for (const val of vals) {
|
for (const val of vals) {
|
||||||
if (val !== null) {
|
if (val !== null) {
|
||||||
$("<option/>", {
|
$("<option/>", {
|
||||||
value: val
|
value: valueSelector(val)
|
||||||
}).text(textSelctor(val)).appendTo(currentselect)
|
}).text(textSelctor(val)).appendTo(currentselect)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (name === "molecule") {
|
if (name === "molecule") {
|
||||||
await MathJax.typesetPromise()
|
await MathJax.typesetPromise()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
function getSelectValue(data, name) {
|
function getSelectValue(data, name) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "method":
|
case "method":
|
||||||
@ -371,7 +401,7 @@ draft: false
|
|||||||
window.filtData = window.dats
|
window.filtData = window.dats
|
||||||
getAllSelect().each(function () {
|
getAllSelect().each(function () {
|
||||||
const prop = $(this).attr("name")
|
const prop = $(this).attr("name")
|
||||||
const values = $(this).val()
|
const values = getAllVals(this)
|
||||||
window.filtData = window.filtData.filter((d) => {
|
window.filtData = window.filtData.filter((d) => {
|
||||||
if (typeof values == "undefined" || values == null) {
|
if (typeof values == "undefined" || values == null) {
|
||||||
return false
|
return false
|
||||||
@ -427,8 +457,9 @@ draft: false
|
|||||||
var data = $("#data")
|
var data = $("#data")
|
||||||
$(data).empty();
|
$(data).empty();
|
||||||
if (window.filtData.length > 0) {
|
if (window.filtData.length > 0) {
|
||||||
var sets = (await getPublis()).sets
|
var publis = await publiDB.loadAsync()
|
||||||
sets.set("","Unknow set")
|
var PreviousSetName = undefined
|
||||||
|
var CurrentsetName = undefined
|
||||||
for (const doi of doiCache.keys()) {
|
for (const doi of doiCache.keys()) {
|
||||||
paperdata = window.filtData.filter((d) => {
|
paperdata = window.filtData.filter((d) => {
|
||||||
return (d.DOI === null ? "" : d.DOI.string) == doi
|
return (d.DOI === null ? "" : d.DOI.string) == doi
|
||||||
@ -454,7 +485,11 @@ draft: false
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
var div = $('<div/>').appendTo(data)
|
var div = $('<div/>').appendTo(data)
|
||||||
$("<h1/>").text(sets.get(doi)).appendTo(div)
|
CurrentsetName = publis.findSetNameFromDOI(doi, true)
|
||||||
|
if (PreviousSetName !== CurrentsetName) {
|
||||||
|
$("<h1/>").text(CurrentsetName).appendTo(div)
|
||||||
|
}
|
||||||
|
$("<h2/>").text(doiCache.get(doi).format('data', { format: 'object' })[0].title).appendTo(div)
|
||||||
var table = $("<table/>").addClass("datatable").appendTo(div)
|
var table = $("<table/>").addClass("datatable").appendTo(div)
|
||||||
var head = $("<tr/>")
|
var head = $("<tr/>")
|
||||||
$("<thead/>").addClass("sticky").append(head).appendTo(table)
|
$("<thead/>").addClass("sticky").append(head).appendTo(table)
|
||||||
@ -539,6 +574,7 @@ draft: false
|
|||||||
tbody.append(tr)
|
tbody.append(tr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
PreviousSetName === CurrentsetName
|
||||||
}
|
}
|
||||||
await MathJax.typesetPromise()
|
await MathJax.typesetPromise()
|
||||||
}
|
}
|
||||||
@ -563,6 +599,8 @@ draft: false
|
|||||||
async function submitdat() {
|
async function submitdat() {
|
||||||
if (!DebugMode.Enabled) {
|
if (!DebugMode.Enabled) {
|
||||||
window.onbeforeunload = () => { return ''; }
|
window.onbeforeunload = () => { return ''; }
|
||||||
|
window.onbeforeunload = () => { return ''; }
|
||||||
|
window.onbeforeunload = () => { return ''; }
|
||||||
}
|
}
|
||||||
await reloadContent();
|
await reloadContent();
|
||||||
}
|
}
|
||||||
@ -577,7 +615,8 @@ draft: false
|
|||||||
</p>
|
</p>
|
||||||
</noscript>
|
</noscript>
|
||||||
<p>
|
<p>
|
||||||
On this page you can compare multiple dataset and have some statistics to evaluate method accuracy (All fields marked with a red asterisk (<span style="color: red;">*</span>) are mandatory).
|
On this page you can compare multiple dataset and have some statistics to evaluate method accuracy (All fields marked
|
||||||
|
with a red asterisk (<span style="color: red;">*</span>) are mandatory).
|
||||||
</p>
|
</p>
|
||||||
<form id="form_dat" action="javascript:submitdat()" method="post">
|
<form id="form_dat" action="javascript:submitdat()" method="post">
|
||||||
<fieldset class="main">
|
<fieldset class="main">
|
||||||
@ -626,12 +665,12 @@ draft: false
|
|||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="required"
|
<legend class="required">Vertical excitation kind</legend>
|
||||||
>Vertical excitation kind</legend>
|
|
||||||
<p>Choose what kind of vertical excitations you want</p>
|
<p>Choose what kind of vertical excitations you want</p>
|
||||||
<ul class="nestedCbList" style="padding-left: 0em;">
|
<ul class="nestedCbList" style="padding-left: 0em;">
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" data-onerequired="true" checked onchange="nestedCheckbox_change(event)" id="cb_fileType_All"></input>
|
<input type="checkbox" data-onerequired="true" checked onchange="nestedCheckbox_change(event)"
|
||||||
|
id="cb_fileType_All"></input>
|
||||||
<label for="cb_fileType_All"> All</label>
|
<label for="cb_fileType_All"> All</label>
|
||||||
</li>
|
</li>
|
||||||
<ul class="nestedCbList" id="cb_exVertKindList">
|
<ul class="nestedCbList" id="cb_exVertKindList">
|
||||||
@ -651,7 +690,8 @@ draft: false
|
|||||||
<p>Choose other excitation parameters you want</p>
|
<p>Choose other excitation parameters you want</p>
|
||||||
<ul class="nestedCbList" style="padding-left: 0em;">
|
<ul class="nestedCbList" style="padding-left: 0em;">
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" data-onerequired="true" onchange="nestedCheckbox_change(event)" id="cb_exType_All"></input>
|
<input type="checkbox" data-onerequired="true" onchange="nestedCheckbox_change(event)"
|
||||||
|
id="cb_exType_All"></input>
|
||||||
<label for="cb_exType_All"> All</label>
|
<label for="cb_exType_All"> All</label>
|
||||||
</li>
|
</li>
|
||||||
<ul id="cb_exTypeList" class="nestedCbList">
|
<ul id="cb_exTypeList" class="nestedCbList">
|
||||||
@ -665,11 +705,11 @@ draft: false
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>\(\mathrm{\%T_1}\)</legend>
|
<legend>\(\mathrm{\%T_1}\)</legend>
|
||||||
<p>Chose the range of \(\mathrm{\%T_1}\) range using the two number box</p>
|
<p>Chose the range of \(\mathrm{\%T_1}\) range using the two number box</p>
|
||||||
<input class="range min" airia-label="Minimum value" type="number" id="T1min"
|
<input class="range min" airia-label="Minimum value" type="number" id="T1min" onchange="numberRangeChange(event)"
|
||||||
onchange="numberRangeChange(event)" min="0" value="0">
|
min="0" value="0">
|
||||||
<span>\(\leq \mathrm{\%T_1} \leq\)</span>
|
<span>\(\leq \mathrm{\%T_1} \leq\)</span>
|
||||||
<input class="range max" airia-label="Maximum value" type="number" id="T1max"
|
<input class="range max" airia-label="Maximum value" type="number" id="T1max" onchange="numberRangeChange(event)"
|
||||||
onchange="numberRangeChange(event)" max="100" value="100">
|
max="100" value="100">
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<input type="submit" value="Load"></input>
|
<input type="submit" value="Load"></input>
|
||||||
|
@ -15,6 +15,7 @@ draft: false
|
|||||||
<script src="/js/numberUtils.js"></script>
|
<script src="/js/numberUtils.js"></script>
|
||||||
<script src="/js/DebugMode.js"></script>
|
<script src="/js/DebugMode.js"></script>
|
||||||
<script src="/js/createPubliUI.js"></script>
|
<script src="/js/createPubliUI.js"></script>
|
||||||
|
<script src="/js/PubliDB.js"></script>
|
||||||
{{< getDataFilesName >}}
|
{{< getDataFilesName >}}
|
||||||
<script>
|
<script>
|
||||||
window.onload = async function () {
|
window.onload = async function () {
|
||||||
@ -22,30 +23,37 @@ draft: false
|
|||||||
const Cite = require("citation-js")
|
const Cite = require("citation-js")
|
||||||
const sdois = uniq(Object.values(await loadAllData()).flat().filter(d => d.DOI !== null).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 spubliscite = await Cite.async(sdois)
|
||||||
const pubs = await getPublis()
|
|
||||||
const uospublis = spubliscite.format('data', { format: 'object' })
|
const uospublis = spubliscite.format('data', { format: 'object' })
|
||||||
const spublis = uospublis.sort((puba, pubb) => pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb))
|
const spublis = uospublis.sort((puba, pubb) => pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb))
|
||||||
|
var myDB = await publiDB.loadAsync()
|
||||||
for (const publi of spublis) {
|
for (const publi of spublis) {
|
||||||
art= await createPubliUI(publi,pubs.sets,true,true)
|
var art = await createPubliUI(publi, true, true)
|
||||||
$(art).appendTo("#publis_sets")
|
var setName = myDB.findSetNameFromDOI(publi.DOI, true)
|
||||||
|
setsSec = $('#publis_sets')
|
||||||
|
var mySetSec = setsSec.find(`section.publiSet[data-setName="${setName}"]`)
|
||||||
|
if (mySetSec.length === 0) {
|
||||||
|
mySetSec = $('<section>').addClass('publiSet').attr("data-setName", setName).appendTo(setsSec)
|
||||||
|
$("<h1>").text(setName).appendTo(mySetSec)
|
||||||
}
|
}
|
||||||
const odois=Array.from(pubs.others.keys())
|
$(art).appendTo(mySetSec)
|
||||||
|
}
|
||||||
|
const odois = myDB.others
|
||||||
const opubliscite = await Cite.async(odois)
|
const opubliscite = await Cite.async(odois)
|
||||||
const uoopublis = opubliscite.format('data', { format: 'object' })
|
const uoopublis = opubliscite.format('data', { format: 'object' })
|
||||||
const opublis = uoopublis.sort((puba, pubb) => pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb))
|
const opublis = uoopublis.sort((puba, pubb) => pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb))
|
||||||
for (const publi of opublis) {
|
for (const publi of opublis) {
|
||||||
art= await createPubliUI(publi,pubs.others,true,true)
|
art = await createPubliUI(publi, true, true)
|
||||||
$(art).appendTo("#publis_others")
|
$(art).appendTo("#publis_others")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<section class="publis-list" id="publis_sets">
|
<section class="publis-list" id="publis_sets">
|
||||||
<header>
|
<header>
|
||||||
<h2>Sets</h2>
|
<h1>Sets</h2>
|
||||||
</header>
|
</header>
|
||||||
</section>
|
</section>
|
||||||
<section class="publis" id="publis_others">
|
<section class="publis" id="publis_others">
|
||||||
<header>
|
<header>
|
||||||
<h2>Others</h2>
|
<h1>Others</h2>
|
||||||
</header>
|
</header>
|
||||||
</section>
|
</section>
|
@ -1,7 +1,8 @@
|
|||||||
.publi h1 {
|
.publiSet h1 {
|
||||||
font-size: 22pt
|
font-size: 22PT;
|
||||||
}
|
}
|
||||||
.publi h2 {
|
|
||||||
|
.publi h1 {
|
||||||
font-size: 20pt
|
font-size: 20pt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
sets:
|
sets:
|
||||||
10.1021/acs.jctc.8b00406 : QUEST#1
|
QUEST#1:
|
||||||
10.1021/acs.jctc.8b01205 : QUEST#2
|
- 10.1021/acs.jctc.8b00406
|
||||||
10.1021/acs.jctc.9b01216 : QUEST#3
|
QUEST#2:
|
||||||
10.1021/acs.jctc.0c00227 : QUEST#4
|
- 10.1021/acs.jctc.8b01205
|
||||||
|
QUEST#3:
|
||||||
|
- 10.1021/acs.jctc.9b01216
|
||||||
|
QUEST#4:
|
||||||
|
- 10.1021/acs.jctc.0c00227
|
||||||
others:
|
others:
|
||||||
10.1021/acs.jpclett.0c00014 :
|
- 10.1021/acs.jpclett.0c00014
|
||||||
|
34
static/js/PubliDB.js
Normal file
34
static/js/PubliDB.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
class publiDB {
|
||||||
|
static async loadAsync() {
|
||||||
|
var db = new publiDB
|
||||||
|
const text = await getTextFromFileUrlAsync("/data/publis/index.yaml")
|
||||||
|
const myYaml = jsyaml.load(text);
|
||||||
|
db.sets = ((myYaml.sets === null) ? new Map() : new Map(Object.entries(myYaml.sets)));
|
||||||
|
db.others = ((myYaml.others === null) ? new Map() : new Map(Object.entries(myYaml.others)));
|
||||||
|
return db
|
||||||
|
}
|
||||||
|
static get UnknowSetName() {
|
||||||
|
return "Unknow set"
|
||||||
|
}
|
||||||
|
findNameFromSet(set, supportUnknow = false) {
|
||||||
|
if (supportUnknow && JSON.stringify(set) === JSON.stringify([""])) {
|
||||||
|
return publiDB.UnknowSetName
|
||||||
|
}
|
||||||
|
for (let [setname, dois] of this.sets.entries()) {
|
||||||
|
if (JSON.stringify(set.sort()) === JSON.stringify(dois.sort())) {
|
||||||
|
return setname
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
findSetNameFromDOI(doi, supportUnknow = false) {
|
||||||
|
for (let [setname, dois] of this.sets.entries()) {
|
||||||
|
if (dois.includes(doi))
|
||||||
|
return setname
|
||||||
|
}
|
||||||
|
if (supportUnknow && doi === "") {
|
||||||
|
return UnknowSetName
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
@ -2,16 +2,13 @@ function getPubliSubDir(DOI) {
|
|||||||
return DOI.split(".").join("/")
|
return DOI.split(".").join("/")
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createPubliUI(publi,sets=new Map(),toolTips=false,abstract=false) {
|
async function createPubliUI(publi,toolTips=false,abstract=false) {
|
||||||
const art = $("<article/>").addClass("publi")
|
const art = $("<article/>").addClass("publi")
|
||||||
art.className = "publi"
|
art.className = "publi"
|
||||||
if (sets.has(publi.DOI) && sets.get(publi.DOI)!==null) {
|
|
||||||
$("<header/>").append($("<h1/>").text(sets.get(publi.DOI))).appendTo(art)
|
|
||||||
}
|
|
||||||
$("<a/>", {
|
$("<a/>", {
|
||||||
href: publi.URL,
|
href: publi.URL,
|
||||||
target: "_blank"
|
target: "_blank"
|
||||||
}).html($("<h2/>").text(publi.title)).appendTo(art)
|
}).html($("<h1/>").text(publi.title)).appendTo(art)
|
||||||
const authors = publi.author
|
const authors = publi.author
|
||||||
const ulauthors = $("<ul/>").addClass("authors-list").appendTo(art)
|
const ulauthors = $("<ul/>").addClass("authors-list").appendTo(art)
|
||||||
for (const author of authors) {
|
for (const author of authors) {
|
||||||
|
Loading…
Reference in New Issue
Block a user