A Datasette plugin to create timelines using the TimelineJS library.
Install this plugin in the same environment as Datasette.
datasette install datasette-knightlab-timeline
Add a datasette-knightlab-timeline
object to the metadata plugins section.
{
"title": "This is the top-level title in metadata.json",
"plugins": {
"datasette-knightlab-timeline": {
"databases": [{
"database": "database_one",
"query": "SELECT date_measured as start_date, text FROM measurement_event WHERE date_measured > (SELECT DATETIME('now', '-30 day'))"
}, {
"database": "inaturalist",
"query": "SELECT created_at as start_date, 'Nature observation! Observed ' || species_guess || '.' AS text FROM observations WHERE created_at > (SELECT DATETIME('now', '-30 day'))"
}]
}
}
}
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-knightlab-timeline
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest