Ethisim is a website that allows you to easily create and assign ethics simulations. Run them for a participation grade, or develop them further into longer discussions for class.
main
and build-and-deploy
branches will trigger a GitHub Action that builds the static application and deploys it to the server.Follow instructions in the Shibboleth Install Guide
You can find the list of endpoints here: Editor Backend, Simulator Backend
npm install
. This should install all dependencies (if not, install modules manually using npm install <module>
)npm start
to run the development build at localhost:3000/moral_kombat_backend/
and install the Django packages using pip install -r requirements.txt
/moral_kombat_backend/lead/
and run python manage.py runserver
Running Repository Locally
cd ./simulator/frontend
npm install
npm start
. This should open a tab in your browser and direct you to http://localhost:3000
. If not, open a browser tab and go to that url. NOTE: We suggest putting data into the database and running it at the same time as the simulator frontend. This will allow the simulator to actually load in data.1) Be sure that python3 is installed and in the Environment Variable (Pip works better for Django than Conda)
2) Clone the project to your machine git clone https://github.com/david-fisher/320-S21-Track2.git
3) Navigate to the "320-S21-Track2\segfault" folder in terminal and install the dependencies (django, djangorestframework, and psycopg2) by running pipenv shell
then pipenv install -r requirements.txt
("requirements.txt" has django, djangorestframework, and psycopg2. The versions of those might change in the future, so you can update this txt file with the new versions if you want)
4) If there have been changes made to the database, run python manage.py makemigrations
then python manage.py migrate
(It is harmless to run these even if there haven't been any database changes)
5) Make sure you're connected the correct database (Done through "320-S21-Track2\segfault\segfault", refer to Django documentation for more details)
6) Run the server python manage.py runserver
( The default port is at localhost:8000, this can be changed through python manage.py runserver 0.0.0.0:<port number>
)
7) To access the endpoints, put "/api" after the "localhost:8000" in the URL
Install postgreSQL:
https://www.postgresql.org/download/
Add PostgreSQL/[version, either 12 or 13]/bin
and PostgreSQL/[version, either 12 or 13]/lib
to PATH (on Windows) or make it an environment variable on Mac/Linux
in command prompt or terminal, call psql -U postgres -f [full filepath to database_setup.sql]
.
note: The file database_setup.sql
can currently be found in the erd-implementation
branch in the database
folder.**
Since django is not compatible with composite keys, we made an ID column which is the primary key, and every column that was a part of the original composite key now is unique.
Everything in the DB is functional. No backlogs; nothing left to complete on our end as of now.
The editor backend is located in the Moral Kombat Backend
folder.
The main files to take note of are the [models.py](http://models.py)
,
[serials.py](http://serials.py)
, views.py
and the [urls.py](http://urls.py)
.
[models.py](http://models.py)
- this file is used to represent the database schema on our backend so we can properly modify our data in the database
[serializer.py](http://serializer.py)
- This file is used to stitch our code in the views.py to our code in the models.py
[urls.py](http://urls.py)
- This file is where we store the routes that our endpoints can be accessed.
[views.py](http://views.py)
- This is where you store the logic behind all the views and how it all works
students: links to demographics, student_times, responses and students_to_courses and stores the information of the student (spire id is primary key).
demographics: links to students and stores information regarding student demographics.
Professors: Any non-student staff member is stored here, has a professor column (spire id) and name columns.
Scenarios: links a scenario to issues, stakeholders, professors, pages, courses, responses, and student_times. Documents all relevant information about the version of a scenario.
courses: links to professors_to_courses, students_to_course, scenarios_for and responses and stores information regarding a course.
Professors_to_courses: Links professors/staff to a course that they teach.
Professors_to_scenario: links professors to scenarios. Documents what professor(s) have access to certain scenarios and what permissions they have.
students_to_course: links students to courses.
Student_times: links students to courses and scenarios. Documents date/time a scenario was taken.
Pages: links responses, scenarios, action_page, generic_page, reflection_questions, and stakeholder_to_page. Documents all relevant information of every frontend page of a scenario.
Pages_to_scenario: links pages to scenarios.
Responses: Stores a student’s response to a page. Documents all information regarding the student’s responses/decisions in a page.
Stakeholders: links scenarios, stakeholder_to_page, conversations, response_to_conversations. Documents relevant information about a stakeholder.
Questions: stores all relevant information about a question asked by a stakeholder.
stakeholders_to_questions: links questions to stakeholders.
Reflections_taken: links a reflection to a response.
Issues: links scenarios to coverage. Documents issue name and stores importance scores associated with a specific scenario.
Coverage: Links stakeholder to an issue with a coverage score. Links to stakeholder.
conversations: links to stakeholders and documents what conversations stakeholders have. Stores a question and answer between a student and a stakeholder.
Responses_to_conversations: Links a response to a conversation.
reflection_questions: links to pages and has questions to reflect.
reflection_questions_to_page: links questions to reflect to a page.
Stakeholder_to_page: links stakeholder to a page.
Generic_page: page that has text to display.
Action_page: Page where the user gets to select a choice.
Response_to_action_page: links a response to an action page.
Scenarios_for: links scenarios and courses. Documents what course a scenario is for.
Courses_to_scenario: Links courses (and therefore course staff) to a scenario with a certain permission level (0=read vs 1=read and write)