From c27b5ddff589e59ad30163b0a9ca88ea4e802eec Mon Sep 17 00:00:00 2001 From: Greg Barnes Date: Tue, 10 Sep 2024 22:09:17 +0100 Subject: [PATCH] Adds back in DB instructions to the readme and comments out unused search functionality --- README.md | 18 ++++++++++++++++-- orp/orp_search/search.py | 26 +++++++++----------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 78a0109..48da582 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# orp +# Open Regulation Platform (ORP) ## Introduction @@ -7,7 +7,7 @@ The Open Regulation Platform (ORP) will provide a searchable and filterable list ## Getting Started The quickest way top get started is to use the `docker-compose` configuration -to run the application in a containerised environment. +to run the application and required `PostgreSQL` in a containerised environment. Most of the actions required to run and manage the application are encapsulated in the `Makefile`. First, in a working directory run: @@ -21,6 +21,14 @@ An example file is provided in the repository. Create one like this: This should work out of the box. +Create the initial database: + + $ make database + +> The `make database` command will create a `PostgreSQL` database. If you have +> an existing database and want to start from scratch, use `make drop-databse` +> to delete an existing database first. + Prepare the application for first use: $ make first-use @@ -55,6 +63,12 @@ On Mac you can run the following command to install `libpq`: - [`Python 3.12.*`](https://www.python.org/downloads/). Don't be tempted to use an earlier or later version of Python. Use Poetry to manage your Python version and dependencies. +- [`PostgreSQL`](https://www.postgresql.org/). Optionally you can install and + configure `PostgreSQL` on your local machine. However, be advised it's much + easier to use the `db` service provisioned by the `docker-compose` + configuration which is exposed on `localhost:5432`. Additionally, client + applications like `psql` and `pg_dump` are installed using the `libpq` + installation [prerequisite](#prerequisites) step above. - [`Docker Desktop`](https://docs.docker.com/get-docker/). A recent version (e.g. `4.30.0` or above) is recommended, which includes all the key components you'll require including `engine`, `build` and `compose`. diff --git a/orp/orp_search/search.py b/orp/orp_search/search.py index b75fb95..f5c1ec1 100644 --- a/orp/orp_search/search.py +++ b/orp/orp_search/search.py @@ -1,22 +1,14 @@ -from typing import Any +# from typing import Any -from core.dbt_data_api import DbtDataApi +# from core.dbt_data_api import DbtDataApi -DBT_DATA_API = DbtDataApi() +# DBT_DATA_API = DbtDataApi() -def search_data_api(search_query: str) -> dict[str, Any]: - """Search company reports. +# def search_data_api(search_query: str) -> dict[str, Any]: +# """Search regulations.""" - Takes a company search query and returns filtered results with report - counts. - - Returns a dictionary containing: - - results: List of filtered company results with report counts. - - request_exception: Any exception raised during the API request. - - truncated: Whether the results were truncated. - """ - data = DBT_DATA_API.search_regulations() - return { - "results": data, - } +# data = DBT_DATA_API.search_regulations() +# return { +# "results": data, +# }