Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ashanan/datasette-knightlab-timeline

Datasette plugin for creating timelines with TimelineJS
https://github.com/ashanan/datasette-knightlab-timeline

datasette-plugin timelinejs

Last synced: 11 days ago
JSON representation

Datasette plugin for creating timelines with TimelineJS

Awesome Lists containing this project

README

        

# datasette-knightlab-timeline

[![PyPI](https://img.shields.io/pypi/v/datasette-knightlab-timeline.svg)](https://pypi.org/project/datasette-knightlab-timeline/)
[![Changelog](https://img.shields.io/github/v/release/ashanan/datasette-knightlab-timeline?include_prereleases&label=changelog)](https://github.com/ashanan/datasette-knightlab-timeline/releases)
[![Tests](https://github.com/ashanan/datasette-knightlab-timeline/workflows/Test/badge.svg)](https://github.com/ashanan/datasette-knightlab-timeline/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/ashanan/datasette-knightlab-timeline/blob/main/LICENSE)

A Datasette plugin to create timelines using the TimelineJS library.

## Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-knightlab-timeline

## Usage

Add a `datasette-knightlab-timeline` object to the metadata plugins section.

```json
{
"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'))"
}]
}
}
}

```

## Development

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