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 = { | ||||
|       id, | ||||
|       title: prediction.title, | ||||
|       url: `https://example.com`, | ||||
|       platform: platformName, | ||||
|       url: "https://example.com", | ||||
|       description: prediction.description, | ||||
|       options, | ||||
|       qualityindicators: { | ||||
|  |  | |||
|  | @ -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 ${ | ||||
|  |  | |||
|  | @ -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: { | ||||
|  |  | |||
|  | @ -101,7 +101,6 @@ export const goodjudgment: Platform = { | |||
|           id, | ||||
|           title, | ||||
|           url: endpoint, | ||||
|           platform: platformName, | ||||
|           description, | ||||
|           options, | ||||
|           qualityindicators: { | ||||
|  |  | |||
|  | @ -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
 | ||||
|  |  | |||
|  | @ -179,7 +179,6 @@ async function infer_inner(cookie: string) { | |||
|             title: title, | ||||
|             description: moreinfo.description, | ||||
|             url: url, | ||||
|             platform: platformName, | ||||
|             options: moreinfo.options, | ||||
|             ...moreinfo, | ||||
|           }; | ||||
|  |  | |||
|  | @ -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: { | ||||
|  |  | |||
|  | @ -63,7 +63,6 @@ async function processPredictions(predictions) { | |||
|       id: id, | ||||
|       title: prediction.question, | ||||
|       url: prediction.url, | ||||
|       platform: platformName, | ||||
|       description: prediction.description, | ||||
|       options: options, | ||||
|       qualityindicators: { | ||||
|  |  | |||
|  | @ -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: { | ||||
|  |  | |||
|  | @ -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: { | ||||
|  |  | |||
|  | @ -100,7 +100,6 @@ export const predictit: Platform = { | |||
|         id, | ||||
|         title: market["name"], | ||||
|         url: market.url, | ||||
|         platform: platformName, | ||||
|         description, | ||||
|         options, | ||||
|         qualityindicators: { | ||||
|  |  | |||
|  | @ -75,7 +75,6 @@ export const rootclaim: Platform = { | |||
|         id, | ||||
|         title: toMarkdown(claim.question).replace("\n", ""), | ||||
|         url, | ||||
|         platform: platformName, | ||||
|         description: toMarkdown(description).replace("'", "'"), | ||||
|         options: options, | ||||
|         qualityindicators: { | ||||
|  |  | |||
|  | @ -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(), | ||||
|  |  | |||
|  | @ -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")), | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user