This project is to define the database used in Open Chronology, its implementation, and provide some technical discussion in some of its topics.
There is a Dockerfile associated with this project, and it's easiest to
just follow the docker-compose.yml file:
./build-init.sh && docker compose --env-file .env upbuild-init.sh will generate a complete init.sh script to load the
extensions to PostgreSQL and also initialize the database with everything in
sql/. There is a slight order requirement between those SQL files - see the
build-init.sh script for details.
It will also build the cron-runner/ project with cargo - ensure you have
the Rust toolchain installed, as the binary is copied to the docker environment.
The cron-runner executable will run alongside the PostgreSQL and PostgREST
containers, as it will interact with the database to do routine actions.
Unline most websites and web servers, this Database needs to act as the authoritative figure in all things security. Most web servers use executive programming functionality (like PHP, .NET, Ruby, etc.) to accomplish web security - if we were to do that, there's no guarantee that excessive use of the database would be prevented, and we believe that encoding those usage requirements directly into the database is most effective.
This is accomplished by using PostgREST
as the HTTP-facing component, while PostgreSQL does all the heavy lifting
with schemas, row-layer security, CHECK cluases and other constraints,
stored procedures, and view tables.
All time is on the Rational number plane
Viewing the timeline could be seen as a 2-dimensional pagination system:
- left and right pagination is captured by the left and right bounds of the viewing window, where "scrubbing" (changing the offset) of the window would cause entries on the timeline to go in and out of the visible window.
- in and out pagination is done by "summarizing" the entries that are closer together than a specific "threshold" value, returning simply a count of entries that are beyond comprehensible view.
| Term | Definition |
|---|---|
| Window | View of a timeline, bounded by a left-bound |
| Time Point | A single instance on the timeline, with time value being a rational number in |
| Summary | A manually-entered human readable summary instance, with an optional left-bound |
| General Summary | A summary generated by the current window, not definted by anyone. This allows the user to see what isn't currently visible based on the current zoom level. It has a left-bound |
| Threshold | A distance between points, measured as |
| Precision | A percentage of the window size, between |
The test suite uses rust as a client for the PostgREST server - to run it, simply execute
cd tests/ && ./run-tests.shwhile the docker-compose suite is running.