36
The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo, Sylvia Hristakeva, Kumud Nepal, Ernel Wint Ralph Morelli, Trishan de Lanerolle

The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

The 2007 Aidmatrix Summer Institute in

Humanitarian Free and Open Source Software

Antonio Alcorn, Giovanni Capalbo, Sylvia Hristakeva, Kumud Nepal, Ernel Wint

Ralph Morelli, Trishan de Lanerolle

Page 2: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 2 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

• Background

• Goals

• Work Environment

• Sahana Project

• Interface/Functional Changes

• Re-factoring Design Changes

• OpenMRS Project

• MVC Architecture

• Touchscreen Demo

• The Touchscreen Package

• Student Experiences

• Looking Ahead

Outline

From left to right, Trishan de Lanerolle, Giovanni Capalbo, Antonio Alcorn, KumudNepal, Ernel Wint, Sylvia Hristakeva, Ralph Morelli. (Missing: Prof. Heidi Ellis)

Page 3: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 3 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

• The 2007 Aidmatrix Summer H-FOSS Institute

• H-FOSS = Humanitarian Free and Open Source Software

•The 2007 H-FOSS Team

• Sahana (Sri Lanka)

• Disaster Management System

• LAMP (Linux + Apache + MySQL + PHP) Platform

• Trinity’s Contribution: Volunteer Management (VM) Module

• OpenMRS (Rwanda)

• Paul Farmer, Partners in Health

• Trinity Connection, Christian Allen, ‘00

• Open source Medical Record System

• Java (MySQL, Ajax, JSP, Spring, Hibernate, XML)

Background

Page 4: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 4 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

• Build Free and Open Source Software

• Learn about and contribute to the open source movement

• Apply CS and IT skills to benefit society

• Explore different ways of learning computer science

• Attract students to the study of computer science

• Summer 2007 Objectives

• Redesign and Re-factor the Sahana VM Module

• Incorporate unit testing and other software engineering principles

• Learn about the OpenMRS system

Goals and Objectives

Page 5: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 5 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Work Environment

• Used a integrated set of open source applications•Eclipse:

• Java-based, extensible open source development platform (IDE)

• used for both Java/J2EE and PHP projects•Mediawiki:

• Collaborative website, directly editable by its users (Trinity H-FOSS)

•Subversion: • source code revision control system ( websvn )

•Trac:(Volunteer Management Trac site)• an enhanced wiki and issue tracking system for software development projects with subversion integration.

Page 6: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Volunteer Management Module

Page 7: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 7 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Sahana Overview

• Open source disaster management system

• Web-based portal with sub-applications

• Implemented in Sri Lanka, Pakistan, Philippines, Indonesia

• PHP-based

• http://www.sahana.lk

Page 8: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Access Control

Page 9: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 9 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Access Control - Sahana

• Store:• Give DB tables classification levels• Assign role(s) to users

• Access Controlling Mechanism:• Roles access data based on classification level

• Problems:• Sahana ACL too restrictive for VM• Unable to restrict access control to single module

Page 10: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 10 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Access Control – VM Module

• Store:• Requests

• Pages in the system• Defined by URL parameters (act, vm_action)

• Constraints • VM - Requirements, Overrides• Sahana - Classification Constraints

• Link constraints to a request

• Access Controlling Mechanism :• Check all constraints imposed on given request• AccessController class• Each Controller calls AccessController::isAuthorized()

Page 11: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Positions and Credentials

Page 12: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 12 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Positions and Credentialing

• Expert consultant: Prof. Frank Fiedrich, GW Institute for Crisis, Disaster and Risk Management • Re-factored VM module: Volunteers assigned to positions, within projects• Site managers create positions for their project(physician, sandbag mover, grief counsellor)•Volunteers associated with one or more positions• Benefits:

• Site managers have finer control over volunteer assignments• Initial foundation for advanced credentialing system

• Credentialing (future): validating professional qualifications

Project

positions

volunteers

Page 13: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Reporting, Messaging

Page 14: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 14 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Reporting Feature

•Available to Main Operations Handler and Site Manager•Extensive listing of all the volunteers

•Affiliation•Number of hours worked•Monetary value•Position Held

•Custom Reporting•Filtering by project, organization, or both•Reporting for specific volunteers

•A little information-breakdown-bubble with all the information•Printer Friendly Version Available

Page 15: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 15 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Messaging

• Database Setup:• vm_message - store text of messages, timestamp• vm_courier - store who messages are sent to/from• vm_mailbox - store a volunteer’s messages to

prevent loss of message records

• Upgrades:• Can send message to more than one person• Can delete messages without losing message and to/from

information

Page 16: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Time Loggingand Searching

Page 17: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 17 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Time Logging

• Volunteers are organized by position within a project

• Volunteers submit hours for Project Manager approval

• Volunteers can enter hours or shifts for a Position in a Project

Page 18: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 18 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Searching

• Search By:• ID• Name • Location• Skills• Availability

• Name search uses soundex() and metaphone()

Page 19: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Volunteer Management Module:

Under the Hood

Page 20: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

MVC Architecture, Template Engine, Database Schema

Page 21: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 21 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

The MVC Architecture

Model• The Model represents application logic (often called the business layer in enterprise applications).

Controller

•The controller is basically the first point of call for any incoming HTTP requests in a web application.

View

• “Views” are basically the end result which we send to a web browser - the HTML generated by our script.

