- Introduction to Preparing Data (use instructor's last name as password)
- Tables and records using Access
- How to find unmatched records?
- Querying a database
- See how to import data
- Identifying diabetic patients
- Calculating average cost per diagnosis
- Crosstab query
- Using date functions (number of diagnoses by month)
- How duplicate cases are identified and eliminated
Narrated slides and videos require Flash. Download►
To complete these assignments, you need to download either Microsoft SQL Server or Microsoft Access. Video►
- MAC users should first download and install virtualization software (VirtualBox, VMWare Player/Fusion,
Parallels). Get a copy of an operating system from MSDN (i.e. Windows 10),
or Linux (i.e., Ubuntu, or CentOS). Configure a virtual machine and install the guest operating system.
Note: In this course we will be mostly using VirtualBox, but you can use any virtualization solution.
- Install MS SQL. DreamSpark (with Microsoft software) library is available
free of charge for GMU students. Click on start shopping. Select SQL Server 2014 Express
With Advanced Services With Service Pack 1 32/64-bit (English).
- Use your GMU email to register (without Masonlive, i.e. firstname.lastname@example.org). Do not use your GMU password. Only Microsoft software is available on this site. Software is FREE.
Contact instructor if your password does not work.
Question 1: Import data from the following four files into four tables.
- Identify patients that have diabetes in the above database.
- Calculate the average cost of each diagnosis sorted from most expensive to least expensive. Exclude all bills with negative or 0 values.
- Show if men are more likely to have diabetes than women.
- Calculate which month is most likely to have a diagnosis reported.
Question 2: Download the attached
file of ICD9 codes and descriptions and find the seven errors in the data, where the same ICD9 code has been assigned different descriptions.
Question 3: Download data in three/four zipped files.You can
focus on the entire data or focus on the data for patients who have at least 365
days of encounters. For password contact your
instructor. By opening this file you agree not to share the file with
anyone else. Unzip the files twice, first to get to the directory and then
to get to the actual file. Link to the data into Access or read the data
into Microsoft SQL server. We recommend you use SQL server. To
create the database, open SQL server and right click on the database and start a
new database. Right click on the database, select "Tasks," select "Import
Data," select "Flat File Source" as the source of the data, change file type to
"CSV Files," browse to where you unzipped the files, indicate that field names
are in the first row, select as destination "SQL Server Native Client" file type.
>365 Days Data,
SQL Code to
Visual Guide to Read SQL►
- Remove blanks from numeric data, such as DxAtAge. Convert text data
in the AgeAtDeath to
float. This is typically done through if statements such as these:
- IIF(DxAtAge >0, DxAtAge, Null)
- IIF(AgeAtDeath="Null", Null, cast(AgeAtDeath AS Float))
- Calculate the average age of and the standard deviation of the
diagnosis. Which 10 diagnoses occur first, meaning which diagnosis
occurs at a younger age.
SQL Code & Answer►
- List the top 20 most frequent diagnoses that co-occur. To complete
this task you would need to join the table to itself. Then, use ICD9
code in one table as the first and the ICD9 code in the second table as the
second of the pair. Count the number that match any pair of diagnoses.
- Use STUFF function to concatenate list of unique diagnoses
for the same person. Count numbers of times these lists occur more
than 29 times STUFF
- Identify individuals whose date of death might be in error and have
visits post date of death. Exclude them. Report the top 10 IDs that remain
in order of IDs.
- Rank order diagnosis in order of their reoccurrence for the same person. Rank or Row
Number functions are described on the web. Search for these commands
and look at some examples online. For how many unique persons does the ICD
diagnoses 250.00 repeat twice in the data? Rank
For example, the following tables shows how the rank
order should work for person with ID 1:
||First occurrence of diagnosis 410
||First occurrence of diagnosis 250
||Second occurrence of diagnosis 410
||Second occurrence of diagnosis 250
Question 4: The enclosed file provides data on diabetic patients.
Your objective is to predict if the patient will have diabetes. Prior
to do so, clean the data. Data►