Skip to content

Commit 906ee95

Browse files
Merge pull request #126 from VineetBala-AOT/main
Updating the readme for condition repository
2 parents 383df8b + 40051fb commit 906ee95

File tree

6 files changed

+154
-68
lines changed

6 files changed

+154
-68
lines changed

README.md

Lines changed: 54 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,58 @@
1-
## Installation
1+
# EPIC.conditions
2+
A project for the Environmental Assessment Office to manage conditions required for a certificate
23

3-
1. Clone the repository:
4-
5-
`git clone https://github.com/bcgov/EPIC.conditions`
4+
Condition Repository is an online application designed to extract, store, and present environmental assessment conditions from PDF documents.
65

7-
`cd EPIC.conditions`
8-
6+
### Key Benefits
7+
- **Conditions Repository**: A single repository providing access to all conditions across multiple projects
8+
- **Consolidated Conditions View**: Enables viewing of all conditions for a project, including amendments to the original condition documents, in a unified format
99

10-
2. Set up a virtual environment:
11-
12-
`python -m venv venv`
10+
## Condition Repository Setup Instructions
1311

14-
3. Activate the virtual environment:
15-
- On Windows:
16-
17-
`venv\Scripts\activate`
18-
- On Linux/MacOS:
19-
20-
`source venv/bin/activate`
12+
This document outlines the setup instructions for both the backend and front-end components of the project. Ensure you follow the steps in sequence for a smooth setup.
2113

22-
4. Install the required packages:
23-
24-
`pip install -r requirements.txt`
14+
## Backend Setup
15+
See [API Application Readme](condition-api/README.md)
16+
17+
## Front End Setup
18+
See [Web Application Readme](condition-web/README.md)
2519

26-
5. Create a file named `.env` in the root directory of the project and add your OpenAI API key:
27-
```text
28-
OPENAI_API_KEY=openai_api_key_here
29-
```
3020

3121
## Usage
3222

3323
### Individual PDFs:
3424

35-
Follow the [condition-parser README](./condition-parser) to extract info and get a JSON.
36-
37-
Follow the [condition-lib README](./condition-lib) to add the extracted JSON to the PostgreSQL database.
25+
### Extracting conditions and related details from PDF documents
26+
See [Data Extractor Readme](condition-parser/README.md)
3827

39-
*Note: gradio_ui.py in this directory is depreciated.*
28+
### Importing extracted conditions into the database
29+
See [Data Loader Readme](condition-loader/README.md)
4030

4131
### Multiple PDFs (Batch Processing):
42-
43-
See [batch processing README](./batch_api_calling).
32+
See [Batch Processing README](./batch_api_calling).
4433

4534
For verifying the output of a batch, see [manual verification README](./batch_api_calling/manual_verification/).
4635

36+
*Note: gradio_ui.py in this directory is depreciated.*
37+
38+
## Directory Structure
39+
40+
.github/ - PR, CI action workflows and Issue templates
41+
/docs - Miscellaneous documentations
42+
condition-web/ - Condition Web application root
43+
└── src/ - React.js application
44+
condition-api/ - Condition API Application Root
45+
├── src/ - Python flask application
46+
│ └── met_api/ - Models, Resources and Services
47+
└── migrations - Database migration scripts
48+
└── tests/ - API application tests
49+
└── unit/ - Python unit tests
50+
condition-loader/ - Module for loading extracted conditions into the database
51+
├── condition_jsons/ - Collection of extracted condition JSON files
52+
└── loadConditions - Script for importing the extracted conditions into the database
53+
condition-parser/ - Module for extracting conditions and related details from PDF documents.
54+
openshift/ - OpenShift templates and documentation
55+
LICENSE - License
4756

