Closed NunoSempere closed 2 years ago
It's already available! All pages are implemented on top of GraphQL API.
You'll have to enter variables in the bottom box, e.g. {"id": "rootclaim-did-pakistan-know-that-osama-bin-laden-was-hiding-in-abbottabad-18034"}
(Yoga playground doesn't allow links with variables).
Here's how to trace the graphql call(s) for any metaforecast page:
getServerSideProps
; in this case, this oneclient.query
call; in this case, QuestionPageDocument
QuestionPageDocument
comes from queries.graphql.generated
file, so you'll need a matching queries.graphql filequeries.graphql
file can include fragments; in this case, it includes QuestionWithHistory
fragment, which is defined in src/web/fragments.graphql; you can find it with search, or, if you have your graphql plugin for vscode set up properly, you could just "go to definition"It's already available!
Are you sure? I specifically mean new questions added in the last 24h. And I'm not sure we have any pages which fetch that.
Oh, I read this wrong! I thought you meant (new (question page))
, the one with charts.
Right now we store a timestamp
field on Question
and History
(and on dashboards, but that's not relevant here).
This field usually means "last time we fetched/stored this question", except for guesstimate, for which we use the timestamp from the guesstimate API. But we can ignore the guesstimate case for this task, since it's used for search only, and this task is for querying the postgres database directly, which doesn't have guesstimate data yet.
Anyway.
I think we need more timestamp fields with different semantics.
fetched
or lastFetched
or maybe lastSeen
(with semantics ~identical to current timestamp
)firstSeen
(by metaforecast; this field is necessary for solving this issue)created
(on platform; this might be different from firstSeen
since metaforecast can fetch the question with some delay)updated
(by platform; this one is less necessary and is too vague; while many platforms provide something like this, their semantics differ, and we could approximately restore this from our history data)resolved
(important for #10)There are a lot of details to consider for each of these, but for now I'll just implement (1) and (2) and keep in mind (3) and (5) for the future database & API changes.
Notes:
FIRST_SEEN_DESC
is currently the only supported value for orderBy
; if orderBy
is not specified then ordering is arbitrary (I think it's ordered lexicographically by id, but I hope no one would rely on that because it can change in the future)fetched
and firstSeen
; I also added firstSeenStr
and fetchedStr
for convenience
fetched
, e.g. fetched(format: "iso")
, since GraphQL requires any field to have a single typenameStr
instead of nameISO
so that we could add other date string formats with args in the futurefetched
is present both in questions
and in history
, while firstSeen
is present only in questions
timestamp
field is deprecated; I'm going to remove it from the database immediately and will remove it from the GraphQL schema soonfirstSeen
fields with values based on history
tableAwesome!
Hey @berekuk, could you add a new questions page to the API? Not extremely urgent, but good to have in the next few days