mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-08-25 13:41:50 +02: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/DebugMode.js"></script>
|
||||
<script src="/js/numberUtils.js"></script>
|
||||
<script src="/js/PubliDB.js"></script>
|
||||
<script>
|
||||
function adjustSticky() {
|
||||
const height = $("nav").height()
|
||||
@ -79,7 +80,7 @@ draft: false
|
||||
}
|
||||
$("<li/>").text(txt).appendTo(extl)
|
||||
var cbli = $("<li/>")
|
||||
if(!DebugMode.Enabled && value==(1 << 31)){
|
||||
if (!DebugMode.Enabled && value == (1 << 31)) {
|
||||
cbli.hide()
|
||||
}
|
||||
$("<input/>", { type: "checkbox", id: "cb_" + name, name: name, value: Number(value) }).change(nestedCheckbox_change).appendTo(cbli);
|
||||
@ -96,7 +97,7 @@ draft: false
|
||||
async function loadFiles() {
|
||||
processingIndicator.isActive = true
|
||||
var chks = []
|
||||
var data= await loadAllData()
|
||||
var data = await loadAllData()
|
||||
window.defaultDats = []
|
||||
for (const sub of Object.values(data)) {
|
||||
for (const doi of uniq(sub.map(d => (d.DOI == null ? "" : d.DOI.string)))) {
|
||||
@ -120,17 +121,17 @@ draft: false
|
||||
|
||||
window.defaultDats = window.defaultDats.concat(sub)
|
||||
}
|
||||
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 DOIa=datfa.DOI
|
||||
const DOIb=datfb.DOI
|
||||
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 DOIa = datfa.DOI
|
||||
const DOIb = datfb.DOI
|
||||
if (DOIa == null && DOIb == null) {
|
||||
return 0
|
||||
}
|
||||
else if (DOIa == null){
|
||||
else if (DOIa == null) {
|
||||
return 1
|
||||
}
|
||||
else if (DOIb == null){
|
||||
else if (DOIb == null) {
|
||||
return -1
|
||||
}
|
||||
else {
|
||||
@ -194,35 +195,56 @@ draft: false
|
||||
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) {
|
||||
clearSelect(name)
|
||||
var selects = getAllSelectBefore(name, true)
|
||||
var currentselect = selects.last()
|
||||
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 $(el).val().includes(getSelectValue(d, el.name))
|
||||
return getAllVals(el).includes(getSelectValue(d, el.name))
|
||||
})
|
||||
}).map((d) => getSelectValue(d, name)))
|
||||
const sets = await (async () => {
|
||||
const publis = await (async () => {
|
||||
if (name === "DOI") {
|
||||
const publis = await getPublis()
|
||||
var sets = publis.sets
|
||||
sets.set("","Unknow set")
|
||||
return sets
|
||||
const publis = await publiDB.loadAsync()
|
||||
return publis
|
||||
}
|
||||
else {
|
||||
return undefined
|
||||
}
|
||||
})()
|
||||
textSelctor=function(value){
|
||||
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) {
|
||||
switch (name) {
|
||||
case "DOI":
|
||||
return sets.has(value) ? sets.get(value) : value.toString()
|
||||
setname = publis.findNameFromSet(value, true)
|
||||
return setname === null ? value.toString() : setname
|
||||
break;
|
||||
case "molecule":
|
||||
const mhchemCE=/^\\ce\{(.*)\}$/
|
||||
const m=value.match(mhchemCE)
|
||||
const mhchemCE = /^\\ce\{(.*)\}$/
|
||||
const m = value.match(mhchemCE)
|
||||
if (m) {
|
||||
return m[1]
|
||||
} else {
|
||||
@ -233,17 +255,25 @@ draft: false
|
||||
return value.toString()
|
||||
}
|
||||
}
|
||||
valueSelector = function (value) {
|
||||
if (typeof value === 'object') {
|
||||
return JSON.stringify(value)
|
||||
}
|
||||
else {
|
||||
return value
|
||||
}
|
||||
}
|
||||
for (const val of vals) {
|
||||
if (val !== null) {
|
||||
$("<option/>", {
|
||||
value: val
|
||||
value: valueSelector(val)
|
||||
}).text(textSelctor(val)).appendTo(currentselect)
|
||||
}
|
||||
}
|
||||
if (name==="molecule") {
|
||||
if (name === "molecule") {
|
||||
await MathJax.typesetPromise()
|
||||
}
|
||||
}
|
||||
}
|
||||
function getSelectValue(data, name) {
|
||||
switch (name) {
|
||||
case "method":
|
||||
@ -371,7 +401,7 @@ draft: false
|
||||
window.filtData = window.dats
|
||||
getAllSelect().each(function () {
|
||||
const prop = $(this).attr("name")
|
||||
const values = $(this).val()
|
||||
const values = getAllVals(this)
|
||||
window.filtData = window.filtData.filter((d) => {
|
||||
if (typeof values == "undefined" || values == null) {
|
||||
return false
|
||||
@ -381,7 +411,7 @@ draft: false
|
||||
})
|
||||
})
|
||||
window.T1ref = new Map()
|
||||
var dois = new Set(window.filtData.map((d) =>d.DOI===null ? "" : 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) {
|
||||
@ -427,8 +457,9 @@ draft: false
|
||||
var data = $("#data")
|
||||
$(data).empty();
|
||||
if (window.filtData.length > 0) {
|
||||
var sets = (await getPublis()).sets
|
||||
sets.set("","Unknow set")
|
||||
var publis = await publiDB.loadAsync()
|
||||
var PreviousSetName = undefined
|
||||
var CurrentsetName = undefined
|
||||
for (const doi of doiCache.keys()) {
|
||||
paperdata = window.filtData.filter((d) => {
|
||||
return (d.DOI === null ? "" : d.DOI.string) == doi
|
||||
@ -454,7 +485,11 @@ draft: false
|
||||
}
|
||||
})
|
||||
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 head = $("<tr/>")
|
||||
$("<thead/>").addClass("sticky").append(head).appendTo(table)
|
||||
@ -495,7 +530,7 @@ draft: false
|
||||
}
|
||||
for (const [molecule, moldat] of datadic.entries()) {
|
||||
var printmol = true;
|
||||
const mhchemCE=/^\\ce\{.*\}$/
|
||||
const mhchemCE = /^\\ce\{.*\}$/
|
||||
for (const [jsonex, exdat] of moldat.entries()) {
|
||||
const ex = JSON.parse(jsonex)
|
||||
Reflect.setPrototypeOf(ex[0], state.prototype)
|
||||
@ -511,7 +546,7 @@ draft: false
|
||||
if (ex[3].Value == VertExcitationKinds.Fluorescence.Value) {
|
||||
Vertkindtext = String.raw`[\mathrm{F}]`
|
||||
}
|
||||
desctex=""
|
||||
desctex = ""
|
||||
if (ex[2].description.string) {
|
||||
desctex = "(" + ex[2].description.string + ")"
|
||||
}
|
||||
@ -539,6 +574,7 @@ draft: false
|
||||
tbody.append(tr)
|
||||
}
|
||||
}
|
||||
PreviousSetName === CurrentsetName
|
||||
}
|
||||
await MathJax.typesetPromise()
|
||||
}
|
||||
@ -563,6 +599,8 @@ draft: false
|
||||
async function submitdat() {
|
||||
if (!DebugMode.Enabled) {
|
||||
window.onbeforeunload = () => { return ''; }
|
||||
window.onbeforeunload = () => { return ''; }
|
||||
window.onbeforeunload = () => { return ''; }
|
||||
}
|
||||
await reloadContent();
|
||||
}
|
||||
@ -577,7 +615,8 @@ draft: false
|
||||
</p>
|
||||
</noscript>
|
||||
<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>
|
||||
<form id="form_dat" action="javascript:submitdat()" method="post">
|
||||
<fieldset class="main">
|
||||
@ -626,12 +665,12 @@ draft: false
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend class="required"
|
||||
>Vertical excitation kind</legend>
|
||||
<legend class="required">Vertical excitation kind</legend>
|
||||
<p>Choose what kind of vertical excitations you want</p>
|
||||
<ul class="nestedCbList" style="padding-left: 0em;">
|
||||
<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>
|
||||
</li>
|
||||
<ul class="nestedCbList" id="cb_exVertKindList">
|
||||
@ -651,7 +690,8 @@ draft: false
|
||||
<p>Choose other excitation parameters you want</p>
|
||||
<ul class="nestedCbList" style="padding-left: 0em;">
|
||||
<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>
|
||||
</li>
|
||||
<ul id="cb_exTypeList" class="nestedCbList">
|
||||
@ -665,13 +705,13 @@ draft: false
|
||||
<fieldset>
|
||||
<legend>\(\mathrm{\%T_1}\)</legend>
|
||||
<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"
|
||||
onchange="numberRangeChange(event)" min="0" value="0">
|
||||
<input class="range min" airia-label="Minimum value" type="number" id="T1min" onchange="numberRangeChange(event)"
|
||||
min="0" value="0">
|
||||
<span>\(\leq \mathrm{\%T_1} \leq\)</span>
|
||||
<input class="range max" airia-label="Maximum value" type="number" id="T1max"
|
||||
onchange="numberRangeChange(event)" max="100" value="100">
|
||||
<input class="range max" airia-label="Maximum value" type="number" id="T1max" onchange="numberRangeChange(event)"
|
||||
max="100" value="100">
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
<input type="submit" value="Load"></input>
|
||||
</form>
|
||||
<form id="form_ref">
|
||||
@ -682,8 +722,8 @@ draft: false
|
||||
title="Theoretical best estimate">TBE</abbr> if present- is already selected)</p>
|
||||
<label for="sel_ref">Reference</label>
|
||||
<select id="sel_ref" onchange="reloadStat()"></select>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</form>
|
||||
<p>Now you can see the list of selected data and some statistics about these data</p>
|
||||
<section id="data">
|
||||
|
@ -15,6 +15,7 @@ draft: false
|
||||
<script src="/js/numberUtils.js"></script>
|
||||
<script src="/js/DebugMode.js"></script>
|
||||
<script src="/js/createPubliUI.js"></script>
|
||||
<script src="/js/PubliDB.js"></script>
|
||||
{{< getDataFilesName >}}
|
||||
<script>
|
||||
window.onload = async function () {
|
||||
@ -22,30 +23,37 @@ draft: false
|
||||
const Cite = require("citation-js")
|
||||
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' })
|
||||
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) {
|
||||
art= await createPubliUI(publi,pubs.sets,true,true)
|
||||
$(art).appendTo("#publis_sets")
|
||||
var art = await createPubliUI(publi, true, true)
|
||||
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 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) {
|
||||
art= await createPubliUI(publi,pubs.others,true,true)
|
||||
art = await createPubliUI(publi, true, true)
|
||||
$(art).appendTo("#publis_others")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<section class="publis-list" id="publis_sets">
|
||||
<header>
|
||||
<h2>Sets</h2>
|
||||
<h1>Sets</h2>
|
||||
</header>
|
||||
</section>
|
||||
<section class="publis" id="publis_others">
|
||||
<header>
|
||||
<h2>Others</h2>
|
||||
<h1>Others</h2>
|
||||
</header>
|
||||
</section>
|
@ -1,7 +1,8 @@
|
||||
.publi h1 {
|
||||
font-size: 22pt
|
||||
.publiSet h1 {
|
||||
font-size: 22PT;
|
||||
}
|
||||
.publi h2 {
|
||||
|
||||
.publi h1 {
|
||||
font-size: 20pt
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,11 @@
|
||||
sets:
|
||||
10.1021/acs.jctc.8b00406 : QUEST#1
|
||||
10.1021/acs.jctc.8b01205 : QUEST#2
|
||||
10.1021/acs.jctc.9b01216 : QUEST#3
|
||||
10.1021/acs.jctc.0c00227 : QUEST#4
|
||||
QUEST#1:
|
||||
- 10.1021/acs.jctc.8b00406
|
||||
QUEST#2:
|
||||
- 10.1021/acs.jctc.8b01205
|
||||
QUEST#3:
|
||||
- 10.1021/acs.jctc.9b01216
|
||||
QUEST#4:
|
||||
- 10.1021/acs.jctc.0c00227
|
||||
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("/")
|
||||
}
|
||||
|
||||
async function createPubliUI(publi,sets=new Map(),toolTips=false,abstract=false) {
|
||||
async function createPubliUI(publi,toolTips=false,abstract=false) {
|
||||
const art = $("<article/>").addClass("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/>", {
|
||||
href: publi.URL,
|
||||
target: "_blank"
|
||||
}).html($("<h2/>").text(publi.title)).appendTo(art)
|
||||
}).html($("<h1/>").text(publi.title)).appendTo(art)
|
||||
const authors = publi.author
|
||||
const ulauthors = $("<ul/>").addClass("authors-list").appendTo(art)
|
||||
for (const author of authors) {
|
||||
|
Loading…
Reference in New Issue
Block a user