4857
## Demo
4958
[![Condition extractor demo](https://github.com/user-attachments/assets/a25b0093-b04b-4ddb-89cd-153ddaa582cd)](https://bcgov.sharepoint.com/:b:/t/04612/EYzyqtlP82BJt8ocy2AISNwBwiS-2BgJ23NqRZts-Nn6jw?e=CM1Nt3)
@@ -57,3 +66,19 @@ For verifying the output of a batch, see [manual verification README](./batch_ap
5766
- [OpenAI function calling documentation](https://platform.openai.com/docs/guides/function-calling)
5867
- [OpenAI API reference](https://platform.openai.com/docs/api-reference/chat)[.](https://github.com/user-attachments/assets/cac337de-097d-4bfb-b946-56b98a2f1e1d)
5968

69+
70+
## License
71+
72+
Copyright © 2024 Province of British Columbia
73+
74+
Licensed under the Apache License, Version 2.0 (the "License");
75+
you may not use this file except in compliance with the License.
76+
You may obtain a copy of the License at
77+
78+
http://www.apache.org/licenses/LICENSE-2.0
79+
80+
Unless required by applicable law or agreed to in writing, software
81+
distributed under the License is distributed on an "AS IS" BASIS,
82+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
83+
See the License for the specific language governing permissions and
84+
limitations under the License.

condition-api/README.md

Lines changed: 67 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,80 @@ A condition Python flask API application to be used as a template.
44

55
## Getting Started
66

7-
### Development Environment
8-
* Install the following:
9-
- [Python](https://www.python.org/)
10-
- [Docker](https://www.docker.com/)
11-
- [Docker-Compose](https://docs.docker.com/compose/install/)
12-
* Install Dependencies
13-
- Run `make setup` in the root of the project (condition-api)
14-
* Start the databases
15-
- Run `docker-compose up` in the root of the project (condition-api)
7+
## Backend Setup in WSL
168

17-
## Environment Variables
9+
## Step 1. Install Python 3.12.4
10+
Ensure Python 3.12.4 is installed in your WSL environment. Download it from the [official Python website](https://www.python.org/downloads/release/python-3124/).
1811

19-
The development scripts for this application allow customization via an environment file in the root directory called `.env`. See an example of the environment variables that can be overridden in `sample.env`.
12+
## Step 2. Set Up PYTHONPATH
13+
Add the following line to your `.bashrc` or `.zshrc` file to set the `PYTHONPATH` environment variable:
14+
export PYTHONPATH="/path/to/condition-api:${PYTHONPATH}"
2015

21-
## Commands
16+
## Step 3. Configure Environment Variables
17+
Create a `.env` file in your condition-api with the necessary configurations. Reference sample.env to see what variables you need to configure
2218

23-
### Development
19+
## Step 4. Start Docker Compose
20+
In a separate terminal, launch Docker Compose to set up your containers:
21+
docker-compose up
2422

25-
The following commands support various development scenarios and needs.
26-
Before running the following commands run `. venv/bin/activate` to enter into the virtual env.
23+
## Step 5. Run Setup
24+
Navigate to your project directory and run the setup command to prepare your development environment:
25+
make setup
2726

27+
## Step 6. Run Server
28+
Once the setup is completed use make run to start the server:
29+
make run
2830

29-
> `make run`
30-
>
31-
> Runs the python application and runs database migrations.
31+
32+
## Backend Setup on Windows
33+
34+
## Step 1: Download the Latest Python Version
35+
36+
1. Visit the official Python website: [Python Downloads](https://www.python.org/downloads/)
37+
2. Download and install the latest version of Python for your operating system.
38+
39+
40+
## Step 2: Set Environment Variables
41+
42+
1. Set the `FLASK_APP` and `FLASK_ENV` environment variables:
43+
- set FLASK_APP=app.py
44+
- set FLASK_ENV=development
45+
46+
2. Configure `PYTHONPATH` to your project's folder location up to `condition-api/src`:
47+
- set PYTHONPATH=path\to\condition-api\src && PYTHONPATH=path\to\condition-api
48+
49+
## Step 3: Start Docker
50+
51+
1. Open a terminal.
52+
2. Navigate to the `condition-api` directory:
53+
cd condition-api
54+
55+
3. Run the following command to start the services using Docker Compose:
56+
docker-compose up
57+
58+
## Step 4: Set Up `condition-api`
59+
60+
1. Open a separate terminal.
61+
62+
2. Navigate to the `` directory:
63+
cd condition-api
64+
65+
3. Create a virtual environment. Refer to the official Python documentation on how to create a virtual environment: [Python venv](https://docs.python.org/3/library/venv.html).
66+
- python -m venv venv
67+
68+
4. Activate the virtual environment:
69+
- venv\Scripts\activate
70+
71+
5. Install the required Python packages from both `dev.txt` and `prod.txt` requirements files:
72+
- python -m pip install -r path/to/requirements/dev.txt
73+
- python -m pip install -r path/to/requirements/prod.txt
74+
75+
6. Run your Flask app using the Flask CLI:
76+
- python -m flask run -p 5000
77+
78+
79+
Runs the python application and runs database migrations.
3280
Open [http://localhost:5000/api](http://localhost:5000/api) to view it in the browser.<br/>
33-
> The page will reload if you make edits.<br/>
34-
> You will also see any lint errors in the console.
3581

3682
> `make test`
3783
>
@@ -45,6 +91,4 @@ Open [http://localhost:5000/api](http://localhost:5000/api) to view it in the br
4591

4692
### Visual Studio Code
4793

48-
Ensure the latest version of [VS Code](https://code.visualstudio.com) is installed.
49-
50-
The [`launch.json`](.vscode/launch.json) is already configured with a launch task (CONDITION-API Launch) that allows you to launch chrome in a debugging capacity and debug through code within the editor.
94+
Ensure the latest version of [VS Code](https://code.visualstudio.com) is installed.

condition-parser/README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
## Installation
1+
# CONDITION-PARSER
22

3-
1. Clone the repository:
3+
Gradio application for extracting conditions and related details from PDF documents.
4+
5+
## Getting Started
6+
7+
## Step 1. Clone the repository:
48

5-
`git clone https://github.com/bcgov/EPIC.conditions`
9+
- `git clone https://github.com/bcgov/EPIC.conditions`
610

7-
`cd condition-parser`
11+
- `cd condition-parser`
812

913

10-
2. Set up a virtual environment:
14+
## Step 2. Set up a virtual environment:
1115

12-
`python -m venv venv`
16+
- `python -m venv venv`
1317

14-
3. Activate the virtual environment:
18+
## Step 3. Activate the virtual environment:
1519
- On Windows:
1620

1721
`venv\Scripts\activate`
1822
- On Linux/MacOS:
1923

2024
`source venv/bin/activate`
2125

22-
4. Install the required packages:
26+
## Step 4. Install the required packages:
2327

24-
`pip install -r requirements.txt`
28+
- `pip install -r requirements.txt`
2529

26-
5. Create a file named `.env` in the root directory of the project and add your OpenAI API key:
30+
## Step 5. Create a file named `.env` in the root directory of the project and add your OpenAI API key:
2731
```text
2832
OPENAI_API_KEY=openai_api_key_here
2933
```
3034

31-
## Usage
32-
33-
### Individual PDFs:
34-
35-
Run the gradio UI by executing the following command in the root of the directory (/condition-parser):
35+
## Step 6. Run the gradio UI by executing the following command in the root of the directory (/condition-parser):
3636

37-
`python gradio_ui.py`
37+
- `python gradio_ui.py`

condition-web/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# CONDITION-WEB
2+
3+
## Getting Started
4+
5+
### 1. Navigate to Front End Directory
6+
Change to the front-end directory:
7+
cd condition-web
8+
9+
### 2. Install Dependencies
10+
Install necessary npm packages:
11+
npm install
12+
13+
### 3. Run Development Server
14+
Launch the development server:
15+
npm run dev
16+
17+
118
# React + TypeScript + Vite
219

320
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
505 KB
Loading

docs/Condition_Repository_Flow.png

41.2 KB
Loading

0 commit comments

Comments
 (0)