Skip to content

Commit 2e82612

Browse files
committed
Added files
0 parents  commit 2e82612

File tree

1,782 files changed

+634861
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,782 files changed

+634861
-0
lines changed

.github/workflows/backend-ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Backend CI
2+
3+
on:
4+
push:
5+
paths:
6+
- 'backend/**'
7+
pull_request:
8+
paths:
9+
- 'backend/**'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: '3.9'
21+
22+
- name: Install Python dependencies
23+
run: |
24+
cd backend
25+
pip install -r requirements.txt
26+
27+
- name: Run backend tests
28+
run: |
29+
cd backend
30+
pytest

.github/workflows/frontend-ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Frontend CI
2+
3+
on:
4+
push:
5+
paths:
6+
- 'src/**'
7+
pull_request:
8+
paths:
9+
- 'src/**'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Install Node.js
19+
uses: actions/setup-node@v2
20+
with:
21+
node-version: '14'
22+
23+
- name: Install npm dependencies
24+
run: |
25+
cd src
26+
npm install
27+
28+
- name: Run frontend tests
29+
run: |
30+
cd src
31+
npm test -- --coverage

.gitignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
__pycache__/
3+
4+
# dependencies
5+
/node_modules
6+
/.pnp
7+
.pnp.js
8+
9+
# testing
10+
/coverage
11+
.coverage
12+
13+
# production
14+
/build
15+
16+
# misc
17+
.DS_Store
18+
.env.local
19+
.env.development.local
20+
.env.test.local
21+
.env.production.local
22+
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# custom
28+
.vscode
29+
/model/data/*
30+
!/model/data/geojson
31+
/model/inputs/
32+
.R*
33+
.vscode
34+
/backend/flask_session
35+
36+
# Ignore data files
37+
data/*
38+
!data/png-images
39+
40+
# Ignore all TIFFs
41+
*.tif
42+
43+
# Ignore model input/output
44+
model/input
45+
model/output
46+
47+
# Ignore all TeX files except .tex and .pdf
48+
/techdoc/*
49+
!techdoc/tech-doc.pdf
50+
!techdoc/tech-doc.tex
51+
backend/app/base.py

.here

Whitespace-only changes.

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Dockerfile for the front end of the application.
2+
3+
# Start with the Node.js 18 Alpine image
4+
FROM node:18-alpine
5+
6+
# Set the working directory to /app
7+
WORKDIR /app
8+
9+
# Copy package.json and package-lock.json (if available)
10+
COPY package*.json ./
11+
12+
# Install dependencies listed in package.json
13+
# Include specific additional packages needed for the project
14+
RUN npm install && \
15+
npm install d3 && \
16+
npm install react-cookie && \
17+
npm install leaflet react-leaflet leaflet-arrowheads leaflet-polylinedecorator && \
18+
npm install --save-dev @testing-library/react @testing-library/jest-dom jest-fetch-mock && \
19+
npm install --save-dev @testing-library/jest-dom
20+
21+
22+
23+
# Copy the rest of the application
24+
COPY . .
25+
26+
# The application is started with npm start
27+
# This should keep the container running as it launches the app
28+
ENTRYPOINT ["npm", "start"]

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Usage
2+
3+
## Prerequisites
4+
5+
Your terminal should be running commands in the root directory of this project.
6+
7+
Ensure that your terminal supports both `pip` and `npm` commands.
8+
9+
## Starting the backend
10+
```
11+
pip install -r backend/requirements.txt
12+
fastapi dev backend/app/base.py
13+
```
14+
- Access docs by navigating to ```localhost:8000/docs``` on your web browser
15+
- To run the backend for debugging purposes, run ```uvicorn backend.app.base:app --reload``` in your terminal.
16+
- Note that this only runs the backend. It can not be navigated to on the web browser, nor will documentation be available.
17+
18+
## Starting the frontend
19+
20+
```
21+
npm install
22+
npm start
23+
```
24+
- These commands should install all required packages for the webpage, as well as start the frontend. The webpage should automatically open in your default browser under the tab "Birdmig".
25+
- This process may take a few minutes.
26+
27+
# To run Docker with all applications
28+
- Ensure that the Docker daemon is running
29+
- Opening the Docker desktop app is the easiest way to ensure this step
30+
- Build and run the containers with the command: ```docker-compose up -d --no-deps --build```
31+
- Go to ```http://localhost:3000``` to observe changes.
32+
33+
# Running React Tests
34+
This project uses [Jest](https://jestjs.io/) alongside [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro) for testing React components.
35+
36+
## Prerequisites
37+
38+
Before running tests, make sure you have:
39+
40+
- Node.js installed on your system.
41+
- All the project dependencies installed. If you haven't done so already, you can install them by running `npm install` in the project's root directory.
42+
43+
## Running All Tests
44+
45+
To run all the tests in the project, you can use the following command:
46+
47+
```sh
48+
npm test
49+
```
50+
51+
Running Tests with Coverage
52+
To run tests and generate a coverage report, you can use the following command:
53+
54+
```sh
55+
npm test -- --coverage
56+
```
57+
This will not only test your components but also provide a detailed report of your test coverage.
58+
59+
## Writing New Tests
60+
Test files are located alongside the components they are testing, with a `.test.js` or `.test.jsx` file extension. For example, if you have a component in `src/components/MyComponent.js`, its tests should be in `src/components/MyComponent.test.js`.
61+

backend/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Use a Python base image
2+
FROM python:3.9-slim
3+
4+
# Set the working directory in the container to /code
5+
WORKDIR /code
6+
7+
# Install system dependencies for GEOS, pip, and building Python packages
8+
# Including gcc, musl-dev for compiling, and libgeos-dev for Shapely
9+
RUN apt-get update && \
10+
apt-get install -y gcc musl-dev libgeos-dev
11+
12+
# Install numpy first to avoid conflicts
13+
RUN pip install numpy
14+
RUN pip install scikit-learn
15+
16+
# Copy the requirements.txt file to the container
17+
COPY requirements.txt .
18+
19+
# Install dependencies listed in requirements.txt
20+
RUN pip install -r requirements.txt
21+
22+
# Copy the entire backend directory to the container
23+
COPY . .
24+
25+
# Ensure the data directory is properly copied
26+
COPY app/data/ /code/data/
27+
28+
COPY app/models/ /code/models/
29+
30+
# Expose the port the app runs on
31+
EXPOSE 8000
32+
33+
# Command to run the application
34+
CMD ["fastapi", "dev", "base.py"]

backend/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Running Tests:
2+
Write all tests for the backend in the ```tests``` directory.
3+
4+
With pytest installed, you can run tests from the command line with the following command:
5+
6+
```pytest tests/```
7+
8+
And if you want to include coverage reports:
9+
```pytest --cov=app/```
10+

backend/app/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)