{"id":20038728,"url":"https://github.com/defra/flood-risk-back-office","last_synced_at":"2025-05-05T07:32:20.211Z","repository":{"id":36444993,"uuid":"55597863","full_name":"DEFRA/flood-risk-back-office","owner":"DEFRA","description":"Provides back office functionality to the Flood Risk service","archived":false,"fork":false,"pushed_at":"2024-10-28T15:22:50.000Z","size":6951,"stargazers_count":2,"open_issues_count":12,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-10-28T17:36:18.896Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DEFRA.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-06T10:45:08.000Z","updated_at":"2024-10-28T15:21:32.000Z","dependencies_parsed_at":"2023-11-27T16:50:24.274Z","dependency_job_id":"87cb703d-3e3f-4e37-9bb8-33a79f701630","html_url":"https://github.com/DEFRA/flood-risk-back-office","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fflood-risk-back-office","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fflood-risk-back-office/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fflood-risk-back-office/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fflood-risk-back-office/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DEFRA","download_url":"https://codeload.github.com/DEFRA/flood-risk-back-office/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224431712,"owners_count":17310188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T10:32:20.637Z","updated_at":"2024-11-13T10:32:21.283Z","avatar_url":"https://github.com/DEFRA.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flood risk back office\n\n![Build Status](https://github.com/DEFRA/flood-risk-back-office/workflows/CI/badge.svg?branch=main)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=DEFRA_flood-risk-back-office\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=DEFRA_flood-risk-back-office)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=DEFRA_flood-risk-back-office\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=DEFRA_flood-risk-back-office)\n[![Licence](https://img.shields.io/badge/Licence-OGLv3-blue.svg)](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3)\n\nA Ruby on Rails application delivering the [Flood risk activity exemptions service](https://register-flood-risk-exemption.service.gov.uk).\n\nThis is a thin, host application which mounts and provides styling for the [flood_risk_engine](https://github.com/DEFRA/flood-risk-engine) rails engine, and adds functionality specific to internal users. The engine is responsible for the service implementation.\n\n## Prerequisites\n\nPlease make sure the following are installed:\n\n- [Ruby 3.2.2](https://www.ruby-lang.org) installed for example via [RVM](https://rvm.io) or [Rbenv](https://github.com/sstephenson/rbenv/blob/master/README.md)\n- [Bundler](http://bundler.io/)\n- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)\n- [Postgresql](http://www.postgresql.org/download)\n- [Phantomjs](https://github.com/teampoltergeist/poltergeist#installing-phantomjs)\n\n## Installation\n\nClone the repository and install its gem dependencies\n\n```bash\ngit clone https://github.com/DEFRA/flood-risk-back-office.git\ncd flood-risk-back-office\nbundle\n```\n\n### .env\n\nThe project uses the [dotenv](https://github.com/bkeepers/dotenv) gem to load environment variables when the app starts. **Dotenv** expects to find a `.env` file in the project root.\n\nDuplicate `.env.example` and rename the copy as `.env`\n\nOpen it and update `SECRET_KEY_BASE` and the settings for database, email etc.\n\n### Database\n\nThe usual rails commands can be used to manage the databases for example\n\n```bash\nbundle exec rake db:create\nbundle exec rake db:migrate\nbundle exec rake db:seed\n```\n\nAdd `RAILS_ENV=test` to the commands when preparing the test database.\n\n### Geospatial Queries\n\nThe application uses [PostGIS](https://postgis.net/) [rgeo](https://rubygems.org/gems/rgeo) for geospatial queries. The [activerecord-postgis-adapter](https://github.com/rgeo/activerecord-postgis-adapter) gem adds geospatial datatypes to PotgreSQL and supports geospatial queries. The adapter is enabled by defining the database adapter as `postgis` instead of `postgresql` in `database.yml`:\n\n```\nadapter: postgis\n```\n\nThe application also uses [rgeo-geojson](https://github.com/rgeo/rgeo-geojson) to parse an Environment Agency dataset of Water Management Area boundaries. A copy of the dataset is stored in JSON format in a zip archive under `lib/fixtures/files` and loaded using the once-off Rake task `load_admin_areas`.\n\nNote that postgis is also required when running automated unit tests within GitHub CI. To support this, `ci.yml` specifies the use of a docker image which runs `PostgreSQL` with the `postgis` adapter:\n\n```\nimage: postgis/postgis:10-2.5\n```\n\n## Running the app\n\nTo start the service locally run\n\n```bash\nbundle exec rails s\n```\n\nYou can then access the web site at http://localhost:3000\n\n## GOV.UK Notify\n\nThe project uses [Notify](https://www.notifications.service.gov.uk/using-notify/get-started) to send email. It does this using Notify's [web API](https://docs.notifications.service.gov.uk/ruby.html). The key difference is that the templates for all emails are stored in Notify. Any mailer views found in the project code are there purely as reference to what the Notify templates contain and to allow us to replicate the email body.\n\n### Intercepting email in development\n\nYou can use [Mailcatcher](https://mailcatcher.me/) to intercept emails sent out during development.\n\nMake sure you have the following in your `.env` or `.env.development` file:\n\n    EMAIL_USERNAME=''\n    EMAIL_PASSWORD=''\n    EMAIL_APP_DOMAIN=''\n    EMAIL_HOST='localhost'\n    EMAIL_PORT='1025'\n\nInstall **Mailcatcher** (`gem install mailcatcher`) and run it by just calling `mailcatcher`\n\nThen navigate to [http://127.0.0.1:1080](http://127.0.0.1:1080) in your browser.\n\n\u003e Note that [mail_safe](https://github.com/myronmarston/mail_safe) maybe also be running in which case any development email will seem to be sent to your global git config email address.\n\n## Users and roles\n\nBeing a back office system you need to have a valid user account to access it. It also features different roles which have different levels of access to the features in the system.\n\n### Roles\n\nThe following roles exist\n\n| Name                       | Symbol       | Description  |\n|----------------------------|--------------|---|\n| System user                | :system      | Can do anything including inviting new users. |\n| Administrative super user  | :super_agent | Approve or reject registrations. Edit all registrations. Export data. |\n| Administrative user        | :admin_agent | View, edit in-progress registrations and add new. |\n| Data user                  | :data_agent  | Can only search, view and export registrations. |\n\n### Seeded users\n\nWhen seeding the development environment databases a number of generic accounts (one per role) will created for you.\n\nThe email for each is in the format of **[symbol]_user@example.gov.uk**, and the password for all is **Abcde12345**.\n\nSo for example the login for the data user is\n\n- email **data_agent_user@example.gov.uk**\n- password **Abcde12345**\n\n## Tests\n\nWe use [RSpec](http://rspec.info/) and the project contains both feature and unit tests which focus on the functionality added specifically for internal users. Unit testing for the application process is generally done in [flood _risk_engine](https://github.com/DEFRA/flood-risk-engine) and acceptance tests in [Flood risk acceptance tests](https://github.com/DEFRA/flood-risk-acceptance-tests).\n\nTo run the rspec test suite\n\n```bash\nbundle exec rake\n```\n\n## Contributing to this project\n\nIf you have an idea you'd like to contribute please log an issue.\n\nAll contributions should be submitted via a pull request.\n\n## License\n\nTHIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:\n\nhttp://www.nationalarchives.gov.uk/doc/open-government-licence/version/3\n\nThe following attribution statement MUST be cited in your products and applications when using this information.\n\n\u003e Contains public sector information licensed under the Open Government license v3\n\n### About the license\n\nThe Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable information providers in the public sector to license the use and re-use of their information under a common open licence.\n\nIt is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fflood-risk-back-office","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefra%2Fflood-risk-back-office","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fflood-risk-back-office/lists"}