greenelab / word-lapse

Explore how a word changes over time
https://greenelab.github.io/word-lapse/
Other
6 stars 3 forks source link

Add corpus selection dropdown to frontend #34

Closed falquaddoomi closed 2 years ago

falquaddoomi commented 2 years ago

What's Done

The API now supports querying two corpora, abstracts and fulltext. By default abstracts are queried, but you can use the corpus= argument to the /neighbors and /neighbors/cached endpoints to specify the fulltexts corpus.

For example, https://api-wl.greenelab.com/neighbors?tok=pandemic&corpus=fulltexts queries the fulltexts corpus for pandemic. You can check if a term is cached via https://api-wl.greenelab.com/neighbors/cached?tok=pandemic&corpus=fulltexts.

Querying for a corpus that doesn't exist will produce the following HTTP code 400 response:

{
  "detail": "Requested corpus 'bogus' not in corpus set ('abstracts', 'fulltexts')"
}

The set of corpora currently supported can be found in the config.CORPORA_SET subkey at the server meta endpoint, i.e. https://api-wl.greenelab.com/.

What Needs to be Done

The frontend should support some way to choose the corpus and pass the selected corpus to the relevant endpoints.