From 701a7630a5f208439f18b12f05779ec313fb3309 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Tue, 23 Feb 2021 15:19:14 +0100 Subject: [PATCH] Change readme to point to the website as well --- README.md | 4 ++-- src/index.js | 2 +- src/process-forecasts-from-old.js | 36 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 src/process-forecasts-from-old.js diff --git a/README.md b/README.md index 206fc32..4df0302 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ ## What this is -This is a set of libraries and a command line interface that fetches probabilities/forecasts from prediction markets and forecasting platforms. These forecasts are then hosted on airtable, and used to power a search engine for probabilities. +This is a set of libraries and a command line interface that fetches probabilities/forecasts from prediction markets and forecasting platforms. -For now, a demo can be found [here](https://metaforecast.org/) (try searching "Trump", "China" or "Semiconductors"), and the database can be perused [here](https://airtable.com/shrUotmcMmmTdIjmX). I also have a json endpoint [here](https://metaforecast.org/data/metaforecasts.json) and a csv endpoint [here](https://metaforecast.org/data/metaforecasts.csv). +These forecasts are then used to power a search engine for probabilities, which can be found [here](https://metaforecast.org/) (try searching "Trump", "China" or "Semiconductors") (source code [here](https://github.com/QURIresearch/metaforecast-website-nextjs)). A json endpoint can be found [here](https://metaforecast.org/data/metaforecasts.json). I also created a search engine using Elicit's IDE, which uses GPT-3 to deliver vastly superior semantic search (as opposed to fuzzy word matching). If you have access to the Elicit IDE, you can use the action "Search Metaforecast database". diff --git a/src/index.js b/src/index.js index d9cd239..e08aba9 100644 --- a/src/index.js +++ b/src/index.js @@ -18,7 +18,7 @@ import {smarkets} from "./smarkets-fetch.js" let opts = {} let json2csvParser = new Parser({ transforms: [transforms.flatten()]}); //let parse = csv => json2csvParser.parse(csv); -let sets = ["template", "elicit", "metaculus", "predictit", "polymarket", "csetforetell", "goodjudgment","goodjudmentopen", "omen", "hypermind", "smarkets"] +let sets = ["template", "elicit", "metaculus", "predictit", "polymarket", "csetforetell", "givewellopenphil", "goodjudgment","goodjudmentopen", "omen", "hypermind", "smarkets"] let suffix = "-questions" let locationData = "./data/" let sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms)); diff --git a/src/process-forecasts-from-old.js b/src/process-forecasts-from-old.js new file mode 100644 index 0000000..f44e2e3 --- /dev/null +++ b/src/process-forecasts-from-old.js @@ -0,0 +1,36 @@ +/* Imports */ +import fs from "fs" + +/* Definitions */ +let locationData = "./data/" + +/* Body */ +let rawdata = fs.readFileSync("../data/givewellopenphil-questions-processed-old-format.json") +let data = JSON.parse(rawdata) + +let results = [] +for(let datum of data){ + let probability = Math.round(Number(datum["Percentage"].replace("%","")))/100 + let result = ({ + "title": datum["Title"], + "platform": datum["Platform"], + "description": datum["Description"], + "options": [ + { + "name": "Yes", + "probability": probability, + "type": "PROBABILITY" + }, + { + "name": "No", + "probability": 1-Math.round(probability*100)/100, + "type": "PROBABILITY" + } + ], + "stars": datum["Stars"] + }) + results.push(result) +} + +let string = JSON.stringify(results,null, 2) +fs.writeFileSync("../data/givewellopenphil-questions.json", string)