refactor: platforms don't need to pass in results

This commit is contained in:
Vyacheslav Matyukhin 2022-05-09 23:34:56 +04:00
parent f6e2e8cfa1
commit ac7b541896
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C
15 changed files with 3 additions and 17 deletions

View File

@ -41,8 +41,7 @@ async function processPredictions(predictions) {
const result: FetchedQuestion = { const result: FetchedQuestion = {
id, id,
title: prediction.title, title: prediction.title,
url: `https://example.com`, url: "https://example.com",
platform: platformName,
description: prediction.description, description: prediction.description,
options, options,
qualityindicators: { qualityindicators: {

View File

@ -79,7 +79,6 @@ async function processData(data) {
id: id, id: id,
title: `In ${event.short_name}, the SCOTUS will affirm the lower court's decision`, title: `In ${event.short_name}, the SCOTUS will affirm the lower court's decision`,
url: `https://fantasyscotus.net/user-predictions${event.docket_url}`, url: `https://fantasyscotus.net/user-predictions${event.docket_url}`,
platform: platformName,
description: `${(pAffirm * 100).toFixed(2)}% (${ description: `${(pAffirm * 100).toFixed(2)}% (${
predictionData.numAffirm predictionData.numAffirm
} out of ${ } out of ${

View File

@ -84,11 +84,10 @@ export const foretold: Platform = {
}, },
]; ];
} }
let result: FetchedQuestion = { const result: FetchedQuestion = {
id, id,
title: question.name, title: question.name,
url: `https://www.foretold.io/c/${community}/m/${question.id}`, url: `https://www.foretold.io/c/${community}/m/${question.id}`,
platform: platformName,
description: "", description: "",
options, options,
qualityindicators: { qualityindicators: {

View File

@ -101,7 +101,6 @@ export const goodjudgment: Platform = {
id, id,
title, title,
url: endpoint, url: endpoint,
platform: platformName,
description, description,
options, options,
qualityindicators: { qualityindicators: {

View File

@ -41,7 +41,7 @@ export interface QualityIndicators {
export type FetchedQuestion = Omit< export type FetchedQuestion = Omit<
Question, Question,
"extra" | "qualityindicators" | "timestamp" "extra" | "qualityindicators" | "timestamp" | "platform"
> & { > & {
timestamp?: Date; timestamp?: Date;
extra?: object; // required in DB but annoying to return empty; also this is slightly stricter than Prisma's JsonValue extra?: object; // required in DB but annoying to return empty; also this is slightly stricter than Prisma's JsonValue

View File

@ -179,7 +179,6 @@ async function infer_inner(cookie: string) {
title: title, title: title,
description: moreinfo.description, description: moreinfo.description,
url: url, url: url,
platform: platformName,
options: moreinfo.options, options: moreinfo.options,
...moreinfo, ...moreinfo,
}; };

View File

@ -40,7 +40,6 @@ async function processMarkets(markets) {
id, id,
title: market.title.replaceAll("*", ""), title: market.title.replaceAll("*", ""),
url: `https://kalshi.com/markets/${market.ticker_name}`, url: `https://kalshi.com/markets/${market.ticker_name}`,
platform: platformName,
description: `${market.settle_details}. The resolution source is: ${market.ranged_group_name} (${market.settle_source_url})`, description: `${market.settle_details}. The resolution source is: ${market.ranged_group_name} (${market.settle_source_url})`,
options, options,
qualityindicators: { qualityindicators: {

View File

@ -63,7 +63,6 @@ async function processPredictions(predictions) {
id: id, id: id,
title: prediction.question, title: prediction.question,
url: prediction.url, url: prediction.url,
platform: platformName,
description: prediction.description, description: prediction.description,
options: options, options: options,
qualityindicators: { qualityindicators: {

View File

@ -152,7 +152,6 @@ export const metaculus: Platform = {
id, id,
title: result.title, title: result.title,
url: "https://www.metaculus.com" + result.page_url, url: "https://www.metaculus.com" + result.page_url,
platform: platformName,
description, description,
options, options,
qualityindicators: { qualityindicators: {

View File

@ -106,7 +106,6 @@ export const polymarket: Platform = {
id: id, id: id,
title: marketInfo.question, title: marketInfo.question,
url: "https://polymarket.com/market/" + marketInfo.slug, url: "https://polymarket.com/market/" + marketInfo.slug,
platform: platformName,
description: marketInfo.description, description: marketInfo.description,
options: options, options: options,
qualityindicators: { qualityindicators: {

View File

@ -100,7 +100,6 @@ export const predictit: Platform = {
id, id,
title: market["name"], title: market["name"],
url: market.url, url: market.url,
platform: platformName,
description, description,
options, options,
qualityindicators: { qualityindicators: {

View File

@ -75,7 +75,6 @@ export const rootclaim: Platform = {
id, id,
title: toMarkdown(claim.question).replace("\n", ""), title: toMarkdown(claim.question).replace("\n", ""),
url, url,
platform: platformName,
description: toMarkdown(description).replace("&#39;", "'"), description: toMarkdown(description).replace("&#39;", "'"),
options: options, options: options,
qualityindicators: { qualityindicators: {

View File

@ -163,7 +163,6 @@ export const smarkets: Platform = {
id: id, id: id,
title: name, title: name,
url: "https://smarkets.com/event/" + market.event_id + market.slug, url: "https://smarkets.com/event/" + market.event_id + market.slug,
platform: platformName,
description: market.description, description: market.description,
options: options, options: options,
timestamp: new Date(), timestamp: new Date(),

View File

@ -92,7 +92,6 @@ async function processPredictions(predictions) {
id, id,
title, title,
url: prediction["url"], url: prediction["url"],
platform: platformName,
description: prediction["Notes"] || "", description: prediction["Notes"] || "",
options, options,
timestamp: new Date(Date.parse(prediction["Prediction Date"] + "Z")), timestamp: new Date(Date.parse(prediction["Prediction Date"] + "Z")),

View File

@ -21,7 +21,6 @@ export const xrisk: Platform = {
return { return {
...item, ...item,
id: `${platformName}-${hash(item.title + " | " + item.url)}`, // some titles are non-unique, but title+url pair is always unique id: `${platformName}-${hash(item.title + " | " + item.url)}`, // some titles are non-unique, but title+url pair is always unique
platform: platformName,
}; };
}); });
return results; return results;