Page 22: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 22 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

MVC Sahana Design

The Model-View-Controller is very use full method of organizing an application in facilitating updates to the three main parts of any application (model, view, and controller).

Page 23: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 23 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Code Example

function _shn_vm_del_vol(){

global $global;$db=$global['db'];$pid=$_POST{"pid"};$q="select full_name from person_uuid where p_uuid=$pid";$res=$db->Execute($q); $name=$res->fields[0];$q="update person_status set isReliefWorker=0 where p_uuid=$pid";$res=$db->Execute($q);?> <div id="result_msg"> <?php echo $name?> Volunteer was succesfully Deleted </div><br /><h2> Volunteer Registry</h2> <?php _shn_vm_viewform_allvol();

}

case 'process_delete':$v = new Volunteer(); $v->delete($getvars['p_uuid']);View::View(); $this->displayConfirmation('The requested user was deleted.'); $extra_opts = array (

'showPictures' => true, 'showAvailability' => true, 'showLocation' => true, 'showStatus' => true, 'showAffiliation' => true

); $this->listVolunteers($dao->getVolunteers(), $extra_opts);

break;

KeyModelControllerView

Old VM Code

Re-factored Code

Page 24: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 24 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Template Engine

View

Template files

Template engine

Cached PHP scripts

data

• Big MVC goal: separate business logic from presentation logic• Template engine: stores presentation logic in templates• “Whiz”, our own lightweight caching template engine• Template files: HTML mixed with specialized presentation logic

{if [condition]} ... {/if}{$someVariable} [echoes variable passed from view]loops

• View passes data to template engine• Template engine translates presentation logic language into PHP code and caches resulting script• example:

becomes

• Improves maintainability and extendibility of interface.

<?php if($numThings > 0) {?>There are <?php echo($numThings); ?> things.

<?php } ?>

{if $numThings > 0}There are {$numThings} things.

{/if}

Page 25: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 25 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Database Schema

Page 26: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Unit testing

Page 27: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 27 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Unit Testing

•Unit Tests done using PhpUnit•Tests written for:

•Data access object file, •Project and the volunteer controllers

•Test Outputs generated in a separate file

function getIdTypes() //{

// get the ID codes and names from the 'field_options' table$result = $this->execute("select option_code, option_description from field_options where field_name = 'opt_id_type'");$id_types = array();while(!$result->EOF){

$id_types[$result->fields['option_code']]= $result->fields['option_description'];$result->moveNext();

}return $id_types;

}

public function testGetIdTypes(){$result = $this->fixture->getIdTypes();$expected = array('nic'=>'National Identity Card', 'pas'=>'Passport', 'dln'=>'Driving License Number', 'oth'=>'Other');$this->assertEquals($result, $expected);}

Unit Test Function:

Original Function:

Page 28: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Touchscreen Project

Page 29: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 29 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

OpenMRS Overview

• Open source medical record system

• Allows design of a customized medical record system

• Implemented in South Africa, Kenya, Rwanda, Lesotho,

Uganda, and Tanzania

• Java-based

• http://www.openmrs.org

Page 30: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 30 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

MVC- Architecture(OpenMRS)

• Touch Screen Monitor is a user interface device where the VIEW aspect is central.

• Touch Screen Interface does not use the Controller or Model just extends the view.• OpenMrs uses Spring MVC Java/J2EE application framework• Unlike Volunteer Management Module were we developed our own MVC framework.

Page 31: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 31 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Touchscreen Package

• Javascript, CSS

• Features:

• On-screen movable keyboard

• Navigation bar

• Scroll buttons

• Enlarges inputs

• Fires events on inputs

• Cross-browser capabilities

• Will transform any HTML document into a usable

touchscreen interface

Page 32: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 32 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

• Touchscreen interface loads through javascript:

• touchscreenToolkit.js

• touchscreenToolkit.css

• openmrsAux.js

• openmrsAux.css

• Interface only shows if module is loaded

Touchscreen Module

Page 33: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 33 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Touchscreen Toolkit Extends View

View

TouchscreenInterface

<openmrs:extensionPoint pointId="org.openmrs.touchscreenExt" type="html">...</openmrs:extensionPoint>

Model

Controller

Page 34: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 34 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

Student Experiences

• Different levels of experience, in different areas • New concepts learned:

• MVC • Templates • Unit Testing • Version control

• Collaborative work atmosphere • Positive experience

• “changed the way I'll approach future projects”• “gave me a better idea of what I want to do with

computer science in the future”• “real-life experience”• “learning experience for a good cause”

Page 35: The 2007 Aidmatrix Summer Institute Humanitarian Free and ...€¦ · The 2007 Aidmatrix Summer Institute in Humanitarian Free and Open Source Software Antonio Alcorn, Giovanni Capalbo,

Slide: 35 Trinity Humanitarian-FOSS Project © 2007 Hartford, CT 30-Jul-07

• NSF CPATH Grant ($496,000, two-years)• Can H-FOSS Help Revitalize Undergraduate Computing Education?• Trinity, Wesleyan and Connecticut College• Community building: Academia, IT Corporations, Humanitarian Orgs.

• 2007-2008 Activities• Fall Independent Study: Develop a workshop • Outreach: SIGCSE Workshop, recruit other schools• Spring: Video conference course• Summer 2008: Summer Institute (10 students), local projects

Looking Ahead