Skip to content

Commit

Permalink
Simplify dev setup, update README
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanjbrown committed Apr 12, 2024
1 parent b68deff commit 76a19c5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 31 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ setup_dev_db: ## Set up the development db on a local postgres

.PHONY: reset_dev_db
reset_dev_db: ## Reset the dev db
dropdb consultations_dev
-dropdb consultations_dev
$(MAKE) setup_dev_db

.PHONY: setup_test_db
Expand Down Expand Up @@ -70,6 +70,9 @@ govuk_frontend: ## Pull govuk-frontend
dummy_data: ## Generate a dummy consultation. Only works in dev
poetry run python manage.py generate_dummy_data

.PHONY: dev_environment
dev_environment: reset_dev_db migrate reset_test_db govuk_frontend ## set up the database with dummy data and configure govuk_frontend

# Docker
AWS_REGION=eu-west-2
APP_NAME=consultations
Expand Down
64 changes: 34 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,57 @@
# Consultation Analyser

This project is currently at prototyping stage.

The Consultation Analyser is an AI-powered tool to automate the processing of public consultations.
The Consultation analyser is a machine learning and LLM-powered tool to automate the processing of public consultations.

## Setting up the application

### External dependencies

- PostgreSQL (`brew install postgresql`)
- GraphViz (`brew install graphviz`), for generating diagrams

### Environment variables

Populate `.env` by copying `.env.example` and filling in required values.

Ensure you have `python > 3.10` and `poetry` installed.
### Python

Ensure you have `python > 3.10` and `poetry` installed, then run `poetry install`.

### Database setup

```
poetry install
make dev_environment
```

### Database
This will set up dev and test databases with dummy data. See the definition of that make task for the various steps.

Assuming local postgres:
Confirm everything is working with

```
# dev
make setup_dev_db
make check_db
```

(You can see all the available `make` commands by running bare `make` or `make help`).

### Run the application

# test
make setup_test_db
```
make serve
```

Confirm it works with
### Run the tests

```
make check_db
make test
```

(You can see all the available `make` commands by running bare `make` or `make help`).
## The database

### Generating dummy data

Only run this in development. Will create a consultation with 10 complete responses in a variety of question formats.
Only run this in development. Will create a consultation with 10 complete
responses in a variety of question formats. This runs as part of `make
dev_environment`, but you can run it more than once.

```
make dummy_data
Expand All @@ -51,8 +66,7 @@ you can run `manage.py generate_erd`. (You will need `graphviz` installed: see

![](docs/erd.png)

### Frontend

### The frontend

#### CSS

Expand All @@ -76,22 +90,12 @@ for our CSS so it can be cached.

#### Fonts and images

The govuk assets are versioned in the `npm` package. On initial app setup you will need to run `make govuk_frontend` to copy them to the `frontend` folder from where `runserver` can serve them.
The govuk assets are versioned in the `npm` package. On initial app setup you
will need to run `make govuk_frontend` to copy them to the `frontend` folder
from where `runserver` can serve them.

We’ll revisit this process when we deploy the app.

### Run the application

```
make serve
```

### Run the tests

```
make test
```

## Schema documentation

The data schema for consultations supplied to the tool is defined in `consultation_analyser/consultations/public_schema/public_schema.yaml`.
Expand Down

0 comments on commit 76a19c5

Please sign in to comment.