Show the complexity of seemingly simple issues by embedding an interactive Decision Tree.
This project is the actual code for creating a Decision Tree. To include one of the pre-made Decision Trees on your website,
Tables don't use abbreviations. Use full words: i.e. element
good, el
bad
Columns can use abbreviations if they're consistent across all tables. elID
is fine.
Id fields should be prefixed with the Id it relates to. So, table tree
with id
column, bad. Table tree
with treeID
, good.
There are triggers (go to phpmyadmin tables, select "triggers" tab) set-up to automatically set the current time for the createdAt
column when a row is inserted. The updatedAt
fields are already set to CURRENT_TIMESTAMP ON UPDATE
. This way, we don't have to pass any updatedAt
or createdAt
values from our application.
When running sql SELECT
, only interact with the view
s:
treeColumn
treeQuestion
treeOption
treeEnd
Actually, you can interact directly with the tree
table... But for the others, SELECT
from the view.
Naming follows conventions of general REST architecture:
- GET /trees returns all trees
- POST /trees creates a new tree
- GET /trees/{{treeID}} returns that tree
- PATCH /trees/{{treeID}} updates that tree
- DELETE /trees/{{treeID}} deletes that tree
GET /trees GET /trees/1 GET /trees/1/questions GET /trees/1/questions/2 GET /trees/1/questions/2/options GET /trees/1/questions/2/options/3 GET /trees/1/ends GET /trees/1/ends/4 GET /trees/1/groups GET /trees/1/groups/5
POST /interactions GET /interactions GET /interactions/1 GET /interactions/types GET /interactions/types/1 GET /interactions/types/load
GET /states/types/2 GET /states/types/question
/trees/1/embeds /trees/1/embeds/2
/sites /sites/1 /sites/1/embeds/ /sites/1/embeds/new /sites/1/embeds/1
/interactions/{tree_id} /interactions/{tree_id}/loads /interactions/{tree_id}/loads/{interaction_id} /interactions/{tree_id}/reloads /interactions/{tree_id}/starts /interactions/{tree_id}/starts/{interaction_id}