cleanup old commented fs.writeFileSync calls

This commit is contained in:
Vyacheslav Matyukhin 2022-03-24 01:48:36 +03:00
parent e0168d8ad3
commit 490f698f26
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C
23 changed files with 19 additions and 121 deletions

View File

@ -1,8 +1,7 @@
/* Imports */
import fs from "fs";
import axios from "axios";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
/* Definitions */
let graphQLendpoint = "https://api.foretold.io/graphql";
@ -91,11 +90,6 @@ export async function astralcodexten() {
results.push(result);
});
}
/*
let string = JSON.stringify(results, null, 2)
console.log(JSON.stringify(results, null, 2))
fs.writeFileSync('./data/astralcodexten-questions.json', string);
*/
await databaseUpsert(results, "astralcodexten-questions");
// console.log(results)
console.log("Done");

View File

@ -1,11 +1,8 @@
/* Imports */
import fs from "fs";
import axios from "axios";
import Papa from "papaparse";
import open from "open";
import readline from "readline";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
/* Definitions */
let coupCastEndpoint =
@ -156,8 +153,6 @@ async function processArray(countryArray) {
results.push(processedPrediction2);
}
}
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/elicit-questions.json', string);
await databaseUpsert(results, "coupcast-questions");
// console.log(results)
console.log("Done");

View File

@ -261,9 +261,6 @@ async function csetforetell_inner(cookie) {
);
}
}
// let string = JSON.stringify(results,null, 2)
// fs.writeFileSync('./data/csetforetell-questions.json', string);
// console.log(results)
if (results.length > 0) {
await databaseUpsert(results, "csetforetell-questions");
} else {

View File

@ -1,11 +1,9 @@
/* Imports */
import fs from "fs";
import axios from "axios";
import Papa from "papaparse";
import open from "open";
import readline from "readline";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
/* Definitions */
let elicitEndpoint =
@ -87,8 +85,6 @@ async function processArray(arrayQuestions) {
results.push(standardObj);
}
}
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/elicit-questions.json', string);
await databaseUpsert(results, "elicit-questions");
console.log("Done");

View File

@ -30,9 +30,6 @@ export async function estimize() {
results.push(standardObj);
}
}
// console.log(results)
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/estimize-questions.json', string);
await databaseUpsert(results, "estimize-questions");
}
//estimize()

View File

@ -191,8 +191,6 @@ async function hypermind_inner(cookie) {
// console.log(resultsTotal)
// console.log(resultsTotalUnique)
console.log(resultsTotalUnique.length, "results");
// let string = JSON.stringify(resultsTotalUnique, null, 2)
// fs.writeFileSync('./data/hypermind-questions.json', string);
await databaseUpsert(resultsTotalUnique, "hypermind-questions");
}
//hypermind()

View File

