fix: Cosmetic tweaks to Hypermind forecasts
This commit is contained in:
parent
8e47215e6e
commit
1fd3b29def
|
@ -110,6 +110,7 @@ async function hypermind_inner(cookie) {
|
||||||
"timestamp": new Date().toISOString(),
|
"timestamp": new Date().toISOString(),
|
||||||
"qualityindicators": {
|
"qualityindicators": {
|
||||||
"stars": calculateStars("Hypermind", ({})),
|
"stars": calculateStars("Hypermind", ({})),
|
||||||
|
// "numforecasters": res.fcsterCnt
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -120,7 +121,7 @@ async function hypermind_inner(cookie) {
|
||||||
// Hypermind panelists and competitors; dashboard type two: "showcase"
|
// Hypermind panelists and competitors; dashboard type two: "showcase"
|
||||||
// https://prod.hypermind.com/ngdp/fr/showcase2/showcase.html?sc=SLUG
|
// https://prod.hypermind.com/ngdp/fr/showcase2/showcase.html?sc=SLUG
|
||||||
// E.g., https://prod.hypermind.com/ngdp/fr/showcase2/showcase.html?sc=AI2023
|
// E.g., https://prod.hypermind.com/ngdp/fr/showcase2/showcase.html?sc=AI2023
|
||||||
let slugs2 = [ "Covid19", "DOSES", "H5N8", "NGDP", "JSAI", "AI2023", "AI2030"]
|
let slugs2 = [ "Covid19" , "DOSES", "H5N8", "NGDP", "JSAI", "AI2023", "AI2030" ]
|
||||||
let results2 = []
|
let results2 = []
|
||||||
for(let slug of slugs2){
|
for(let slug of slugs2){
|
||||||
console.log(slug)
|
console.log(slug)
|
||||||
|
@ -129,16 +130,20 @@ async function hypermind_inner(cookie) {
|
||||||
let objs = response.map(result => {
|
let objs = response.map(result => {
|
||||||
let descriptionraw = result.props.details.split("<hr size=1>")[0]
|
let descriptionraw = result.props.details.split("<hr size=1>")[0]
|
||||||
let descriptionprocessed1 = toMarkdown(descriptionraw)
|
let descriptionprocessed1 = toMarkdown(descriptionraw)
|
||||||
let descriptionprocessed2 = descriptionprocessed1.split("![image]")[0]
|
let descriptionprocessed2 = descriptionprocessed1.replaceAll("![image] ()", "")
|
||||||
let description = descriptionprocessed2
|
let descriptionprocessed3 = descriptionprocessed2.replaceAll(" Forecasting Schedule ", "")
|
||||||
|
let descriptionprocessed4 = descriptionprocessed3.replaceAll("\n", "")
|
||||||
|
let descriptionprocessed5 = descriptionprocessed4.replaceAll("Context: ", "")
|
||||||
|
let description = descriptionprocessed5 || toMarkdown(result.props.details)
|
||||||
return ({
|
return ({
|
||||||
"title": result.props.title,
|
"title": result.props.title,
|
||||||
"url": "https://prod.hypermind.com/ngdp/en/showcase/showcase.html",
|
"url": "https://prod.hypermind.com/ngdp/fr/showcase2/showcase.html?sc="+slug,
|
||||||
"platform": "Hypermind",
|
"platform": "Hypermind",
|
||||||
"description": description,
|
"description": description,
|
||||||
"options": [],
|
"options": [],
|
||||||
"qualityindicators": {
|
"qualityindicators": {
|
||||||
"stars": calculateStars("Hypermind", ({})),
|
"stars": calculateStars("Hypermind", ({})),
|
||||||
|
"numforecasters": Number(result.fcsterCnt)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -10,7 +10,7 @@ const client = algoliasearch('96UD3NTQ7L', cookie); // delete this when committi
|
||||||
const index = client.initIndex('metaforecast');
|
const index = client.initIndex('metaforecast');
|
||||||
|
|
||||||
|
|
||||||
export async function rebuildAlgoliaDatabase(){
|
export async function rebuildAlgoliaDatabaseTheHardWay(){
|
||||||
console.log("Doing this the hard way")
|
console.log("Doing this the hard way")
|
||||||
let records = await mergeEverythingInner()
|
let records = await mergeEverythingInner()
|
||||||
records = records.map((record, index) => ({...record, has_numforecasts: record.numforecasts ? true : false, objectID: index}) )
|
records = records.map((record, index) => ({...record, has_numforecasts: record.numforecasts ? true : false, objectID: index}) )
|
||||||
|
@ -33,4 +33,6 @@ export async function rebuildAlgoliaDatabaseTheEasyWay(){
|
||||||
index.replaceAllObjects(records, { safe:true }).catch(error => console.log(error))
|
index.replaceAllObjects(records, { safe:true }).catch(error => console.log(error))
|
||||||
console.log(`Pushed ${records.length} records. Algolia will update asynchronously`)
|
console.log(`Pushed ${records.length} records. Algolia will update asynchronously`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const rebuildAlgoliaDatabase = rebuildAlgoliaDatabaseTheHardWay
|
|
@ -18,4 +18,4 @@ export default function toMarkdown(htmlText){
|
||||||
return textVersion(htmlText, styleConfig);
|
return textVersion(htmlText, styleConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
toMarkdown()
|
// toMarkdown()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user