Rootclaim formatting tweak

This commit is contained in:
NunoSempere 2021-06-27 19:43:58 +02:00
parent 35a2a3c1f2
commit 5b92f73747

View File

@ -32,19 +32,20 @@ async function fetchAndProcessData() {
let results = [] let results = []
for (let claim of claims) { for (let claim of claims) {
let options = [] let options = []
for (let scenario in claim.scenarios) { for (let scenario of claim.scenarios) {
//console.log(scenario)
options.push({ options.push({
"name": scenario.name, "name": toMarkdown(scenario.text).replace("\n","").replace("'","'"),
"probability": scenario.net_prob / 100, "probability": scenario.net_prob / 100,
"type": "PROBABILITY" "type": "PROBABILITY"
}) })
} }
let claimUrlPath = claim.created_at < "2020" ? "claim" : "analysis" let claimUrlPath = claim.created_at < "2020" ? "claim" : "analysis"
let obj = ({ let obj = ({
"title": claim.question, "title": toMarkdown(claim.question).replace("\n",""),
"url": `https://www.rootclaim.com/${claimUrlPath}/${claim.slug}`, "url": `https://www.rootclaim.com/${claimUrlPath}/${claim.slug}`,
"platform": "Rootclaim", "platform": "Rootclaim",
"description": toMarkdown(claim.background), "description": toMarkdown(claim.background).replace("&#39;","'"),
"options": options, "options": options,
"timestamp": new Date().toISOString(), "timestamp": new Date().toISOString(),
"qualityindicators": { "qualityindicators": {
@ -60,7 +61,7 @@ async function fetchAndProcessData() {
/* Body */ /* Body */
export async function rootclaim() { export async function rootclaim() {
let results = await fetchAndProcessData() let results = await fetchAndProcessData()
// console.log(results) //console.log(JSON.stringify(results, null, 4))
// let string = JSON.stringify(results, null, 2) // let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('rootclaim-questions.json', string); // fs.writeFileSync('rootclaim-questions.json', string);
await upsert(results, "rootclaim-questions") await upsert(results, "rootclaim-questions")