@ -1,8 +1,7 @@
/* Imports */
import axios from "axios";
import fs from "fs";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
/* Definitions */
let endpointPolitics = `https://ss-aka-ori.ladbrokes.com/openbet-ssviewer/Drilldown/2.31/EventToOutcomeForClass/302,301,300?simpleFilter=event.siteChannels:contains:M&simpleFilter=event.eventSortCode:intersects:TNMT,TR01,TR02,TR03,TR04,TR05,TR06,TR07,TR08,TR09,TR10,TR11,TR12,TR13,TR14,TR15,TR16,TR17,TR18,TR19,TR20&simpleFilter=event.suspendAtTime:greaterThan:${new Date().toISOString()}.000Z&limitRecords=outcome:1&limitRecords=market:1&translationLang=en&responseFormat=json&prune=event&prune=market`;
@ -137,9 +136,6 @@ let processResults = async (json) => {
export async function ladbrokes() {
let response = await fetchUrl(endpointPolitics);
let results = await processResults(response);
// console.log(results)
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/ladbrokes-questions.json', string);
await databaseUpsert(results, "ladbrokes-questions");
console.log("Done");
}

View File

@ -1,8 +1,7 @@
/* Imports */
import fs from "fs";
import axios from "axios";
import { calculateStars } from "../../utils/stars.js";
import { databaseUpsert } from "../../utils/database-wrapper.js";
import { calculateStars } from "../../utils/stars.js";
/* Definitions */
let graphQLendpoint = "https://api.thegraph.com/subgraphs/name/protofire/omen";
@ -92,9 +91,6 @@ async function fetch_all() {
/* Body */
export async function omen() {
let results = await fetch_all();
// console.log(result)
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/omen-questions.json', string);
await databaseUpsert(results, "omen-questions");
console.log("Done");
}

View File

@ -1,9 +1,7 @@
/* Imports */
import axios from "axios";
import fs from "fs";
import toMarkdown from "../utils/toMarkdown.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
/* Definitions */
let endpoint = "https://sports.williamhill.com/betting/en-gb/politics";
@ -142,8 +140,6 @@ export async function williamhill() {
"https://sports.williamhill.com/betting/en-gb/politics"
);
let results = processResults(response);
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/williamhill-questions.json', string);
await databaseUpsert(results, "williamhill-questions");
console.log(results.sort((a, b) => a.title > b.title));
console.log("Done");

View File

@ -1,8 +1,7 @@
/* Imports */
import fs from "fs";
import axios from "axios";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
/* Definitions */
let unixtime = new Date().getTime();
@ -115,9 +114,6 @@ async function processData(data) {
export async function fantasyscotus() {
let rawData = await fetchData();
let results = await processData(rawData);
//console.log(results)
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/fantasyscotus-questions.json', string);
await databaseUpsert({ contents: results, group: "fantasyscotus" });
console.log("Done");
}

View File

@ -1,8 +1,7 @@
/* Imports */
import fs from "fs";
import axios from "axios";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
/* Definitions */
let graphQLendpoint = "https://api.foretold.io/graphql";
@ -99,8 +98,6 @@ export async function foretold() {
results.push(result);
});
}
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/foretold-questions.json', string);
await databaseUpsert({ contents: results, group: "foretold" });
console.log("Done");

View File

@ -61,8 +61,6 @@ async function main1() {
// console.log(result)
results.push(result);
}
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/givewell-questions-unprocessed.json', string);
await databaseUpsert({
contents: results,
group: "givewell-questions-unprocessed",

View File

@ -1,12 +1,10 @@
/* Imports */
import axios from "axios";
import tunnel from "tunnel";
import fs from "fs";
import { Tabletojson } from "tabletojson";
import toMarkdown from "../utils/toMarkdown.js";
import { calculateStars } from "../utils/stars.js";
import { hash } from "../utils/hash.js";
import tunnel from "tunnel";
import { databaseUpsert } from "../database/database-wrapper.js";
import { hash } from "../utils/hash.js";
import { calculateStars } from "../utils/stars.js";
/* Definitions */
let endpoint = "https://goodjudgment.io/superforecasts/";
@ -119,8 +117,6 @@ export async function goodjudgment() {
}
// console.log(results.slice(0,10))
let string = JSON.stringify(results, null, 2);
// fs.writeFileSync('./data/goodjudgment-questions.json', string);
// fs.writeFileSync('./goodjudgment-questions-test.json', string);
console.log(results);
await databaseUpsert({ contents: results, group: "goodjudgment" });

View File

@ -218,8 +218,6 @@ async function goodjudgmentopen_inner(cookie) {
);
}
}
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/goodjudmentopen-questions.json', string);
console.log(results);
if (results.length > 0) {
await databaseUpsert({ contents: results, group: "goodjudmentopen" });

View File

@ -265,9 +265,6 @@ async function infer_inner(cookie) {
);
}
}
// let string = JSON.stringify(results,null, 2)
// fs.writeFileSync('./data/infer-questions.json', string);
// console.log(results)
if (results.length > 0) {
await databaseUpsert({ contents: results, group: "infer" });
} else {

View File

@ -1,19 +1,11 @@
/* Imports */
import fs from "fs";
import axios from "axios";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
/* Definitions */
let jsonEndpoint = "https://trading-api.kalshi.com/v1/cached/markets/"; //"https://subgraph-matic.poly.market/subgraphs/name/TokenUnion/polymarket"//"https://subgraph-backup.poly.market/subgraphs/name/TokenUnion/polymarket"//'https://subgraph-matic.poly.market/subgraphs/name/TokenUnion/polymarket3'
/* Support functions
async function fetchAllContractInfo(){ // for info which the polymarket graphql API
let data = fs.readFileSync("./data/polymarket-contract-list.json")
let response = JSON.parse(data)
return response
}
*/
async function fetchAllMarkets() {
// for info which the polymarket graphql API
let response = await axios
@ -80,9 +72,6 @@ async function processMarkets(markets) {
export async function kalshi() {
let markets = await fetchAllMarkets();
let results = await processMarkets(markets); // somehow needed
// console.log(results)
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('polymarket-questions.json', string);
await databaseUpsert({ contents: results, group: "kalshi" });
console.log("Done");

View File

@ -1,8 +1,7 @@
/* Imports */
import fs from "fs";
import axios from "axios";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
/* Definitions */
let endpoint = "https://manifold.markets/api/v0/markets";
@ -94,9 +93,6 @@ export async function manifoldmarkets() {
let data = await fetchData();
let results = await processPredictions(data); // somehow needed
showStatistics(results);
// console.log(results)
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('polyprediction-questions.json', string);
await databaseUpsert({ contents: results, group: "manifoldmarkets" });
console.log("Done");

View File

@ -189,8 +189,6 @@ export async function metaculus() {
i = i + 1;
}
// let string = JSON.stringify(all_questions, null, 2)
// fs.writeFileSync('./metaculus-questions.json', string);
await databaseUpsert({ contents: all_questions, group: "metaculus" });
console.log("Done");

View File

@ -1,21 +1,13 @@
/* Imports */
import fs from "fs";
import axios from "axios";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
/* Definitions */
let graphQLendpoint =
"https://api.thegraph.com/subgraphs/name/polymarket/matic-markets-5"; // "https://api.thegraph.com/subgraphs/name/polymarket/matic-markets-4"// "https://api.thegraph.com/subgraphs/name/tokenunion/polymarket-matic"//"https://subgraph-matic.poly.market/subgraphs/name/TokenUnion/polymarket"//"https://subgraph-backup.poly.market/subgraphs/name/TokenUnion/polymarket"//'https://subgraph-matic.poly.market/subgraphs/name/TokenUnion/polymarket3'
let units = 10 ** 6;
/* Support functions
async function fetchAllContractInfo(){ // for info which the polymarket graphql API
let data = fs.readFileSync("./data/polymarket-contract-list.json")
let response = JSON.parse(data)
return response
}
*/
async function fetchAllContractInfo() {
// for info which the polymarket graphql API
let response = await axios
@ -149,9 +141,6 @@ async function fetch_all() {
/* Body */
export async function polymarket() {
let results = await fetch_all();
// console.log(results)
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('polymarket-questions.json', string);
await databaseUpsert({ contents: results, group: "polymarket" });
console.log("Done");

View File

@ -1,9 +1,8 @@
/* Imports */
import fs from "fs";
import axios from "axios";
import toMarkdown from "../utils/toMarkdown.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import toMarkdown from "../utils/toMarkdown.js";
/* Support functions */
async function fetchmarkets() {
@ -107,9 +106,6 @@ export async function predictit() {
// console.log(obj)
results.push(obj);
}
//console.log(results)
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/predictit-questions.json', string);
await databaseUpsert({ contents: results, group: "predictit" });
console.log("Done");

View File

@ -1,21 +1,13 @@
/* Imports */
import fs from "fs";
import axios from "axios";
import toMarkdown from "../utils/toMarkdown.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import toMarkdown from "../utils/toMarkdown.js";
/* Definitions */
let jsonEndpoint =
"https://www.rootclaim.com/main_page_stories?number=100&offset=0"; //"https://subgraph-matic.poly.market/subgraphs/name/TokenUnion/polymarket"//"https://subgraph-backup.poly.market/subgraphs/name/TokenUnion/polymarket"//'https://subgraph-matic.poly.market/subgraphs/name/TokenUnion/polymarket3'
/* Support functions
async function fetchAllContractInfo(){ // for info which the polymarket graphql API
let data = fs.readFileSync("./data/polymarket-contract-list.json")
let response = JSON.parse(data)
return response
}
*/
async function fetchAllRootclaims() {
// for info which the polymarket graphql API
let response = await axios
@ -66,9 +58,6 @@ async function fetchAndProcessData() {
/* Body */
export async function rootclaim() {
let results = await fetchAndProcessData();
//console.log(JSON.stringify(results, null, 4))
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('rootclaim-questions.json', string);
await databaseUpsert({ contents: results, group: "rootclaim" });
console.log("Done");

View File

@ -1,9 +1,7 @@
/* Imports */
import fs from "fs";
import axios from "axios";
import toMarkdown from "../utils/toMarkdown.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
/* Definitions */
let htmlEndPointEntrance = "https://api.smarkets.com/v3/events/";
@ -174,8 +172,6 @@ export async function smarkets() {
}
VERBOSE ? console.log(results) : empty();
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/smarkets-questions.json', string);
await databaseUpsert({ contents: results, group: "smarkets" });
VERBOSE ? console.log(JSON.stringify(results, null, 4)) : empty();
VERBOSE ? console.dir(results, { depth: null }) : empty();

View File

@ -121,8 +121,6 @@ export async function wildeford_inner(google_api_key) {
let predictions = await fetchGoogleDoc(google_api_key);
let results = await processPredictions(predictions); // somehow needed
// console.log(results.sort((a,b) => (a.title > b.title)))
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('polyprediction-questions.json', string);
await databaseUpsert({ contents: results, group: "wildeford" });
console.log("Done");