Team Sol - Group 05 Design Document CMPT 275 – Summer 2013 Group Members Ardavan Kalhori aka66@sfu.ca Michael Carius mcarius@sfu.ca Nasim Bigdelu nbigdelu@sfu.ca Pedram Noury pna7@sfu.ca Qiqi “Ivan” He qiqih@sfu.ca Project Manager: Ardavan Kalhori Web: http://AWDGroup.GitHub.io/CMPT275-05 Team Sol - Group 05 Table of Content Guidelines .............................................................................................................................................................. 4 System Diagrams ................................................................................................................................................... 4 Data Requirements ............................................................................................................................................... 6 Feature Priority ................................................................................................................................................... 12 1. Version 1 .................................................................................................................................................. 12 Signup/Login ............................................................................................................................... 12 Profile Customization ................................................................................................................. 12 Home Screen ................................................................................................................................ 12 Image Collection.......................................................................................................................... 12 Mole Cataloguing ........................................................................................................................ 13 Database Maintenance................................................................................................................ 13 Sharing with Physicians ............................................................................................................. 13 Medical Report ............................................................................................................................ 13 Self-Diagnosis .............................................................................................................................. 13 Finding Doctors ........................................................................................................................... 13 2. Version 2 .................................................................................................................................................. 13 Signup/Login ............................................................................................................................... 13 Profile Customization ................................................................................................................. 13 Home Screen ................................................................................................................................ 13 Image Collection.......................................................................................................................... 13 Mole Cataloguing ........................................................................................................................ 13 Database Maintenance................................................................................................................ 13 Sharing with Physicians ............................................................................................................. 13 Medical Report ............................................................................................................................ 13 Self-Diagnosis .............................................................................................................................. 14 Finding Doctors ........................................................................................................................... 14 3. Version 3 .................................................................................................................................................. 14 Signup/Login ............................................................................................................................... 14 1 Team Sol - Group 05 Profile Customization ................................................................................................................. 14 Home Screen ................................................................................................................................ 14 Image Collection.......................................................................................................................... 14 Mole Cataloguing ........................................................................................................................ 14 Database Maintenance................................................................................................................ 14 Sharing with Physicians ............................................................................................................. 14 Medical Report ............................................................................................................................ 14 Self-Diagnosis .............................................................................................................................. 14 Finding Doctors ........................................................................................................................... 14 2 Team Sol - Group 05 Revision History Revision Status Publication Date By By 1.0 Created May 24, 2013 Pedram Noury 2.0 Revised (Formatting and structure was added. Sections 1 and 4 initiated) June 11, 2013 Pedram Noury 3.0 Revised (Sections 1 and 4 elaborated on) June 12, 2013 Pedram Noury 4.0 Revised (Sections 1 and 4 completed. Section 3 initiated) June 13, 2013 Pedram Noury Final Revised (Sections 2 and 3 fully completed) June 14, 2013 Pedram Noury and Michael Carius Table 1 – Table of Document Revisions 3 Team Sol - Group 05 Guidelines This product will involve two streams of development, one for the client side application and another for the server side. The user application will be implemented in Objective-C, so it will be developed using XCode IDE and compiled with Apple LLVM. The Core Data framework will be utilized to provide a small local database on the device and the Chart.js JavaScript library to visually depict specific data in graphs. The server side development will be implemented in PHP, making use of the Eclipse IDE. MySQL will be utilized to develop and manage the project database. Finally the unit tests will be manually designed using OCUnit for the application and cURL for the server. A very important ethical and legal concern going in to the development of this application is the risk of misdiagnosing a client. If a client dismissed a malignant mole because our application mistakenly diagnosed it as low risk, the consequences of that error would be potentially fatal. Those associated with the application would be ethically responsible for any misfortune the client befalls and could face harsh legal action as a result. Thus rather than committing to a certifiable diagnosis, the application guides the user into making their own educated self-diagnosis. This allows for the application to be primarily designated as an educational tool, whilst still effectively offering sound diagnostic functions. But ultimately any diagnosis will be made by the user or a professional dermatologist, thus the responsibility for any negative consequences falls with them. System Diagrams Figure 1 represents the class relationships for the application. Each class represents an object or concept in our application’s design and contains within it their relevant data. Between each class is denoted the relationship constraints that must be specified based on the concept definitions. Figure 2 is a diagram outlining the available sequence of events that the application can go through. It depicts how transitions can be made to and from each page via the possible activities. Finally Figure 3 represents the interactions between the project’s various systems, mainly to facilitate data sharing between the application itself and the database. 4 Team Sol - Group 05 Figure 1 – Class Diagram 5 Team Sol - Group 05 Figure 2 – Activity Diagram 6 Team Sol - Group 05 Figure 3 – System Diagram Data Requirements All I/O events for our system will be occurring between a specific device and the central database. Most of the data contained within a device and database will be represented as integers, strings or arrays of primitive data types. The device will also directly contain images, but in the database they will be represented by a URL pointing to their online storage location instead. Whenever new information is added to a profile contained on a device, the central database will need to be synchronized with that profile. Thus all the textual information and mole images making up the profile will be converted to a JSON file and uploaded to the API. When API processes the file, the first step will be to store any fresh images in the online storage space. Finally the corresponding URLs and other textual information will be stored together within the central database. Conversely, whenever the device has an available internet connection, it will attempt to synchronize its contents with the main database. Once the user has passed the security protocol, they will receive a token that will allow access to the database API. The API will then retrieve all data that is relevant to the user and transfer it to the device as a JSON file. Once the file has been received, its will be parsed to compare against what is contained within the device. This will allow the device to determine what information it is lacking and update itself by filling in the blanks. Server API Calls All requests are sent over HTTP using the POST method. 7 Team Sol - Group 05 Requests and structured parameters are encoded as JSON. "string" parameters are encoded as ASCII. “image” parameters are base64 encoded PNG data. "datetime" parameters are encoded as UNIX timestamps. “nullable” parameters may be submitted as null values (whatever that means for the given JSON data type). If this is done, the datum is simply ignored. All API calls besides "register" and "login" implicitly take a "token (string)" parameter, which is the user's session authentication token as returned by a call to either of the above APIs. Any other API call with this parameter missing or incorrect will fail immediately. A failed API call returns a null JSON object. “The server” refers to an Amazon EC2 Micro instance running a LAMP stack on Ubuntu 12.04 LTS. “External storage” refers to an Amazon S3 bucket. “Mole category” refers to the metadata and continuous history associated with exactly one physical mole. “Mole” refers to the metadata associated with exactly one physical mole at exactly one point in time. Associated with exactly one image. register Registers and logs in a new user. Inputs username (string): The username to register. password (string): The MD5 hash of the new user's password. name (string): The user's full name. email (string): The user's email address. ... additional profile parameters... Outputs token (string): The user's session authentication token. login Logs in a user that is already registered. Inputs username (string): The username of the user. password (string): The MD5 hash of the user's password. Outputs token (string): The user's session authentication token. get_profile Retrieve the profile information for the current user. Inputs None Outputs name (string): The user's name. email (string): The user's email address. 8 Team Sol - Group 05 ... additional profile parameters... update_profile Updates the user's profile information. Inputs name (nullable string): The user's full name. email (nullable string): The user's email address. ... additional parameters... Outputs None create_mole_category Creates a new mole category. Inputs name (string): A user-provided identifier for the mole category. location_id (integer): The id of the body part associated with the mole category (e.g. left arm, right leg, etc.) Outputs id (integer): The unique identifier for the new mole category. update_mole_category Updates a mole category. Inputs id (integer): The id of the mole category to update. name (nullable string): The new name for the mole category. location_id (nullable integer): The new location for the mole category. Outputs None list_mole_categories Lists all mole categories known by the server for this user. Inputs None. Outputs mole_categories (array of integers): The ids of all the mole categories known to the server. create_mole Creates a new mole. Inputs date (datetime): The date and time the mole was recorded. image (image): The image data associated with the mole. 9 Team Sol - Group 05 score (integer): The user's self-assessment score for the mole. subscores (array of integers): The user's individual scores for each part of the self-assessment. Outputs id (integer): The id of the newly created mole. list_moles List all moles known by the server. Inputs None. Outputs moles (array of integers): The ids of all the moles known to the server. get_moles Download mole metadata from the server. Inputs moles (array of integers): The ids of all the moles for which to download metadata. Outputs urls (array of strings): The external storage keys of the image data associated with each mole, in the same order as the request ids. dates (array of datetimes): The dates associated with each mole, in the same order as the request ids, serialized in Unix timestamp format. mole_categories (array of integers): The ids of the mole categories associated with each mole, in the same order as the request ids. score (array of integers): The self-exam scores associated with each mole, in the same order as the request ids. put_moles Upload mole metadata to the server. Inputs images (array of images): The image data associated with each mole. dates (array of datetimes): The dates associated with the submitted image data, in the same order, serialized in Unix timestamp format. mole_categories (array of integers): The ids of the mole categories associated with the submitted image data, in the same order. score (array of integers): The self-exam scores assoicated with the submitted image data, in the same order. Outputs ids (array of integers): The ids for the newly identified moles, in the same order as the submitted image data. assign_doctors Assign a set of doctors to evaluate an image. 10 Team Sol - Group 05 Inputs image (integer): The id of the image to assign to doctors. Outputs doctors (array of integers): The ids of all the doctors assigned to the image. get_doctors Get the information of a set of doctors. Inputs doctors (array of integers): The ids of the doctors whose information is desired. Outputs names (array of strings): The names of the requested doctors, in the same order as the request ids. phones (array of strings): The phone numbers of the requested doctors, in the same order as the request ids. emails (array of strings): The emails of the requested doctors, in the same order as the request ids. latitudes (array of integers): The latitudes of the doctors' offices, in the same order as the request ids. longitudes (array of integers): The longitudes of the doctors' offices, in the same order as the request ids. ... additional parameters... get_evaluations Retrieve all the evaluations made by doctors for a set of particular images. Inputs images (array of integers): The ids of the images for which evaluations should be retrieved. Outputs comments (array of arrays of strings): The comments for each image. The collections of comments for each image are in the same order as the request ids. Each individual collection of comments is in no particular order, but is guaranteed to be in the same order as the associated collection in the doctors array. scores (array of arrays of integers): The severity scores assigned by doctors to each image. The collections of scores for each image are in the same order as the request ids. Each individual collection of scores is in no particular order, but is guaranteed to be in the same order as the associated collection in the doctors array. doctors (array of arrays of integers): The ids of the doctors who provided each evaluation. The collections of doctors for each image are in the same order as the request ids. Each individual collection of doctors is in no particular order. get_user_data Retrieves all data associated with a particular user. Inputs None (user implicitly determined by authentication token) Outputs profile (structured): The user's profile data. o id (integer): The user's unique id number. o name (string): The user's name. 11 Team Sol - Group 05 o email (string): The user's email address. o trial_remaining (integer): The remaining trial submissions for the user. o ... additional profile parameters... mole_categories (array of structured): The mole categories associated with the user. o id (integer): The unique id of the mole category. o name (string): The user-provided name of the mole category. o location_id: The unique id of the body part associated with the mole category (e.g. left arm, right leg, etc.) o moles (array of structured): The moles in the category. id (integer): The unique id of the mole. date (datetime): The date and time the mole was recorded. image (string): The external storage key of the image associated with the mole. score (integer): The self-assessment score of the mole. subscores (array of integer): The scores for each individual part of the self-assessment. evaluations (array of structured): The evaluations submitted by doctors for this particular mole. id (integer): The unique id of the evaluation. doctor (structured): The doctor who made the evaluation. id (integer): The unique id of the doctor. name (string): The name of the doctor. address (string): The address of the doctor. ... additional profile parameters... comment (string): The doctor's comment on the mole. score (integer): The doctor's assessment score for the mole. Feature Priority Version 1 Signup/Login The initial login screen access to the given account, but arbitrarily accepts any login attempt. Profile Customization The profile customization page will be created, but left empty besides the next and cancel buttons. Home Screen The home screen will initially display an overview of dummy details and graphs. Image Collection The application will allow users to directly capture images through the device’s mobile camera function. 12 Team Sol - Group 05 Mole Cataloguing A two dimensional model of the human body will be displayed on the mole history screen. The model will be populated with dummy moles, for which detailed page views can be accessed. Database Maintenance The central database will be established on an independent web server, but left unpopulated. Sharing with Physicians The online location meant for doctor access will be established but left empty. Medical Report The medical report table will be left empty and the corresponding button will be disabled. Self-Diagnosis The self-diagnosis table will be left empty and the corresponding button will be disabled. Finding Doctors The search function will lead to an empty map. Version 2 Signup/Login Account retrieval will now require proper authentication based on a dummy account. Profile Customization The application will record the user’s answers to a medical questionnaire. Home Screen The overview will now be connected to the contents of the dermal history. Image Collection Captured images can now be submitted to the user’s dermal history and pinned onto the body model. Mole Cataloguing New moles can now be submitted and viewed within the various pages. Database Maintenance The database API will be fully implemented. Sharing with Physicians The established location will only be filled with dummy profiles. Medical Report Available requests can be accepted and diagnosed, but only saved on the server side. 13 Team Sol - Group 05 Self-Diagnosis The application can guide the users through a reliable self-diagnosis procedure. Finding Doctors The once empty map will be populated by dummy doctors. Version 3 Signup/Login Attempts to log in will now be compared against the database of passwords linked to user accounts. New users can signup and their new account will be added to the database. Profile Customization The data contained with the profile will be synchronized with profiles contained on the central database. Home Screen The overview displayed on the home screen will change to reflect the profile upon synchronization. Image Collection Images that have been submitted will now be stored in an online storage place. Mole Cataloguing The data contained with the dermal history will be synchronized with profiles contained on the central database. Database Maintenance The database and device will be able to fully synchronize with each other. Sharing with Physicians Physicians will be given limited access to user profiles via an online website. Medical Report Once an image has been catalogued, the user may submit a request for a professional diagnosis. Self-Diagnosis The results of the self-diagnosis will be synchronized with the central database. Finding Doctors The application can facilitate finding an available dermatologist or contacting them for an appointment. 14