schemedoc / srfi-metadata

Import SRFI metadata into the Scheme API
https://docs.scheme.org/srfi/support/
MIT License
10 stars 2 forks source link

A dynamic page accepting queries #9

Open jpellegrini opened 4 years ago

jpellegrini commented 4 years ago

Well... It may be quite some work to do, but a dynamic page that lets you enter queries would be nice.

(srfi :implementations gauche guile stklos
      :keyword syntax  ;; the keywords used in srfi.schemers.org
      :status final
      :order-by quantity-implementations)

would return the SRFIs matching the criteria, ordered by the number of implementations (SRFIs with more totalimplementations - not only those three -- show up on the top). order-by could also be sequential, or keyword.

(implementation :srfi 2 13 64
                :order-by quantity)

would return implementations with those SRFIs, ordered by number of supported SRFIs.

:order-by could accept stable-age (age of last stable release); quantity (or total supported SRFIs, not only those in the query); alphabetical; implementation-age (time since first release ever).

Maybe other data, if possible. If the implementation has a github repository, one could also order by "team size", "commit frequency", "total commit volume in last 12 months", "source code size"...

And... This could actually be a library, loadable from Scheme implementations (hence the Schemish syntax proposed).

Does this make sense,or did my coffee not make effect yet?

lassik commented 4 years ago

It makes a lot of sense. We talked about this a lot last year, and it would make sense to have api.scheme.org which provides a GraphQL endpoint for arbitrary queries about Scheme stuff. GraphQL has already solved all these problems about constructing queries, is widely used and remarkably elegant for web technology. We could add an alternative S-expression syntax for GQL (it gives JSON output by default, and uses a query language that looks a lot like JSON).

Here's what we have so far: https://api.staging.scheme.org/

If you follow the "GraphQL endpoint" link, it takes you to a playground where you can type stuff like this:

{
  reports {
    id
    documents {
      id
      errata_corrected_pdf_url
    }
  }
}

Ctrl+space for autocomplete.

lassik commented 4 years ago

Here's a WIP GraphQL server in Chicken: https://github.com/lassik/graphql-chicken

lassik commented 4 years ago

One reason I've been trying to encourage having automated scripts to gather information into S-expression files in schemedoc, is that those scripts and S-expressions would be easy to plug into the API server once it is functional.

jpellegrini commented 4 years ago

So this issue would then stay and wait for that?

lassik commented 4 years ago

Sounds good.

We could also make a separate API just for SRFIs. But it seems it would be just as easy to do one API for everything.

The server running at that staging host is a proof of concept in Node.js. I can add a quick SRFI listing to it based on this repo and srfi-data.scm if you want to play with some queries.

lassik commented 4 years ago

@jpellegrini Are you personally interested in writing code like this? The API doesn't have to be just my project; I'll gladly share the workload with others.

We have server space and lots of ideas and connections. The main missing ingredient is time and energy to do everything :)

jpellegrini commented 4 years ago

Hi @lassik - I woud like to, but I think I am already involved in too many things (STklos, Geiser-STklos, translation of darktable, a math book and some personal coding projects). I may take a look and contribute slowly if that's ok.

lassik commented 4 years ago

I understand :) I have the same problem... By all means, it is perfectly ok.

erkin commented 3 years ago

We can, alternatively, generate JS code from, say, BiwaScheme to filter the table on the front-end. Just an idea.

lassik commented 3 years ago

Or concede to use a couple lines of ordinary JS if it's just a simple filter :) The SRFI website uses a little JS for that purpose.