Your SlideShare is downloading. ×
CIS 591 Design / Final Report: ‘Birdie’
                         http://birdie.kreegerstudios.com/

                      ...
Table of Contents

Part I: Requirements Models Update
........................................................4
       Wri...
Table of Contents

Part VI: Test Cases and Test Results
.......................................................36
       A...
Part I: System Requirements Models

Part I: Requirements Models Update
Written Overview
Some of my requirements have chang...
Part I: Requirements Models Update

      Event                 Trigger            Source           Use Case              ...
Part I: System Requirements Models

Updated Domain Model Class Diagram


                                                 ...
Part II: Software Design Approach

Part II: Software Design Approach
Model-template-view framework
My web application was ...
Part II: Software Design Approach

Package diagram



                          Package Diagram                           ...
Sequence Diagram: Change lead status                                                                                      ...
10
                                                     Sequence Diagram: Define lead source                               ...
Part III: Database Design

Part III: Database Design
Written Overview
For my development environment, I’ve been using SQLi...
12
                                                                                                                       ...
Part III: Database Design

List of Tables
The list of tables in my database is below. Those beginning with auth_ and djang...
Part III: Database Design

        leads_leadsource (id, company_name, address, city, state, zip_code, country,
        ph...
Part III: Database Design

       [fk=leads_salescompany])




