| | 26 | |
| | 27 | |
| | 28 | == Data Model == |
| | 29 | These are already existing data tables that will be involved in the template creation/ editing. |
| | 30 | |
| | 31 | '''survey_question''' |
| | 32 | - Stores ALL questions, their types, and metadata (options) used by ALL templates |
| | 33 | - important when a user modifies a question in a survey |
| | 34 | - important fields: id, name, code, notes, type, metadata, modified_on, modified_by |
| | 35 | - code = position -- question has the same value as the posn field in survey_question_list table |
| | 36 | - name = actual question text |
| | 37 | - metadata = stores options associated with the question |
| | 38 | - type = question type |
| | 39 | |
| | 40 | |
| | 41 | '''survey_question_list''' |
| | 42 | - handles the actual ordering of the questions in the survey template as well as which section questions are in. |
| | 43 | - important in modification of the template's question list, not any of the question's properties |
| | 44 | - this is linked to the appropriate survey_template through the template_id property |
| | 45 | - important fields when creating NEW question: template_id, question_id, section_id, modified_on, modified_by |
| | 46 | - important fields when EDITING question: question_id, modified_on, modified_by |
| | 47 | |
| | 48 | '''survey_question_metadata''' |
| | 49 | - this table stores all the parsed metadata from the survey_question table |
| | 50 | - important fields: id [unique to each entry], question_id [not unique to each entry], descriptor, value, modified_on, modified_by |
| | 51 | - question_id = which question the metadata belongs to |
| | 52 | - survey_question_metadata belongs to only 1 question, but 1 question can have many metadata entries in the survey_question_metadata table |
| | 53 | - descriptor = order of answer choice OR denotes "Length" (which basically means # of choices the question [described by question_id] has) |
| | 54 | - value = actual answer choice/ length value |
| | 55 | - modified_on, modified_by should be changed if the question's ANSWER CHOICES are added/modified/deleted |
| | 56 | - note that if survey_question_metadata is changed, then so should survey_question's 'metadata' field |
| | 57 | - this makes for correct exporting of the template to .csv form |
| | 58 | |
| | 59 | |
| | 60 | |
| | 61 | |
| | 62 | '''survey_template''' |
| | 63 | - important fields: id, name, description, status, completion_qstn, date_qstn, time_qstn, location_detail, priority_qstn, organisation, modified_on, modified_by |
| | 64 | - name: template name |
| | 65 | - description: template description |
| | 66 | - status: number representing whether the template is Active (in use) (2 = active) |
| | 67 | - completion/ date/ time/ location qstn: questions that appear in every template |
| | 68 | - priority_qstn: currently doesn't have a use |
| | 69 | - organisation: should probably have the ability to be modified |
| | 70 | - modified_on/ modified_by: should be updated when any part of the template is modified |
| | 71 | - modified_on/ by fields should be updated when the question list is modified. |