Unformatted text preview:

Homework Assignment 2, HST.950 Handed out: Lecture 6 Due in: Lecture 10 Building a Web-based EMR For this problem, we ask you to explore techniques for how to build a Web-based electronic medical record system. The purpose of the assignment is to convince you, through personal experience, that it is not immensely difficult to do at least a simple job of building such a system, and that the power of the Web and the availability of Web resources makes you very powerful. To keep the assignment within bounds, we make the following assumptions: The EMR will be read-only. I.e., there is no way to enter new data or revise existing data. We will use the CWS database, with which you should already be somewhat familiar from the first assignment. We provide you with a specific implementation environment that already includes some of the basics, from which you can build extensions by re-using patterns and tools already there. The specific environment we provide is one that you are unlikely to have encountered before, though students who have taken 6.171 are likely to have a big leg up. We use the Resin web server, a small and simple Java-based server. The Web site is implemented in JSP (Java Server Pages), which allows you to intersperse HTML fixed content with Java code to compute the dynamic parts of a page. In addition, we have built a few utility classes for Java that you may find helpful (we have) in building this project. And, finally, we have begun a small implementation of the EMR's interface, which you will extend. There are two (and a half) ways to do this part of the problem set: Use a system we have set up especially for the class. <<This option is not available for OCW users.>> Configure your own system to use the same technologies we have set up: 1. Obtain your own copy of the Resin server (which you may use freely for non-commercial development). The current distribution appears to be 2.1.7. Even a "simple" server has an immense number of features and capabilities that lie far outside our intended use. You can find documentation on how to install and run Resin at the Caucho web site or on the "top-level" site on your machine after you have installed it. 2. Install a copy of the CWS database on your machine. You may already have done this for the first homework assignment. I developed this code using the Access version, but currently I am using MySQL and using the jdbc drivers for MySQL that came with Resin. Presumably other methods would work as well if they are supported on your system. Please recall that this database has been "scrubbed", so none of the names, addresses, dates, etc. in the database should correspond to reality, though the original data were all real. Just in (the unlikely) case that we have mistakenly allowed some identifying data past the scrubbing process, please do not make these data public outside our class. 3. If you use Access, for which I don't know of direct jdbc drivers, you will need to define a "System DSN" ODBC data source that references the CWS database. Call the data source "cws". This can be done with "Control Panels\Administrative Tools\Data Sources (ODBC)" on your Windows XP, or something similar on other versions of Windows. 4. Copy the contents of the top-level FTP directory described in the other alternative approach to your machine. You may put it anywhere, but will have to adjust the Resin configuration file to match. I have it at c:\cws. 5. Add definitions to the resin.conf file to define the data source and the cws "web application". The following works on my server: <resource-ref> <res-ref-name>jdbc/cws</res-ref-name> <res-type>javax.sql.DataSource</res-type> <init-param driver-name="com.caucho.jdbc.mysql.Driver"/> <init-param url="jdbc:mysql_caucho://localhost:3306/cwsscrubbed"/> <init-param user=""/> <init-param password=""/> <init-param max-connections="20"/> <init-param max-idle-time="30"/> </resource-ref> and you also need to define the place where the web directory is in your file system: <web-app id='/cws'> <app-dir>C:\cws</app-dir> </web-app> where C:\cws is the location chosen in step 4. If you use Access instead of MySQL, I believe you can just replace the corresponding lines above by <init-param driver-name="sun.jdbc.odbc.JdbcOdbcDriver"/> Harvard-MIT Division of Health Sciences and Technology�� HST.950J: Medical Computing�� Peter Szolovits, PhD Isaac Kohane, MD, PhD Lucila Ohno-Machado, MD, PhD<init-param url="jdbc:odbc:cws"/> The half-method: If you are very comfortable building database-backed web sites (e.g., you have done well in 6.171), feel free to build this any way you like. Explore First, connect to the skeletal server and note the functionality that we initially provide. The main server page simply lists all the patients in the CWS database alphabetically, along with their "PAT_NUM" identifiers. Each name links to a (dynamic) page that will display information specific to that patient. In the skeleton, this includes only demographics and the problem list, though obviously much other data also exists in the CWS database about these patients. Take a look at the index.jsp source code for the top page of the site: <h1>CWS Database</h1> <table border="0" cellspacing="5"> <tr><th>#</th><th>Patient</th></tr> <% SqlAccess s = null; try { s = new SqlAccess("jdbc/cws"); List people = s.retrieveAll("select pat_num,last_name,first_name,title as mid_initl from pat_demograph order by last_name,first_name,mid_initl"); Iterator it=people.iterator(); while (it.hasNext()) { Entity b = (Entity)it.next(); EnglishName n = new EnglishName(b.getS("last_name"), b.getS("first_name"), b.getS("mid_initl")); out.write("<tr><td align=\"right\">" + b.getS("pat_num") + "</td><td><a href=\"pt.jsp?id=" + b.getS("pat_num") + "\">" + n.toString() + "</a></td></tr>\n"); } } finally { if (s!=null) s.close(); } %> </table> This code uses three utility classes defined in the edu.mit.lcs package: 1. SqlAccess: encapsulates connection and access to the database. Provides methods retrieve and retrieveAll that return the results of a SQL query. Retrieve yields an Entity, and retrieveAll yields a List of Entities. 2. Entity: An association-list that is used to represent rows from a relational data base, field names/contents from an HTML form, etc. get retrieves the value associated with its argument, which is a String. getS is like get, but yields an empty string instead of a null. getH is like getS, but


View Full Document

MIT HST 950J - Homework Assignment 2

Download Homework Assignment 2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Homework Assignment 2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Homework Assignment 2 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?