|
1 | 1 | # Master's Thesis Project
|
2 | 2 |
|
3 |
| -This repository contains the code for my Master's Thesis Project. The project is a FastAPI application that will allow users to upload files, it will then process the files and load the data into a PostgresDB, S3 and return the data to the user. The application is built using the FastAPI framework and uses SQLModel to create the database models. The application is built using a Dev Container which will allow the application to be run locally and in Github Codespaces. |
4 |
| - |
5 |
| -Project Organization |
6 |
| ------------- |
7 |
| - |
8 |
| - ├── LICENSE |
9 |
| - ├── README.md <- The top-level README for developers using this project. |
10 |
| - ├── assets <- Images used in the README.md file |
11 |
| - | |
12 |
| - ├── .devcontainer <- Folder for the devcontainer configuration files and Dockerfile & Docker Compose files |
13 |
| - │ ├── Dockerfile <- Dockerfile for the devcontainer |
14 |
| - │ ├── devcontainer.json <- Devcontainer configuration file |
15 |
| - │ └── docker-compose.yml <- Docker Compose file for the devcontainer |
16 |
| - │ |
17 |
| - ├── data |
18 |
| - │ ├── external <- Data from third party sources. |
19 |
| - │ ├── interim <- Intermediate data that has been transformed. |
20 |
| - │ ├── processed <- The final, canonical data sets for modeling. |
21 |
| - │ └── raw <- The original, immutable data dump. |
22 |
| - │ |
23 |
| - ├── notebooks <- Jupyter notebooks. |
24 |
| - │ |
25 |
| - ├── reports <- Generated analysis as HTML, PDF, LaTeX, etc. |
26 |
| - │ └── figures <- Generated graphics and figures to be used in reporting. |
27 |
| - | └── template.tex <- To compile the LaTeX document into a PDF report, ensure that the PDFs generated in "figures" are placed in the same directory as main .tex file. |
28 |
| - │ |
29 |
| - ├── app <- Source code for use in this project. |
30 |
| - │ ├── __init__.py <- Makes app a Python module |
31 |
| - | ├── main.py <- Main application file for FastAPI application |
32 |
| - │ ├── api <- Configuration file for FastAPI application |
33 |
| - | | ├── api_v1 |
34 |
| - | | | ├── __init__.py <- Makes api_v1 a Python module |
35 |
| - | | | ├── upload.py <- API endpoint for uploading data |
36 |
| - | | | └── restaurants.py <- API endpoint for restaurants an example endpoint if we wanted to extend the application |
37 |
| - │ │ └── api.py <- API endpoints for the application |
38 |
| - │ │ |
39 |
| - │ ├── crud <- The CRUD (Create, Read, Update, Delete) operations folder for the application |
40 |
| - │ │ ├── base.py <- Base CRUD operations |
41 |
| - | | ├── __init__.py <- Makes crud a Python module |
42 |
| - | | └── crud_restaurants.py <- CRUD operations for restaurants an example object if we wanted to extend the application |
43 |
| - │ │ |
44 |
| - │ ├── schema <- Folder for the SQLModel models for the application |
45 |
| - │ │ ├── restaurant.py <- SQLModel model for restaurants an example object if we wanted to extend the application |
46 |
| - | | └── __init__.py <- Makes schema a Python module |
47 |
| - | | |
48 |
| - │ │ |
49 |
| - │ └── utils <- Scripts to import data and create the database |
50 |
| - │ ├── config.py <- Configuration file for the application that loads the environment variables |
51 |
| - │ └── deps.py <- Dependency file for the application that creates the database connection |
52 |
| - │ |
53 |
| - ├── requirements.txt <- The requirements file for reproducing the analysis environment, e.g. |
54 |
| - │ generated with `pip freeze > requirements.txt` |
55 |
| - └── env.example <- Environment variables for the application |
56 |
| - |
57 |
| --------- |
58 |
| - |
59 |
| - |
60 |
| -Using Dev Containers we were able to create a Docker container that will automatically install the requirements.txt file and create a PostgresDB instance. This will allow us to run the application locally and in Github Codespaces. You can learn more about Dev Containers here: <https://code.visualstudio.com/docs/remote/containers> |
61 |
| - |
62 |
| -# Set Up Instructions |
63 |
| - |
64 |
| -## Github Codespaces |
65 |
| - |
66 |
| -If you are running the application in Github Codespaces it should Automatically build the application and install the ```requirements.txt``` file. if not run the following command in the terminal: |
| 3 | +This repository contains the code for my Master's Thesis Project. The project is a FastAPI application that allows users to upload files, processes the files, and loads the data into a PostgresDB and S3. The application is built using the FastAPI framework and utilizes SQLModel to create the database models. It is designed to be run locally and in Github Codespaces using Dev Containers. |
67 | 4 |
|
68 |
| -```bash |
69 |
| -pip install -r requirements.txt |
70 |
| -``` |
| 5 | +## Project Organization |
71 | 6 |
|
72 |
| -## Local Machine |
| 7 | +I used the Microsoft devcontainer FastAPI & NodeJS + Typescript template for this project. You can read more about it (here)[https://code.visualstudio.com/remote/advancedcontainers/connect-multiple-containers]. The template is organized as follows: |
73 | 8 |
|
74 |
| -1. Ensure you have Docker installed on your local machine, if not follow the instructions here: <https://docs.docker.com/get-docker/> |
| 9 | +## Setup Instructions |
75 | 10 |
|
76 |
| -2. Clone the repository to your local machine |
77 |
| - ```git clone https://github.com/Butch78/Bank-Size-Central-Bank-Sensitivity.git``` |
| 11 | +### Github Codespaces |
78 | 12 |
|
79 |
| -3. After you open the project, the following pop-up should appear. Click "Reopen in Container" |
| 13 | +If you are running the application in Github Codespaces, it will automatically build the application and install the `requirements.txt` file. If not, run the following command in the terminal: |
80 | 14 |
|
81 |
| - |
| 15 | +```bash |
| 16 | +pip install -r requirements.txt |
| 17 | +``` |
| 18 | + |
| 19 | +### Local Machine |
82 | 20 |
|
83 |
| -If not click the green button in the bottom left corner and then select "Reopen in Container" |
| 21 | +1. Ensure you have Docker installed on your local machine. If not, follow the instructions here: [Docker Documentation](https://docs.docker.com/get-docker/). |
84 | 22 |
|
85 |
| -This will build the Docker container and install the requirements.txt file automatically along with creating a PostgresDB instance. |
| 23 | +2. Clone the repository to your local machine: |
86 | 24 |
|
87 |
| -# Start Application Command |
| 25 | + ```bash |
| 26 | + git clone https://github.com/Butch78/Bank-Size-Central-Bank-Sensitivity.git |
| 27 | + ``` |
88 | 28 |
|
89 |
| -rename the ```.env.example``` file to ```.env``` |
| 29 | +3. After opening the project, a pop-up should appear. Click "Reopen in Container". If the pop-up doesn't appear, click the green button in the bottom left corner and select "Reopen in Container". This will build the Docker container, install the `requirements.txt` file, and create a PostgresDB instance. |
90 | 30 |
|
91 |
| -Then the following command will load the Data into the PostgresDB and start a FastAPI application on port 8000, You can view the API documentation at <http://localhost:8000/docs> |
| 31 | +## Starting the Application |
| 32 | + |
| 33 | +To load the data into the PostgresDB and start the FastAPI application on port 8000, run the following command: |
92 | 34 |
|
93 | 35 | ```bash
|
94 | 36 | uvicorn app.main:app --reload
|
95 | 37 | ```
|
| 38 | + |
| 39 | +You can view the API documentation at [http://localhost:8000/docs](http://localhost:8000/docs). |
| 40 | + |
| 41 | +## Recommended IDE Setup |
| 42 | + |
| 43 | +For the best development experience, it is recommended to use the following IDE setup: |
| 44 | + |
| 45 | +- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) |
| 46 | + |
| 47 | +## Customize Configuration |
| 48 | + |
| 49 | +For customizing the application configuration, refer to the [Vite Configuration Reference](https://vitejs.dev/config/). |
| 50 | + |
| 51 | +## Project Commands |
| 52 | + |
| 53 | +- `npm install`: Install project dependencies. |
| 54 | +- `npm run dev`: Compile and hot-reload for development. |
| 55 | +- `npm run build`: Type-check, compile, and minify for production. |
| 56 | +- `npm run test:unit`: Run unit tests with Vitest. |
| 57 | +- `npm run lint`: Lint with ESLint. |
| 58 | +- `docker buildx build . -t vitesse:latest`: Docker production build. |
| 59 | + |
| 60 | +For more details, refer to the project's documentation. |
0 commit comments