From 3c7a468835dfd2254b58dbfe3eab8388acea957a Mon Sep 17 00:00:00 2001 From: Rob Nichols Date: Wed, 8 Jan 2025 15:19:44 +0000 Subject: [PATCH] Update README following removal of Airtable code. --- README.md | 50 +++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index f24760c..214bb65 100644 --- a/README.md +++ b/README.md @@ -2,41 +2,53 @@ This application provides a Register of Information sharing agreements under chapters 1, 2, 3 and 4 of part 5 of the Digital Economy Act 2017. -## Airtable data +## Data source -The source data is stored in an Airtable base store. The specific base is specified via a -[Personal Access Token](https://airtable.com/developers/web/api/authentication). -See the AirTableApi service object for how this token is stored. +The data source is a [rAPId](https://rapid.readthedocs.io/) application. For access the following credentials need to +be passed into the matching environment variables: + +| Credential | Environment Variable | +| ------------- | -------------------- | +| Client ID | RAPID_CLIENT_ID | +| Client Name | RAPID_CLIENT_NAME | +| Client Secret | RAPID_CLIENT_SECRET | ### Local store -The main models in this application inherit from an `AirTable` class and are types of that class. So their data is -stored in a single table: `air_tables`. +The main models in this application inherit from a `DataTable` class and are types of that class. So their data is +stored in a single table: `data_tables`. Most of the data specific to a particular model is stored in the `fields` attribute. This is a JSON object that -holds the original data pulled from the Airtable source. This arrangement was chosen to lesson the likelihood that -a change in the Airtable would break the application. If a field in the source Airtable is changed (specifically +holds the original data pulled from the data source. This arrangement was chosen to lesson the likelihood that +a change in the source data would break the application. If a field in the source is changed (specifically renamed) the data will no longer be displayed, but it should not break the application. ### Population -An Airtable model can be populated by calling its class method `populate`. This method is defined on the root `AirTable` +A data model can be populated by calling its class method `populate`. This method is defined on the root `DataTable` class. Join tables are used to manage the associated between models. These have their own `populate` class methods which are defined on each of the models -Database seeding runs `populate` of all these models and populates their tables: +Database seeding runs `populate` on all these models and populates their tables: rails db:seed -If the database is empty, this will populate the tables with the current data in the Airtable. If the database -is already populated, this process will update the data to match the current data. This includes deleting any -records that have been deleted from Airtable. +If the database is empty, this will populate the tables with the current data in from the data source. + +If the database is already populated, this process will update the data to match the current data. This includes deleting any records that have been deleted from the data source. + +Seeding also rebuilds the search database. In production this task is run via a cron job and ensures that the application is regularly synchronised with the source data. +In staging a button is available on the home page that allows the population task to be triggered from the home page. +This task is carried out via a delayed job and for it to run there must be a worker running. This is done so that the +web interface is not frozen while the population task is running. In production, the cron job runs in a separate +space so does not need to be run via delayed job. + ### Search Searching is provided by the Postgres search tool PgSearch. See the Search Controller for details. @@ -47,7 +59,10 @@ Before this application will run successfully locally, the following actions wil - Obtain the current master.key and save it in `/config`. Or set up a new Rails credentials containing: - airtable_api_key: [Airetable Personal Access Token] + rapid: + client_id: [a client id] + client_name: [a client name] + client_secret: [a client secret] - Run `yarn` to set up the JavaScript environment - Run 'rake dartsass:build' to build application.css @@ -62,11 +77,8 @@ This application is hosted in Heroku for staging, and is set to deploy automatic ## Production -This application is containerised via docker, for use in production. To run the container use: - - AIRTABLE_API_KEY=[airtable_api_key] RAILS_MASTER_KEY=[random uuid] docker-compose up --build - -Where `[airtable_api_key]` is the airtable Personal Access Token (see above) +This application is hosted in Heroku for production. Promotion of merged code is done manually. The staging and +production instances are within a pipeline (cddo-dea-register-pipeline) and both instances can be managed from within the pipeline. ## Contacts