@bfi-digital/sight-and-sound
v0.4.0
Published
Client library for the BFI Polls API service, featuring Sight and Sound results data.
Downloads
27
Readme
Polls Results Service
An HTTP API service that exposes Sight and Sound poll data, built in PHP and Laravel.
Requires Composer 2.4, PHP 8.1 (with sqlite3 module php8.1-sqlite3
), SQLite 3.
To run code coverage you should also have XDebug installed (pecl install xdebug
)
Development Setup
Clone the repository, then install dependencies using composer install
.
Create your environment file using cp .env.example .env
.
Find the URL for FILMS_TV_PEOPLE_ORIGIN
from Confluence (just the protocol and host part of the URL are needed). Enter this value in your .env
file.
Create the sqlite database with touch database/database.sqlite
.
Run database migrations using php artisan migrate
.
Create an application key: php artisan key:generate
.
Next you will need to ingest the results, voters and votes CSV files as exported from the D7 Sight and Sound polls service. The votes.example.csv
file consists of all first choice votes from all voters which is 10% of the total number of votes cast during the poll and takes around 10mins to ingest.
Begin the ingest process:
php artisan ingest-results results.example.csv
php artisan ingest-voters voters.example.csv
php artisan ingest-votes votes.example.csv
Start the development server: php artisan serve
.
To run tests: php artisan test
To run code coverage: XDEBUG_MODE=coverage php artisan test --coverage
. You can add the --min
flag to require a minimum coverage threshold.
Node Client
This repository also contains the NodeJS client library used to access the poll data. To install it in another project:
npm install @bfi-digital/sight-and-sound
Development
For testing the node client, Node 18 is required.
To publish the library, you'll need to create a github client token and log in to the github package registry.
Before you can publish, contact Iain who will need to add you to the @bfi-digital npm organisation.
Once you've been added, you can then publish as normal with npm publish
.