refactor: platforms don't need to pass in results
This commit is contained in:
parent
f6e2e8cfa1
commit
ac7b541896
|
@ -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: {
|
||||||
|
|
|
@ -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 ${
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
|
@ -101,7 +101,6 @@ export const goodjudgment: Platform = {
|
||||||
id,
|
id,
|
||||||
title,
|
title,
|
||||||
url: endpoint,
|
url: endpoint,
|
||||||
platform: platformName,
|
|
||||||
description,
|
description,
|
||||||
options,
|
options,
|
||||||
qualityindicators: {
|
qualityindicators: {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,
|
||||||
};
|
};
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
|
@ -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("'", "'"),
|
description: toMarkdown(description).replace("'", "'"),
|
||||||
options: options,
|
options: options,
|
||||||
qualityindicators: {
|
qualityindicators: {
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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")),
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user