Open Source Telemedicine
Dispatch Layer
Images of phone in this presentation © Google. All rights reserved. This content is excluded
from our Creative Commons license. For more information, see http://ocw.mit.edu/fairuse.
1
Dispatch Layer
Acts as both client and server.
Connects local application components.
(Internal and external).
Acts as a client for communicating with
upstream services.

2
Data Model
Worker
Procedure
Encounter
Subject
Instruction
Set
Observation
Set
Instruction
Observation
Education
Resource
Concept
3
Dispatch Services
Procedure
Worker
Instruction
Set
Authentication
Instruction
Fetch new procedures
Pass Instructions
Education
Resource
Concept
Upload
Fetch Prior patient Encounters
Encounter
Observation
Set
Observation
Register New Patients
Look up existing patients
Subject
4
Implementing on Android Client
Two primary domains we need to
connect to:
1. Internal: within the Android device
and sub domains therein.
2. External: connected to something
outside of the Android environment
5
Internal Connections
Connections within the Sana application
between its components.
Connections between Sana components
and other Applications.
Android OS
ser
vice
Activ
ity
Camera
App
Con
tent
Prov
ider
System
Services
6
Audio
App
Public
Device
Data
External Connections
Connections to services outside of the
domain of the device.
Sana access indirectly through a device
system Service or capabilities.
Web
Service
Android OS
SMS
GW
System
Service
s
Bluetooth
7
Example
Launching an Activity and getting a result:
public void pick(){
Intent i = new Intent(Intent.ACTION_PICK);
i.setType(String);
i.setData(Uri);
startActivityForResult(i,PICK_CODE);
}
public void onActvityResult(int request, int result, Intent data){
if(request == RESULT.OK && request == PICK_CODE){
Intent I = new Intent(Intent.ACTION_VIEW,
data.getData());
startActivityForResult(I,RUN_CODE);
}
}
8
Activity Lifecycle
Diagram from http://developer.android.com.
9
Example
Starting a service:
Service be bound, unbound,
public void service(){
Intent i = new Intent(this, MyService.class);
if(!isBound)
startService(i);
Else
bindService(i,new ServiceConnection(){
//TODO
});
}
10
Service Lifecycle
Diagram from http://developer.android.com.
11
Sana Mobile Client
Dispatcher
Network Layer
Procedure
Engine
Android APIs
Plugins
Data Store
SQLite
Files
External App
ContentProvider
s
Client
User Interaction
3rd party apps
12
MIT OpenCourseWare
http://ocw.mit.edu
HST.S14 Health Information Systems to Improve Quality of Care in Resource-Poor Settings
Spring 2012
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.