List of Referential Integrity Constraints
Below is a list o...
Part III: Database Design

        	       person_ptr_id (foreign key to leads_person)
        	       user_id (foreign ke...
Part III: Database Design

        leads_orderdetail:
        	     order_id (foreign key to leads_order)
        	     pr...
Part III: Database Design
                                                sha1$fb1e1$c5
5     etaylor                     ...
Part III: Database Design

leads_lead

id create_date expire_date customer source promotion pip sales_co divi tea mark    ...
Part III: Database Design
                                                                               2                ...
Part III: Database Design
     14 Stevie          Nicks              555 Main St          Kearney         MO           640...
Part III: Database Design
 2 My eBiz                        735 E Wilder   American        UT      80023 USA    555-555-55...
Part IV: System Controls Design

Part IV: System Controls Design
Input controls and validation
All data validation on form...
Part IV: System Controls Design

       	     	     <li>{{ form.address }}{{ form.address.errors }}</li>
       	     	   ...
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Birdie Design Report
Upcoming SlideShare
Loading in...5
×

Birdie Design Report

757

Published on

My final design report for Birdie, my senior project in college.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
757
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Birdie Design Report"

  1. 1. CIS 591 Design / Final Report: ‘Birdie’ http://birdie.kreegerstudios.com/ Benjamin Kreeger (816) 806-7096 kreeger545@missouristate.edu
  2. 2. Table of Contents Part I: Requirements Models Update ........................................................4 Written Overview 4 Updated Event Table 4 Updated Domain Model Class Diagram 6 Part II: Software Design Approach ............................................................7 Model-template-view framework 7 Model layer 7 Template layer 7 View layer 7 Package diagram 8 Sequence diagrams 9 Part III: Database Design ..........................................................................11 Written Overview 11 Relationship View 12 List of Tables 13 List of Referential Integrity Constraints 15 Sample Data for Each Table 17 Part IV: System Controls Design ..............................................................23 Input controls and validation 23 Security controls 24 Database integrity controls 25 Backup and recovery 25 Error trapping 25 Other 26 Part V: Dialog Design ................................................................................27 List of use cases and dialogs 27 Other dialogs 27 Storyboards 27 Create new lead 28 Change lead status 31 Generate marketer report 33 2 CIS591: Design / Final Report
  3. 3. Table of Contents Part VI: Test Cases and Test Results .......................................................36 Authentication 36 Logging in 36 Leads 36 Adding a new lead 36 Changing lead status 37 Assigning leads to business unit 38 Company Management 39 Adding a company 39 Editing a company 40 Adding a promotion 40 Adding a division 41 Editing a division 42 Adding a team 43 Editing a team 43 Customer Management 44 Adding a customer 44 Editing a customer 46 Reports 48 Adding a report 48 Editing a report 50 Deleting a report 50 Part VII: Summary of Incomplete Components ......................................51 Part VIII: Installation and Evaluators Instructions ..................................53 List of preset test user accounts 53 Original source code 54 Pre-built Ubuntu virtual machine 54 On the Internet 54 Part IX: Progress Reporting .....................................................................56 3 CIS591: Design / Final Report
  4. 4. Part I: System Requirements Models Part I: Requirements Models Update Written Overview Some of my requirements have changed since my analysis report. In particular, I’ve eliminated the define campaign use case, as it was somewhat redundant (and too closely related to the define promotion use case). I’ve had to move the order/product use cases to the back burner to finish up the core functionality of the application (the management and tracking of sales leads), and I’ve done the same for some of the more minor aspects of leads management (including mass import/export). I have plans in place for how those should be implemented, and they are in the initial stages of being implemented, but I’ve had to wrap up the project for the semester before their completion. More on those can be found in Section VII. I’ve added a subset of report classes; I’ve decided that there was enough information in each report (and more planned) that it could be worthwhile for users to save the reports they create in the system. Thus, a report class was made with four subclasses (each according to a certain kind of report). Updated Event Table As stated above, I’ve removed the define campaign use case. The updated event table is shown below. Those not yet implemented are shown in italics. See section VII for more details. I’ve also made singular the assign lead path use case; the ability to batch assign them should come in a later version. Event Trigger Source Use Case Response Destination Processing wants to Management New lead source Processing rep Define lead source Lead source create a lead source Processing Processing wants to Management enter a lead in New lead Processing rep Create new lead Lead Processing manually Marketers Processing wants to Management import a batch of Batch lead import Processing rep Import external leads Leads Processing leads Marketers Processing wants to Management New promotion Processing rep Define promotion Promotion create a promotion Processing Processing wants to Assign lead to lead Management classify leads to a Assign lead path Processing rep Categorized lead path Marketers path Processing chooses Sales company Distribute leads to Leads assigned to sales company to Assign leads Processing rep management sales company sales company receive leads Marketers Sales company management wants Sales company Distribute leads to Leads assigned to Division management Assign leads to distribute leads to management division division Marketers divisions Division management Distribute leads to Leads assigned to Sales teams wants to distribute Assign leads Division management sales team sales team Marketers leads to teams 4 CIS591: Design / Final Report
  5. 5. Part I: Requirements Models Update Event Trigger Source Use Case Response Destination Sales teamleaders want to assign leads Assign leads to Leads assigned to Assign leads Sales teamleaders Marketers to individual marketers marketers marketers Marketer follows up Upgrade/downgrade Lead with changed Marketers Lead properties Marketer on lead lead status status Sales teamleaders Time to archive Updated archived ‘End of day’ Archive inactive leads inactive leads leads list Any level of Management (any Customized lead Management (any management wants a Report request Generate lead report level) report level) lead report Any level of management wants a Management (any Generate marketer Customized marketer Management (any Report request report on certain level) report performance report level) marketer(s) Sales company management wants a Sales company Generate overall Master performance Sales company Report request report on overall management report report management performance Processing needs a Export leads Processing rep Export lead list Exported lead data Processing rep master list of leads Processing needs to Marketers add or change a Edit customer Processing rep Define customer Modified customer Management (any customer’s details level) CIS591: Design / Final Report 5
  6. 6. Part I: System Requirements Models Updated Domain Model Class Diagram Domain Class Diagram Benjamin Kreeger LeadSource 1 companyName Product address productName city 1 * productSource * state productPrice Promotion zip productDescription promotionName country productPicture promotionSource phone 0..1 OrderDetails 1..* 0..1 orderID productID * * qty Lead * createDate Order SalesCompany expireDate orderDate companyName customerID orderCustomerID address sourceID orderTotal city promotionID orderPaymentMethod 1 state 0..1 * pipeline orderDueDate zip salesCompanyID orderPayDate 1 country divisionID phone teamID * * isInternal marketerID managerID status 1 change_date 1 detail 0..1 * * * * Division Person Team divisionName firstName divisionID companyID 0..1 lastName teamLeaderID managerID address * 1 1 1 city 1 1 1 state zip country phone ExtendUser 0..1 1 userID Customer age 0..1 0..1 maritalStatus numChildren 1 assets 0..1 * liabilities Manager Team Leader Marketer ProcessingRep managerType commissionRate commissionRate managerID 1 teamID salesCompanyID 1 * * Report name description createdAt createdBy startDate endDate 0..* 0..* 0..* 0..* CompanyReport DivisionReport TeamReport MarketerReport salesCompanyID divisionID teamID marketerID Changes made are shaded (including the report subsystem, a new attribute and a changed attribute for Lead, and the relationship between Team/TeamLeader). 6 CIS591: Design / Final Report
  7. 7. Part II: Software Design Approach Part II: Software Design Approach Model-template-view framework My web application was written using a three-layer object-oriented design. The Django framework utilizes a slightly altered rendition of the Model-View-Controller framework it calls the Model-Template-View framework. The Controller layer (the ‘URLconf’ file) is mostly behind the scenes, and manages URL routing using regular expression pattern matching. Model layer The Model layer defines the data structure of the application using built-in field types. Each model class becomes a table in the database, and extra tables are added in the case of many-to-many relationships between models. Data layer abstraction is handled by the framework using object-relational mapping. Django’s ORM system supports MySQL, SQLite3, PostgreSQL, and Oracle, as well as other custom database backends. Template layer The Template layer consists of HTML files marked up with variables in double-curly-brace sets, {{ like so }}. When a template is rendered, it is passed a context (a Python dictionary) of variables which it inserts into the curly-brace sets. Various other template layer functions and constructs are available such as if/else and for blocks. Custom functions, such as those that can format text or expand abbreviated values, can be written and stored in another Python module, and loaded at the start of each template. Template inheritance is also allowed, so master templates can be specified. View layer The view layer takes data from the model layer, processes it, packages it, and passes it to the template layer to be rendered. Each ‘view’ is really a Python function that takes a request object, and any additional objects passed to it from the controller. These functions can access the model layer using Django’s model API functions, which can return objects, querysets, and more. Each function has access to all the Python modules the programmer can import. Another aspect of the view layer is Django’s forms API, which can abstract field information about the model layer and provide form display and validation with just a few lines of code on the programmer’s end. CIS591: Design / Final Report 7
  8. 8. Part II: Software Design Approach Package diagram Package Diagram Benjamin Kreeger Templates (*.html) Companies Reports companies Leads detail Customers Orders reports edit Admin detail add new (mostly detail new orders edit division_detail generated by edit leads detail delete division_edit framework) new to_division edit company division_new customers to_marketers new division team_detail to_sales marketer team_edit team team_new Extras: birdie_tags: capitalize, money, buyer, ifnone, intext Controllers (urls.py) urls.py (URLconf) Views (views.py / forms.py) Companies company_detail Reports edit Customers Orders Leads new reports div_add customers orders leads add div_detail customer_detail detail lead_detail report_detail div_edit edit edit new report_edit team_add add new report_delete team_detail team_edit Forms: LeadSourceForm, SalesCompanyForm, DivisionForm, NewDivisionForm, TeamForm, NewTeamForm, CustomerForm, LeadDetailForm, NewLeadForm, MarketerReportForm, TeamReportForm, DivisionReportForm, CompanyReportForm Models (models.py) Leads Reports Person Customer LeadSource Promotion Report CompanyReport ExtendUser Manager Teamleader ProcessingRep DivisionReport Marketer SalesCompany Division Team TeamReport Lead Product Order OrderDetail MarketerReport Those templates and views in italics have not yet been implemented. More on those in Section VII. 8 CIS591: Design / Final Report
  9. 9. Sequence Diagram: Change lead status Benjamin Kreeger Controller View Model Django model Web browser Template layer (/urls.py) (/leads/views.py) (/leads/models.py) API / Database Marketer Open active leads page (/leads/) /leads/ birdie.leads.views.leads() a_user := Marketer.objects.get(user=request.user) Marketer.objects.get(user=request.user) Sequence diagrams a_user Marketer leads := Lead.objects.get(marketer=a_user) Lead.objects.get(marketer=a_user) render_to_response ('/leads/leads.html', context) leads QuerySet /leads/leads.html Click a lead (/leads/777) /leads/(?P<leadid>)/ birdie.leads.views.lead_detail(777) lead := get_object_or_404(Lead, id=777) get_object_or_404(Lead, id=777) CIS591: Design / Final Report render_to_response lead Lead ('/leads/lead_detail.html', context) /leads/lead_detail.html View / Form Fill out lead detail form (/leads/forms.py) Click submit (/leads/777/) /leads/(?P<leadid>)/ birdie.leads.views.lead_detail(777, method.POST) lead := get_object_or_404(Lead, id=777) get_object_or_404(Lead, id=777) lead Lead form := LeadForm(POST) form lead = form.cleaned_data lead.save() lead.save() render_to_response /leads/leads.html ('/leads/leads.html', context) HttpResponseRedirect(birdie.leads.views.leads()) Part II: Software Design Approach 9
  10. 10. 10 Sequence Diagram: Define lead source Benjamin Kreeger View Controller Model Django model Web browser Template layer (/companies/ (/urls.py) (/leads/models.py) API / Database views.py) View / Form (/companies/ Marketer forms.py) Open external companies page /companies/ (/companies/external) (?P<company_type>w+)/ birdie.companies.views.companies(external) companies := LeadSource.objects.all() LeadSource.objects.all() render_to_response ('/companies/companies.html', companies QuerySet /companies/companies.html context) Part II: Software Design Approach leads := Lead.objects.get(marketer=a_user) Lead.objects.get(marketer=a_user) Click 'add a company' /companies (/companies/external/add) (?P<company_type>w+)/ birdie.companies.views.new(external) form := render_to_response LeadSourceForm() ('/companies/company_add.html', form /companies/company_add.html context) Fill out add company form /companies Click submit (/companies/external/add) (?P<company_type>w+)/ birdie.leads.views.new(external, method.POST) company = LeadSource() company form := LeadSourceForm(POST) form company.save() company.save() HttpResponseRedirect(birdie.companies.views.companies(external)) render_to_response ('/companies/companies.html', /companies/companies.html context) CIS591: Design / Final Report
  11. 11. Part III: Database Design Part III: Database Design Written Overview For my development environment, I’ve been using SQLite3. A production environment would make use of MySQL. To switch between the two, I’ve implemented a PROD Boolean flag in the Django settings file. As long as PROD is set to False, the environment is considered a development one, and SQLite3 is used. Otherwise, it’s production, and MySQL comes into the picture. My settings.py file accounts for that here: # Switch the following to False for production environment. PROD = True if PROD == False: DATABASE_ENGINE = 'sqlite3' DATABASE_NAME = SITE_ROOT + '/sqlite.db' DATABASE_USER = '' DATABASE_PASSWORD = '' DATABASE_HOST = '' DATABASE_PORT = '' else: DATABASE_ENGINE = 'mysql' DATABASE_NAME = 'birdie' DATABASE_USER = 'birdie' DATABASE_PASSWORD = '' DATABASE_HOST = '' DATABASE_PORT = '' SQLite3 is good for a development environment because it’s stored locally in a quickly- accessible file. For the minor magnitude in which I’m developing the program, this file-based DMBS is ideal. I’ve chosen MySQL as a production database for its balance of efficiency in a larger-scale environment, cost, and available support options. CIS591: Design / Final Report 11
  12. 12. 12 Entity Relationship Diagram Benjamin Kreeger leads_leadsource id INT(11) leads_product auth_user_user_permissions auth_permission auth_group_permissions company_name VARCHAR(100) id INT(11) id INT(11) id INT(11) id INT(11) address VARCHAR(100) name VARCHAR(100) user_id INT(11) name VARCHAR(50) group_id INT(11) city VARCHAR(60) source_id INT(11) permission_id INT(11) content_type_id INT(11) permission_id INT(11) leads_promotion state VARCHAR(2) price DECIMAL(12,2) codename VARCHAR(100) id INT(11) zip_code VARCHAR(10) description LONGTEXT name VARCHAR(100) country VARCHAR(50) picture VARCHAR(100) source_id INT(11) phone VARCHAR(20) leads_orderdetails id INT(11) order_id INT(11) auth_user auth_user_groups auth_group product_id INT(11) id INT(11) id INT(11) id INT(11) Part III: Database Design quantity DECIMAL(12,2) username VARCHAR(30) user_id INT(11) name VARCHAR(80) Relationship View first_name VARCHAR(30) group_id INT(11) last_name VARCHAR(30) email VARCHAR(75) password VARCHAR(128) leads_lead is_staff TINYINT(1) id INT(11) leads_order is_active TINYINT(1) leads_salescompany create_date DATETIME id INT(11) is_superuser TINYINT(1) auth_message id INT(11) expire_date DATETIME date DATETIME last_login DATETIME id INT(11) company_name VARCHAR(100) customer_id INT(11) customer_id INT(11) date_joined DATETIME user_id INT(11) address VARCHAR(100) source_id INT(11) total DECIMAL(12,2) message LONGTEXT city VARCHAR(60) promotion_id INT(11) payment_method VARCHAR(10) state VARCHAR(2) pipeline VARCHAR(2) due_date DATETIME zip_code VARCHAR(10) sales_company_id INT(11) django.auth pay_date DATETIME country VARCHAR(50) division_id INT(11) phone VARCHAR(20) team_id INT(11) is_internal TINYINT(1) marketer_id INT(11) manager_id INT(11) status VARCHAR(8) change_date DATETIME detail LONGTEXT other django django_content_type django_admin_log leads_person id INT(11) id INT(11) id INT(11) framework name VARCHAR(100) action_time DATETIME leads_division id INT(11) first_name VARCHAR(50) tables app_label VARCHAR(100) user_id INT(11) name VARCHAR(50) leads_team last_name VARCHAR(50) model VARCHAR(100) content_type_id INT(11) company_id INT(11) id INT(11) address VARCHAR(100) object_id LONGTEXT manager_id INT(11) division_id INT(11) city VARCHAR(60) object_repr VARCHAR(200) teamleader_id INT(11) state VARCHAR(2) action_flag SMALLINT(5) zip_code VARCHAR(10) django_site django_session change_message LONGTEXT country VARCHAR(50) id INT(11) session_key VARCHAR(40) phone VARCHAR(20) domain VARCHAR(100) session_data LONGTEXT name VARCHAR(50) expire_date DATETIME leads_extenduser person_ptr_id INT(11) leads_customer user_id INT(11) person_ptr_id INT(11) age INT(11) marital_status VARCHAR(20) num_children INT(11) assets DECIMAL(12,2) See attached Tabloid-sized diagram for a larger ERD diagram. liabilities DECIMAL(12,2) leads_manager leads_teamleader leads_marketer leads_processingrep extenduser_ptr_id INT(11) extenduser_ptr_id INT(11) extenduser_ptr_id INT(11) extenduser_ptr_id INT(11) manager_type VARCHAR(50) commission_rate DECIMAL(5,2) commission_rate DECIMAL(5,2) manager_id INT(11) team_id INT(11) sales_company_id INT(11) reports_report birdie.reports id INT(11) name VARCHAR(255) description LONGTEXT created_at DATETIME created_by_id INT(11) start_date DATE end_date DATE CIS591: Design / Final Report reports_companyreport reports_divisionreport reports_teamreport reports_marketerreport report_ptr_id INT(11) report_ptr_id INT(11) report_ptr_id INT(11) report_ptr_id INT(11) sales_company_id INT(11) division_id INT(11) team_id INT(11) marketer_id INT(11)
  13. 13. Part III: Database Design List of Tables The list of tables in my database is below. Those beginning with auth_ and django_ are created by the framework; the only ones I use heavily out of those would be auth_user, and I’m still working on implementing auth_group and auth_permission. Primary keys are underlined, and foreign keys are denoted by a following [fk=related_table] notation. auth_permission (id, name, content_type_id [fk=django_content_type], codename) auth_group (id, name) auth_user (id, username, first_name, last_name, email, password, is_staff, is_active, is_superuser, last_login, date_joined) auth_message (id, user_id [fk=auth_user], message) auth_group_permissions (id, group_id [fk=auth_group], permission_id [fk=auth_permission]) auth_user_groups (id, user_id [fk=auth_user], group_id [fk=auth_group]) auth_user_user_permissions (id, user_id [fk=auth_user], permission_id [fk=auth_permission]) django_admin_log (id, action_time, user_id [fk=auth_user], content_type_id [fk=django_content_type], object_id, object_repr, action_flag, change_message) django_content_type (id, name, app_label, model) django_session (session_key, session_data, expire_date) django_site (id, domain, name) leads_person (id, first_name, last_name, address, city, state, zip_code, country, phone) leads_customer (person_ptr_id [fk=leads_person], age, marital_status, num_children, assets, liabilities) leads_extenduser (person_ptr_id [fk=leads_person], user_id [fk=auth_user]) leads_manager (extenduser_ptr_id [fk=leads_extenduser], manager_type) leads_teamleader (extenduser_ptr_id [fk=leads_extenduser], commission_rate) CIS591: Design / Final Report 13
  14. 14. Part III: Database Design leads_leadsource (id, company_name, address, city, state, zip_code, country, phone) leads_promotion (id, name, source_id [fk=leads_leadsource]) leads_salescompany (id, company_name, address, city, state, zip_code, country, phone, is_internal, manager_id [fk=leads_manager]) leads_division (id, name, company_id [fk=leads_salescompany], manager_id [fk=leads_manager]) leads_team (id, division_id [fk=leads_division], teamleader_id [fk=leads_teamleader]) leads_processingrep (extenduser_ptr_id [fk=leads_extenduser], manager_id [fk=leads_manager], sales_company_id [fk=leads_salescompany]) leads_marketer (extenduser_ptr_id [fk=leads_extenduser], commission_rate, team_id [fk=leads_team]) leads_lead (id, create_date, expire_date, customer_id [fk=leads_customer], source_id [fk=leads_leadsource], promotion_id [fk=leads_promotion], pipeline, sales_company_id [fk=leads_salescompany], division_id [fk=leads_division], team_id [fk=leads_team], marketer_id [fk=leads_marketer], status, change_date, detail) leads_product (id, name, source_id [fk=leads_leadsource], price, description, picture) leads_order (id, date, customer_id [fk=leads_customer], total, payment_method, due_date, pay_date) leads_orderdetail (id, order_id [fk=leads_order], product_id [fk=leads_product], quantity) reports_report (id, name, description, created_at, created_by_id [fk=auth_user], start_date, end_date) reports_marketerreport (report_ptr_id [fk=reports_report], marketer_id [fk=leads_marketer]) reports_teamreport (report_ptr_id [fk=reports_report], team_id [fk=leads_team]) reports_divisionreport (report_ptr_id [fk=reports_report], division_id [fk=leads_division]) reports_companyreport (report_ptr_id [fk=reports_report], sales_company_id 14 CIS591: Design / Final Report
  15. 15. Part III: Database Design [fk=leads_salescompany]) List of Referential Integrity Constraints Below is a list of the referential integrity constraints in the Birdie database. Primary keys in the database are auto_incremented and are not allowed to be changed. auth_permission: content_type_id (foreign key to django_content_type) auth_group: none auth_user: none auth_message: user_id (foreign key to auth_user) auth_group_permissions: group_id (foreign key to auth_group) permission_id (foreign key to auth_permission) auth_user_groups: user_id (foreign key to auth_user) group_id (foreign key to auth_group) auth_user_user_permissions: user_id (foreign key to auth_user) permission_id (foreign key to auth_permission) django_admin_log: user_id (foreign key to auth_user) content_type_id (foreign key to django_content_type) django_content_type: none django_session: none django_site: none leads_person: none leads_customer: person_ptr_id (foreign key to leads_person) leads_extenduser: CIS591: Design / Final Report 15
  16. 16. Part III: Database Design person_ptr_id (foreign key to leads_person) user_id (foreign key to auth_user) leads_manager: extenduser_ptr_id (foreign key to leads_extenduser) leads_teamleader: extenduser_ptr_id (foreign key to leads_extenduser) leads_leadsource: none leads_promotion: source_id (foreign key to leads_leadsource) leads_salescompany: manager_id (foreign key to leads_manager) leads_division: company_id (foreign key to leads_salescompany) manager_id (foreign key to leads_manager) leads_team: division_id (foreign key to leads_division) teamleader_id (foreign key to leads_teamleader) leads_processingrep: extenduser_ptr_id (foreign key to leads_extenduser) manager_id (foreign key to leads_manager) sales_company_id (foreign key to leads_salescompany) leads_marketer: extenduser_ptr_id (foreign key to leads_extenduser) team_id (foreign key to leads_team) leads_lead: customer_id (foreign key to leads_customer) source_id (foreign key to leads_leadsource) promotion_id (foreign key to leads_promotion) sales_company_id (foreign key to leads_salescompany) division_id (foreign key to leads_division) team_id (foreign key to leads_team) marketer_id (foreign key to leads_marketer) leads_product: source_id (foreign key to leads_leadsource) leads_order: customer_id (foreign key to leads_customer) 16 CIS591: Design / Final Report
  17. 17. Part III: Database Design leads_orderdetail: order_id (foreign key to leads_order) product_id (foreign key to leads_product) reports_report: created_by_id (foreign key to auth_user) reports_marketerreport: report_ptr_id (foreign key to reports_report) marketer_id (foreign key to leads_marketer) reports_teamreport: report_ptr_id (foreign key to reports_report) team_id (foreign key to leads_team) reports_divisionreport: report_ptr_id (foreign key to reports_report) division_id (foreign key to leads_division) reports_companyreport: report_ptr_id (foreign key to reports_report) sales_company_id (foreign key to leads_salescompany) Sample Data for Each Table The following is data in each table separated by table by alphabetical order. Certain tables, like the django_* tables and the auth_* tables (except auth_user) have been omitted as they’re filled with mostly auto-generated content by the framework. auth_user id username first_name last_nam email passwor is_staff is_active is_superulast_login date_join e d ser ed 1 bkreeger Benjamin Kreeger benjamink sha1$94855$e 94ff387e576e8 1 1 12009-04- Apr 13, 2009 12:31 PM reeger@g d06d888ef5ce 25 mail.com be18e815ed8a ad 19:38:09. 986259 sha1$10db2$8 2 danderson a05e486a21a8 0 1 0 Apr 14, 2009 10:06 2009 12:37 PM Apr 13, PM b2e9296edb97 ea678e7c89e0 024 sha1$94a1c 3 afreestone $a4f5c643379 0 1 0 Apr 13, 2009 12:38 2009 12:38 PM Apr 13, PM 92b464cd9f0ff 8a79ce6876d3 0d88 sha1$c1c0f 4 dahmu $c9675360a14 0 1 0 2009-04- 2009-04- 20db33d81bbd 13 13 d733762868e9 cd68c 12:38:36. 12:38:36. 086690 086701 CIS591: Design / Final Report 17
  18. 18. Part III: Database Design sha1$fb1e1$c5 5 etaylor c382ee91ca0c 0 1 0 Apr 22, 2009 8:29 PM 12:39 PM Apr 13, 2009 48aa3ebb66f6 2c3d2cf38cc8f 3 sha1$e084f 6 bkanenwisher $a48a0fb58d2 0 1 0 Apr 16, 2009 1:29 PM 12:39 PM Apr 13, 2009 c6409a64dfc6 840a3e7b92c3 72d3a sha1$aab12$4 7 rwolfley 5876e3e5ac51 0 1 0 Apr 22, 2009 8:27 PM 12:41 PM Apr 13, 2009 4bcee91a68c1 49ce4faf0ecb2 db sha1$63aa2$4 8 lkreeger 384e0137a420 1 1 1 2009-04- Apr 14, 2009 8:08 PM 8eae15aae354 25 79845a4df288 2b9 19:38:19. 739459 sha1$712af 9 jlucas $4b03b139937 0 1 0 Apr 14, 2009 8:10 PM 8:09 PM Apr 14, 2009 926b77b356be 8d9b05a495c4 49a3d sha1$d926e 10 lpage $4d2f5c3009d 0 1 0 Apr 23, 2009 8:54 PM 7:51 PM Apr 22, 2009 0fea01b8a748 e7ded611388b 91c08 sha1$95f43$91 11 rellefsen 723c0f47c74ff 0 1 0 Apr 22, 2009 7:57 PM 7:57 PM Apr 22, 2009 e584276d6ba9 3efc8cd1b58b 3 sha1$8e2f6$b7 12 dwheeler 8bd03ca7a4b9 0 1 0 Apr 22, 2009 8:29 PM 8:28 PM Apr 22, 2009 24891872a7c2 f154b402e6d5f d leads_customer person_ptr_id age marital_status num_children assets liabilities 5 33 divorced 2 20000 15000 6 45 married 1 50000 10000 7 25 single 8 single 9 single 10 77 single 0 11 12 13 14 40 single 0 11000 12000 15 16 single 19 single 18 CIS591: Design / Final Report
  19. 19. Part III: Database Design leads_lead id create_date expire_date customer source promotion pip sales_co divi tea mark stat change_date detai _id _id _id elin mpany_id sion m_i eter_i us l e _id d d 1 2009-04-13 2009-05-09 5 1 1b 1 1 1 4 acti 2009-04-25 Hom 12:47:05.77 19:36:33.05 ve 19:36:33.0597 eless 5505 9719 19 . 2 2009-04-13 2009-05-09 6 2 2b 1 1 1 4 acti 2009-04-25 13:19:16.93 12:19:24.98 ve 12:19:24.9815 5144 1561 61 3 2009-04-13 2009-04-30 7 2 5b 1 1 1 4 acti 2009-04-16 13:19:46.41 10:44:30.29 ve 10:44:30.2939 5353 3931 31 4 2009-04-13 2009-05-09 8 3 3 nb 1 1 1 4 acti 2009-04-25 13:20:02.94 12:25:25.66 ve 12:25:25.6699 9333 9973 73 5 2009-04-13 2009-05-09 9 4 4b 1 1 1 4 acc 2009-04-25 13:20:22.03 12:31:57.66 oun 12:31:57.6604 2051 0468 t 68 6 2009-04-13 2009-04-30 10 3 3b 1 1 1 4 inac 2009-04-16 13:20:54.67 13:22:23.68 tive 13:22:23.6846 1291 4664 64 7 2009-04-13 2009-04-27 11 4 4b 1 1 1 4 expi 13:21:19.18 13:21:19.18 red 5410 5356 8 2009-04-13 2009-04-27 14 1 1 nb 1 1 1 4 inac 20:37:03.42 20:37:03.42 tive 9539 9487 9 2009-04-14 2009-05-01 12 1 1b 1 acti 2009-04-17 20:18:13.63 23:25:45.96 ve 23:25:45.9693 4073 9347 47 102009-04-14 2009-05-09 16 4 4b 1 1 1 4 acti 2009-04-25 21:42:09.23 12:25:38.87 ve 12:25:38.8778 3883 7825 25 112009-04-17 2009-05-09 19 3 3 nb 2 3 3 23 acc 2009-04-25 23:23:45.73 12:41:18.70 oun 12:41:18.7059 4094 5924 t 24 122009-04-17 2009-05-01 13 2 5b 1 acti 2009-04-17 23:25:20.21 23:25:45.97 ve 23:25:45.9790 5286 9071 71 132009-04-22 2009-05-06 19 1 1b 2 3 3 23 acti 2009-04-22 20:27:21.61 20:29:09.08 ve 20:29:09.0852 2446 5236 36 leads_division id name company_id manager_id 1 NMR Internet Sales 1 17 3 MeB Internet Sales 2 3 leads_extenduser person_ptr_id user_id 1 2 CIS591: Design / Final Report 19
  20. 20. Part III: Database Design 2 6 3 7 4 1 17 9 18 8 20 10 21 11 22 5 23 12 leads_leadsource id company_name address city state zip_code country phone 1 BidFrog, LLC 629 E. 730th St. American Fork UT 84003 USA 827-363-6383 2 Real Estate Millionaire, Inc 928 Reader Rd American Fork UT 80023 USA 846-454-8494 3 eBay Wealth System, LLC 837 Receipt Dr Salt Lake City UT 84022 USA 836-455-7958 4 Risktakers, Inc. 363 Cliff Blvd Los Angeles CA 90002 USA 837-464-5474 5 World Profit Center 1 Business Way New York NY 23930 USA 455-335-4337 leads_manager extenduser_ptr_id manager_type 2 company 3 division 17 division 20 company 21 processing leads_marketer extenduser_ptr_id commission_rate team_id 4 0.05 1 23 0.05 3 leads_person id first_name last_name address city state zip_code country phone 1 Daniel Anderson 555 Main St Kearney MO 64060 USA 816-628-5555 2 Boyd Kanenwisher 555 Main St Kearney MO 64060 USA 816-628-5555 3 Rod Wolfley 555 Main St Kearney MO 64060 USA 816-628-5555 4 Benjamin Kreeger 826 S Fort Ave Springfield MO 65806 USA 816-806-7096 5 Eddie James 555 Main St Margaritaville AL 77766 USA 555-555-5555 6 David Caravella 555 Main St Kearney MO 64060 USA 816-903-5555 7 Brandi Carlisle 555 Main St Kearney MO 64060 USA 816-903-5555 8 James Hendrix 555 Main St Kearney MO 64060 USA 816-628-5555 9 James Page 555 Main St Kearney MO 64060 USA 816-628-5555 10 Jim Morrison 555 Main St Kearney MO 64060 USA 816-903-5555 11 Peter Frampton 555 Main St Kearney MO 64060 USA 816-628-5555 12 Ozzy Ozbourne 555 Main St Kearney MO 64060 USA 816-628-5555 13 Robert Plant 555 Main St Kearney MO 64060 USA 816-628-5555 20 CIS591: Design / Final Report
  21. 21. Part III: Database Design 14 Stevie Nicks 555 Main St Kearney MO 64060 USA 816-628-5555 15 Frederick Mercury 123 Hello Blvd Hollywood CA 90021 USA 555-555-5555 16 Peter Townshend 123 Hello Blvd Hollywood CA 90021 USA 555-555-5555 17 Jeff Lucas 555 Gerard Way Kansas City MO 64151 USA 816-555-5555 18 Laura Kreeger 826 S Fort Ave Springfield MO 65806 USA 816-806-9656 19 Edward Van Halen 555 Wiley St Miami FL 9142 USA 555-555-5555 20 Leonard Page 555 Wary Way Tulsa OK 72526 USA 555-555-5555 21 Ryan Ellefsen 444 Noname Dr Kearney MO 64060 USA 555-555-5555 22 Eric Taylor 555 Blah Dr American Fork UT 27632 USA 555-555-5555 23 Derrick Wheeler 735 Happy Ln American Fork UT 83752 USA 555-555-5555 leads_processingrep extenduser_ptr_id manager_id sales_company_id 18 17 1 leads_product id name source price description pict _id ure 1 Bidfrog 1 99.99 BidFrog gives you powerful information that will: • Teach you how to apply a few simple Internet Marketing techniques to explode your income online! • Give you the freedom you have always wanted from an Internet income. • Help you build your Internet business into a source of long-term security. • And give you creative marketing tips and ideas to turn your online business into a full-time venture so you can kiss your boss goodbye! 2 Be a Real 2 24.95 BE A REAL ESTATE MILLIONAIRE teaches you Dean Graziosi’s personal strategies for Estate turning real estate losers into winners. Discover the seven keys to unlocking hidden Millionaire real estate values. 3 eBay 3 9.95 Keep track of all your eBay auctions. Sell like a pro! Watcher 4 How to Take 4 59.99 Improve your life and deepen your pockets by taking risks. This book will show you Risks: A how! Guide leads_promotion id name source_id 1 Bidfrog Online Ads 1 2 REM Online Ads 2 3 eBay Wealth Infomercial 3 4 Risktakers Mass Mailing 4 5 REM Mass Mailing 2 leads_salescompany id company_name address city stat zip_cod countr phone is_intern manager_ e e y al id 1 National Marketing Resources, 351 W Kearney MO 64060 USA 816-903-61 1 2 LLC Washington 00 CIS591: Design / Final Report 21
  22. 22. Part III: Database Design 2 My eBiz 735 E Wilder American UT 80023 USA 555-555-55 1 20 Way Fork 55 leads_team id division_id teamleader_id 1 1 1 3 3 22 leads_teamleader extenduser_ptr_id commission_rate 1 0.05 22 0.05 reports_companyreport report_ptr_id sales_company_id 4 1 reports_divisionreport report_ptr_id division_id 3 1 reports_marketerreport report_ptr_id marketer_id 1 4 reports_report id name description created_at created_by_id start_date end_date 1 Benjamin Kreeger report on Benjamin Kreeger's progress for the firstApr 1, 2009 Apr 24, 2009 A report 2009-04-23 22:00:48.544827 8 half of April. 2 Team Anderson Performance 2009-04-23 22:03:25.693368 8 Apr 1, 2009 Apr 25, 2009 3 Division report ANothing here! 2009-04-25 20:19:44.609280 8 Apr 11, 2009 Apr 25, 2009 4 Company test report Test! 2009-04-25 20:26:49.119675 8 Apr 1, 2009 Apr 25, 2009 reports_teamreport report_ptr_id team_id 2 1 22 CIS591: Design / Final Report
  23. 23. Part IV: System Controls Design Part IV: System Controls Design Input controls and validation All data validation on forms in the system is handled by Django’s forms API. A class is made that abstracts specific information about the fields in a database and ensures that the data entered into a web form meets those specifications (such as max length, numbers only, etc). All zip code fields, phone number fields, age fields, and monetary fields are specifically designed to allow numbers as data. If any other data is encountered, an exception is raised and the user is returned to the form, showing them why their form was rejected and steps to take to rectify the error. The ‘don’t repeat yourself’ principle of Django means you define data validation in one place: the models.py file. from /leads/models.py class Customer(Person): age = models.IntegerField(blank=True, null=True) marital_status = models.CharField(blank=True, max_length=20, choices=MARITAL_STATUSES) num_children = models.IntegerField(blank=True, null=True) assets = models.DecimalField(max_digits=12, decimal_places=2, blank=True, null=True) liabilities = models.DecimalField(max_digits=12, decimal_places=2, blank=True, null=True) When you declare a form class in Django, the best way to ensure that validation is as you specify it is to base it on the model, like this form based on the above Customer class. from /customers/forms.py class CustomerForm(forms.ModelForm): class Meta: model = Customer When this form is instantiated and passed in context by the view layer, it can either contain initial data (useful for filling it with POST data and then updating or creating database rows) or it can be empty. When it’s passed to the template layer, it can be customized in any number of ways, including listing errors by each field after they occur. from /templates/customers/customer_edit.html <div id="panel_left"> <h2>{{ form.first_name }}{{ form.last_name }} {{ form.first_name.errors }}{{ form.last_name.errors }}<span class="right">editing</span></h2> <ul> CIS591: Design / Final Report 23
  24. 24. Part IV: System Controls Design <li>{{ form.address }}{{ form.address.errors }}</li> <li>{{ form.city }}{{ form.city.errors }}, {{ form.state }} {{ form.state.errors }} {{ form.zip_code }}{{ form.zip_code.errors }}</li> <li>{{ form.country }}{{ form.country.errors }}</li> <li>{{ form.phone }}{{ form.phone.errors }}</li> ... Security controls The web application is currently being hosted at WebFaction (http://webfaction.com/), which houses its servers stateside in Texas. The app is only accessible via secure HTTP (HTTPS) — a redirect occurs when a user visits the http:// side of the site to the https:// version. No information is ever sent over plain text. If hosted elsewhere, this could easily be re- implemented in Apache’s .conf configuration files. Users must log in to the system with their credentials to access anything other than the main Welcome page. A user’s account can be deactivated only by somebody with staff privileges (equivalent to having master access). Django’s optional auth framework (which I’ve chosen to utilize for this project) handles user, group, and permission management. So far, I’ve implemented users as well as basic groups and permissions, but site access is currently open to all authenticated users until I can further implement permissions and groups per view. The only exception to this is the admin site, which I’ve locked down to only those who have staff privileges. Ensuring only those that are logged in are those that can view web pages is the following Python decorator before each view (underlined): @login_required def new(request): ... The rest is handled by Django’s auth framework. The production server, managed by WebFaction, is hosted in The Planet’s Datacenter in Houston. The following is a rundown from WebFaction’s website on server security: We've been in business for over 6 years and we use some of the top datacenters in the world (from The Planet). The datacenter features redundant UPS systems, generator backup, VESPA detection systems, closed circuit monitoring of all areas and entrances, 24 hour guard manned security, redundant a/c systems, and fiber from 5 separate providers. 24 CIS591: Design / Final Report

×