Skip to content

Commit

Permalink
Adds back in DB instructions to the readme and comments out unused se…
Browse files Browse the repository at this point in the history
…arch functionality
  • Loading branch information
gdbarnes committed Sep 10, 2024
1 parent fdfee09 commit c27b5dd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# orp
# Open Regulation Platform (ORP)

## Introduction

Expand All @@ -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:

Expand All @@ -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
Expand Down Expand Up @@ -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`.
Expand Down
26 changes: 9 additions & 17 deletions orp/orp_search/search.py
Original file line number Diff line number Diff line change
@@ -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,
# }

0 comments on commit c27b5dd

Please sign in to comment.