b3v21 / bigdataenergy

Planning / Simulation tool for public transport networks that will be used for the Brisbane Olympics in 2032. This is a project for the course "DECO3801" at UQ.
2 stars 0 forks source link

Initial Setup

  1. setup & activate a python venv if you haven't already
  2. Begin by running pip install -r requirements.txt in the root directory to install all dependencies.

Database Setup

  1. enter backendsrc directory and run python manage.py migrate
  2. run python manage.py runserver
  3. good to go! (username and password are 'root' if you wish to access the admin panel)

How to update the structure of the database

  1. python manage.py showmigrations. This lists the current migrations.
  2. python manage.py makemigrations. This creates a new autogenerated migration file according to the updated schema.
  3. python manage.py migrate. This applies a migration which is currently unapplied (updates the database)

(https://www.django-rest-framework.org/tutorial/quickstart/)

FYI: If db changes have been made and you are unable to apply any new migrations just run makemigrations, this will generate any neccecary migrations, and then these can be applied. This problem will occur if someone updates the db structure without generating and commiting new migrations for their changes. Another way to do this is just delete the files in ./db/migrations that are numbered (0001_... etc) and you should be able to remigrate. This might happen now and again to to multiple people edited the db and forgetting to migrate before pushing each time (you ).

Frontend Setup

  1. ensure you have Node version 18 installed check using
    node -v

Using Script

  1. In the root directory, run the following command to run the frontend installer
    cat frontend-setup.sh | bash

    If you see a permission denied error, run:

    chmod +x frontend-setup.sh

    to give the script execution permissions, then try running the script again.

Manual Setup

If the script fails, please follow the following steps:

  1. Change to the frontend directory
    cd frontend
  2. Install dependencies
    npm install
  3. Build the app
    npm run build
  4. Run tha app
    npm run start -p 3000

Open http://localhost:3000 with your browser to see the result.

Local Viewing

In order to test locally with the frontend and backend communicating simply run both commands in separate terminal windows to run the backend and frontend local servers, and navigate to the frontend at http://localhost:3000 with your browser to see the result. Since the backend server is also running it will communicate with the frontend locally.

Dependent Data

Translink SEQ GTFS Data: https://www.data.qld.gov.au/dataset/general-transit-feed-specification-gtfs-seq/resource/be7f19e5-3ee8-4396-b9eb-46f6b4ce8039

Reused Software

Please see requirements.txt for the backend software and source links. For frontend software: @hookform/resolvers: https://www.npmjs.com/package/@hookform/resolvers @radix-ui/react-alert-dialog: https://www.npmjs.com/package/@radix-ui/react-alert-dialog @radix-ui/react-avatar: https://www.npmjs.com/package/@radix-ui/react-avatar @radix-ui/react-checkbox: https://www.npmjs.com/package/@radix-ui/react-checkbox @radix-ui/react-context-menu: https://www.npmjs.com/package/@radix-ui/react-context-menu @radix-ui/react-dialog: https://www.npmjs.com/package/@radix-ui/react-dialog @radix-ui/react-dropdown-menu: https://www.npmjs.com/package/@radix-ui/react-dropdown-menu @radix-ui/react-hover-card: https://www.npmjs.com/package/@radix-ui/react-hover-card @radix-ui/react-icons: https://www.npmjs.com/package/@radix-ui/react-icons @radix-ui/react-label: https://www.npmjs.com/package/@radix-ui/react-label @radix-ui/react-menubar: https://www.npmjs.com/package/@radix-ui/react-menubar @radix-ui/react-navigation-menu: https://www.npmjs.com/package/@radix-ui/react-navigation-menu @radix-ui/react-popover: https://www.npmjs.com/package/@radix-ui/react-popover @radix-ui/react-progress: https://www.npmjs.com/package/@radix-ui/react-progress @radix-ui/react-select: https://www.npmjs.com/package/@radix-ui/react-select @radix-ui/react-separator: https://www.npmjs.com/package/@radix-ui/react-separator @radix-ui/react-slot: https://www.npmjs.com/package/@radix-ui/react-slot @radix-ui/react-switch: https://www.npmjs.com/package/@radix-ui/react-switch @radix-ui/react-tabs: https://www.npmjs.com/package/@radix-ui/react-tabs @radix-ui/react-toast: https://www.npmjs.com/package/@radix-ui/react-toast @radix-ui/react-tooltip: https://www.npmjs.com/package/@radix-ui/react-tooltip @tanstack/react-query: https://www.npmjs.com/package/@tanstack/react-query @types/node: https://www.npmjs.com/package/@types/node @types/react: https://www.npmjs.com/package/@types/react @types/react-dom: https://www.npmjs.com/package/@types/react-dom autoprefixer: https://www.npmjs.com/package/autoprefixer axios: https://www.npmjs.com/package/axios class-variance-authority: https://www.npmjs.com/package/class-variance-authority clsx: https://www.npmjs.com/package/clsx cmdk: https://www.npmjs.com/package/cmdk eslint: https://www.npmjs.com/package/eslint eslint-config-next: https://www.npmjs.com/package/eslint-config-next lucide-react: https://www.npmjs.com/package/lucide-react next: https://www.npmjs.com/package/next next-themes: https://www.npmjs.com/package/next-themes plotly.js: https://www.npmjs.com/package/plotly.js postcss: https://www.npmjs.com/package/postcss react: https://www.npmjs.com/package/react react-dom: https://www.npmjs.com/package/react-dom react-hook-form: https://www.npmjs.com/package/react-hook-form react-plotly.js: https://www.npmjs.com/package/react-plotly.js tailwind-merge: https://www.npmjs.com/package/tailwind-merge tailwindcss: https://www.npmjs.com/package/tailwindcss tailwindcss-animate: https://www.npmjs.com/package/tailwindcss-animate typescript: https://www.npmjs.com/package/typescript zod: https://www.npmjs.com/package/zod