-
Hello Observable Framework community! I'm building a Framework dashboard page for a CS2 team I have with friends, and I would like to get your help on approaches for implementing incremental data loaders. My main goal in this scenario is minimizing the number of external API requests, and I'm thinking data loaders with an incremental approach would be most suitable since I can leave behind requests about data we already have (older matches details). But I'm not sure how to implement it and I haven't found anything related to that in the docs/discussions. I don't have concrete solutions, but draft ideas on how to do it: My first thought would be to leave the data as a static file and update it every time before deploy (as a kind of separate build process for this data specifically). A second approach I thought would be to have the data loader effectively providing part of the data (the profile stats), but then indirectly changing another static file with the matches information (similar to the previous one, but would't require running scripts outside the build process). Although I have the feeling neither of these are good uses of Framework nor file versioning. What are your thoughts or approaches on how to build incremental data loaders in Framework? It might be an overkill for my specific scenario, but it does sound like something useful to learn for future endeavor so I deemed worth wile to ask around here. I immensely appreciate the help!! Appendix: some context about my case and personal thoughtsThe basic data retrieval processThe data comes from the Leetify's app public API.
Here's a simple sketch highlighting it. Current thoughts and options
Implementation approachesOption 1 seems simple enough (I built a draft in a notebook, although I have to study more about CORS to have it running smoothly inside Framework). Option 2 seems straightforward with zip archives or a DuckDB file. Option 3 is about the discussion above. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Here's an incremental data loader, which uses Framework's own cache if present and appends a line to it.
Of course you an do something more interesting when you read it—here I'm just piping it straight back to framework with the additional line. To run it again and generate a newer version, I only need to run (Note that I'm using the new source root location |
Beta Was this translation helpful? Give feedback.
Here's an incremental data loader, which uses Framework's own cache if present and appends a line to it.
Of course you an do something more interesting when you read it—here I'm just piping it straight back to framework with the additional line.
To run it again and generate a newer version, I only need to run
touch src/incremental.csv.js
.(Note that I'm using the new source root location
src
—you might need to replace t…