Skip to content

lasalasa/astap_model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASTAPM (Aviation Safety Trends Analysis and Predictive Model)

Setup Environment

1. Create a Virtual Environment (VM)

py -3.11 -m venv python_modules

2. Activate the Virtual Environment

Windows:

python_modules\Scripts\activate

macOS/Linux:

source python_modules/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Setup Environment Variables

  • Rename .env.sample to .env.
  • Update BASE_CONN and BASE_CONN_ASYNC with the correct database credentials.

5. Restore Initial SQL Database

mysql -u [username] -p < scripts/init_db.sql

6. Reactivate Virtual Environment (if needed)

To deactivate and reactivate:

deactivate

Windows:

python_modules\Scripts\activate

macOS/Linux:

source python_modules/bin/activate

Start Service

Running Notebooks

Step 1: Run LS Model

notebooks/notebook_main_LS.ipynb

Step 2: Run LSTM_ASRS Model

notebooks/notebook_main_LSTM_ASRS.ipynb

Step 3: Run LSTM_NTSB Model

notebooks/notebook_main_LSTM_NTSB.ipynb

Step 4: Run LSTM_ASRS_NTSB Model

notebooks/notebook_main_LSTM_ASRS_NTSB.ipynb

Running Web Service

Step 1: Start the Web Server

uvicorn main:app --reload

Step 2: Extract Data for ASRS (ds_id=1)

curl -X 'POST' \
  'http://0.0.0.0:8000/data-sources/extracts/1' \
  -H 'accept: application/json' \
  -d ''

Step 3: Extract Data for NTSB (ds_id=2)

curl -X 'POST' \
  'http://0.0.0.0:8000/data-sources/extracts/2' \
  -H 'accept: application/json' \
  -d ''

Step 4: Load Data for ASRS (ds_id=1)

curl -X 'POST' \
  'http://0.0.0.0:8000/data-sources/loads/1' \
  -H 'accept: application/json' \
  -d ''

Step 5: Load Data for NTSB (ds_id=2)

curl -X 'POST' \
  'http://0.0.0.0:8000/data-sources/loads/2' \
  -H 'accept: application/json' \
  -d ''

Step 6: Run LS Model Notebook

notebooks/notebook_main_LS.ipynb

Step 7: Access Dashboard and Simulate

http://0.0.0.0:8000/dashboard/simulator

Freeze Dependencies

To save installed dependencies into requirements.txt:

pip freeze > requirements.txt

Project Structure

ASTAPM/
│
├── data/
│   ├── local_ex/
│   └── local_im/
│
├── src/
│   ├── core/
│   ├── extensions/
│   ├── modules/
│   │   ├── __init__.py
│   │   ├── dependencies.py
│   │   ├── exceptions.py
│   │   ├── models.py
│   │   ├── router.py
│   │   ├── schemas.py
│   │   ├── service.py
│   ├── data_source/
│   │   ├── __init__.py
│   │   ├── dependencies.py
│   │   ├── exceptions.py
│   │   ├── models.py
│   │   ├── router.py
│   │   ├── schemas.py
│   │   ├── service.py
│   ├── __init__.py
│   ├── config.py
│   ├── constant.py
│   ├── database.py
│   ├── app.py
│
├── tests/
├── notebooks/
├── web/
│
├── .gitignore
├── README.md
└── requirements.txt

Notes

  • Ensure the .env file is correctly set up before running the application.
  • MySQL database must be running and accessible.
  • The API server runs on http://0.0.0.0:8000 by default.
  • The system processes both ASRS and NTSB data for aviation safety trend analysis.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published