联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2019-03-16 11:05

COMP0004 Coursework Part II

Purpose: To develop an application with a GUI to display data.

Submission: There is a single submission deadline for all the coursework in this module: Noon

22nd March 2019. You can complete this part at anytime before the deadline.

While working on your code, the project files and source code (no compiled code) should be stored

in a GitHub repository, so that you are using version control properly.

Marking: This part of the coursework is worth 40% of the module mark.

On Moodle you will find a link to some data files on GitHub in Comma Separated Value (CSV)

format. The files contain synthetic patient data, with each line in the file representing one patient.

The example below is the first two lines representing patients in the file patients100.csv:

3e9fd20e-b81c-4698-a7c2-0559e10361fa,

1979-08-24,,999-46-5746,S99951588,X43863756X,Mrs.,Norah104,Stamm704,,Hagenes547,M,wh

ite,french,F,Hanover Massachusetts US,678 Trantow Overpass,New Bedford,Massachusetts,

02740

71917638-8142-42da-87f1-

fa0ba642f161,1989-10-21,,999-95-8365,S99995552,X3761822X,Mr.,Eloy929,Dickinson688,,,M,wh

ite,english,M,Dover Massachusetts US,431 Armstrong Forge,Upton,Massachusetts,01568

As you can see, each line is a sequence of strings separated by commas. Each string represents a

piece of information about a patient. These are the fields or columns used to describe a patient,

and are in the same order on every line. You can load a .csv file into a spreadsheet (e.g., Excel) to

more easily view the data. In the data files provided commas are used only as separators between

strings, which means a line can be easily split into a collection of column strings by splitting it at

each comma.

The first line of the patients.csv file does not represent a patient, instead it gives the column name

for each column, also separated by commas:

Inadequate

(0-39)

Failed to demonstrate a basic understanding of the concepts used in the

coursework, or answer the questions. There are fundamental errors, code will not

compile, or nothing of significance has been achieved. (F)

Just

Adequate

(40-49)

Shows a basic understanding, sufficient to achieve a basic pass, but still has

serious shortcomings. Code may compile but doesn’t work properly. Not all

concepts have been understood or the questions answered correctly.(D)

Competent

(50-59)

Reasonable understanding but with some deficiencies. The code compiles and

runs, the concepts are largely understood. This is the default for a straightforward,

satisfactory answer. (C)

Good

(60-69)

A good understanding, with possibly a few minor issues, but otherwise more than

satisfactory. The code compiles, runs and demonstrates good design practice.

Most expectations have been met. Most questions answered.(B)

Very Good

(70-79)

A very good understanding above the standard expectations, demonstrating a

clear proficiency in programming. All core questions answered.(A)

Excellent

(80-100)

Programming at a level well above expectations, demonstrating expertise in all

aspects. This level is used sparingly only where it is fully justified. Q1-5 answered

very well, significant progress on either Q6 or Q7. (A+, A++)

1 of 3

COMP0004 Part II Coursework

ID,BIRTHDATE,DEATHDATE,SSN,DRIVERS,PASSPORT,PREFIX,FIRST,LAST,SUFFIX,MAIDEN,

MARITAL,RACE,ETHNICITY,GENDER,BIRTHPLACE,ADDRESS,CITY,STATE,ZIP

The meaning of the names is obvious, for example FIRST and LAST give the first and last name of

each patient (note this is synthetic data so the names have a numerical code attached - just treat

these as part of the name).

If you look through the data you will see that for some patients a column entry may be left blank,

and you see two commas in a row (i.e., Stamm704,,Hagenes547). Beware that the final column

(ZIP) can be left blank, so that there will be a comma followed by newline.

The first column, ID, is a unique id for each patient. The id is effectively the primary key for each

patient and is what you use to uniquely identify each patient. A few other columns such as SSN

and PASSPORT should be unique but are not usually used as primary keys. The rest of the

columns will not contain unique values and you will certainly find that names and addresses

appear multiple times.

There are four patients files on GitHub:

? patients100.csv - 100 patients

? patients1000.csv - 1000 patients

? patients10000.csv - 10000 patients

? patients100000.csv - 100000 patients

These are all in the same format. For development you want to work with the smallest file, but your

code should work with the larger files as well.

Core Questions

Q1. Write a class to represent a Patient, so that each object holds one patient record

corresponding to one line in a .csv file. This should be a POJO class (plain old Java object), and is

just used for holding patient data, providing getter and setter methods. Think about how you store

the data - separate instance variables or would a data structure be better?

Q2. Write a class ReadCSV that provides methods to read a .csv file and return a List<Patient>

data structure, add any private methods needed for the implementation.

Q3. Write a class JSONFormatter that provides methods to return a JSON representation of a

single patient and for all patients. The JSON should be well-formed. You have to write all the code

to generate the JSON yourself and cannot use a JSON library. As you will be doing a lot of String

manipulation investigate the StringBuilder class, as this is much more efficient at building strings

that the String class itself.

Q4. Write a class Model that does the following:

Has a readFile method that uses the ReadCSV class to read an input file and generate the

Patient objects.

Holds the list of Patient objects once they have been generated by the ReadCSV class.

Provides getter methods to access the patient data, for example, get a single JSON structure for

all patients, get a JSON structure for a single patient, get the names or ids for all patients, and so

on. Add these getter methods as you need them, including others that you find you need. Don’t

try to write them all first, only when you actually need a method!

Note, while working on Q1-4 you will want a temporary Main class so that you can compile, run

and test out the code you are writing. This class will probably keep changing, but that is normal!

2 of 3

COMP0004 Part II Coursework

Q5. Write a GUI to create a simple dashboard application that runs on the desktop. The

dashboard should support at least the following:

Save a JSON format file, and the ability to read it back in again as an alternative to .csv format.

Display the list of patients in a list view, so that when one is selected the full patient information

is displayed.

Support searching by at least the patient name and ideally by other fields as well. Searches

can display multiple results.

Add additional functionality as you are able, such as simple statistics (e.g., average age or age

distribution), most common year of birth, and so on.

The GUI may be built in Swing, but you can use JavaFX if you want to. The emphasis is on

creating a straightforward and neat UI rather than something more extravagant!

The GUI, in one or more classes, should only contain code to handle input and display of

information. All other processing should be done by the other classes, each of which should focus

on one set of functionality. The UI itself should only make use of public methods in class Model to

connect with the rest of the code, and should not make direct use of the other classes.

Remember the principles of programming to an interface and Separation of Concerns, along with

keeping classes cohesive (i.e., focussed on one abstraction or one behaviour). You may find that

the Model class, at least, will need to be split into several classes as you add code, and you may

want to introduce one or more Controller classes to coordinate the interaction between the UI and

the Model class(es).

Challenge Questions

(These are hard, don’t worry if you don’t have time to do these questions, focus on Q1-5).

Q6. Add the ability to store the data in a SQL relational database.

Q7. On GitHub you will find a collection of data files with names ending in 100.csv. These provide

much more structured data for the patients100.csv file. Each file uses the patient ID as a key to link

patients records together. Extend your code from Q1-5 (and 6 if you have done it) to work with

these files, to provide a more complex dashboard for displaying and searching patient data. It is up

to you how much and what functionality you provide.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp