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 = {
id,
title: prediction.title,
url: `https://example.com`,
platform: platformName,
url: "https://example.com",
description: prediction.description,
options,
qualityindicators: {

View File

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

View File

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

View File

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

View File

@ -41,7 +41,7 @@ export interface QualityIndicators {
export type FetchedQuestion = Omit<
Question,
"extra" | "qualityindicators" | "timestamp"
"extra" | "qualityindicators" | "timestamp" | "platform"
> & {
timestamp?: Date;
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,
description: moreinfo.description,
url: url,
platform: platformName,
options: moreinfo.options,
...moreinfo,
};

View File

@ -40,7 +40,6 @@ async function processMarkets(markets) {
id,
title: market.title.replaceAll("*", ""),
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})`,
options,
qualityindicators: {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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