Health and Public Health Knowledgeblog http://health.knowledgeblog.org Enhancing your Health Knowledge Wed, 09 May 2012 15:18:56 +0000 en-US hourly 1 https://wordpress.org/?v=5.0.3 Applied Public Health Intelligence http://health.knowledgeblog.org/2011/07/25/applied-public-health-intelligence/ http://health.knowledgeblog.org/2011/07/25/applied-public-health-intelligence/#respond Mon, 25 Jul 2011 15:11:33 +0000 http://health.knowledgeblog.org/?p=148

Author: Neil Bendel, Head of Health Intelligence, NHS Manchester

Neil introduces public health intelligence in context of the wider healthcare setting.  He details the policies that have had the greatest influence in public health, the skills required in public health intelligence, partnership working and needs assessments.

This video precedes with the one included in the Joint Needs Assessment article.

]]>
http://health.knowledgeblog.org/2011/07/25/applied-public-health-intelligence/feed/ 0
Disease Prevalence Modelling http://health.knowledgeblog.org/2011/07/25/disease-prevalence-modelling/ http://health.knowledgeblog.org/2011/07/25/disease-prevalence-modelling/#respond Mon, 25 Jul 2011 12:55:23 +0000 http://health.knowledgeblog.org/?p=128

Author: David Lamb, Salford NHS

(based on Health Knowledge materials)

Disease prevalence modelling estimates the number of people with a disease or risk factor in a population when direct evidence such as local surveys, is not available.  In January 2011 the Association of Public Health Observatories (APHO) published a technical report on prevalence modelling.  It outlines why there is a need, methods, validation procedures, projections and forecasts using models, and the strengths and limitations . They also produce prevalence models for Cancer, Dementia, Diabetes and many others that are available for download.

In this video, David outlines some examples of disease prevalence modelling whilst highlighting the information sources, statistical and validation methods and how the estimates were used.

]]>
http://health.knowledgeblog.org/2011/07/25/disease-prevalence-modelling/feed/ 0
Survival Analysis for Public Health http://health.knowledgeblog.org/2011/07/25/survival-analysis-for-public-health/ http://health.knowledgeblog.org/2011/07/25/survival-analysis-for-public-health/#respond Mon, 25 Jul 2011 11:39:39 +0000 http://health.knowledgeblog.org/?p=101

Author: Dr. Richard Emsley, Post Doctoral Research Fellow, University of Manchester

Survival analysis encompasses a variety of methods for analysing the timing of events. The variable (we are interested in) is the time from a well-defined start point to the occurrence of a particular event or endpoint.  The most typical being death.  However, survival analysis can be used in many kinds of scenarios that have a defined start point: e.g., in social sciences  it is used to analyse events such as birth of children, divorce and marriage.

This video provides an introduction to survival analysis for public health intelligence analysts by Dr. Richard Emsley.  He covers two main topics: survival analysis and the definitions of survival rates.  The exercises that Richard covers will be added into the e-Lab.

]]>
http://health.knowledgeblog.org/2011/07/25/survival-analysis-for-public-health/feed/ 0
Introduction to Surveillance http://health.knowledgeblog.org/2011/07/25/introduction-to-surveillance/ http://health.knowledgeblog.org/2011/07/25/introduction-to-surveillance/#respond Mon, 25 Jul 2011 11:24:56 +0000 http://health.knowledgeblog.org/?p=156

Authors: Dr. Paul Jarvis, University of Manchester and Dr. Alex Keenan, Health Protection Agency

The World Health Organisation defines public health surveillance as “the continuous, systematic collection, analysis and interpretation of health-related data needed for the planning, implementation, and evaluation of public health practice.”  In the UK the Health Protection Agency (HPA) monitors our public health by identifying and responding to health emergencies caused by disease, chemicals, etc.; and providing data and information to government to inform decision making.  In 2013 the HPA will be incorporated into the Public Health England.

The video below presents a short, but comprehensive introduction to surveillance.  Paul is a post-doctoral researcher and as part of his works provides software to aid in public health surveillance.

In addition, the introduction to epidemiology, given by Dr. Alex Keenan from the HPA, covers why surveillance is important; what systems there are in place;  and why data quality is crucial.   The slides from the talk are shown here:

]]>
http://health.knowledgeblog.org/2011/07/25/introduction-to-surveillance/feed/ 0
Basic Statistics for Epidemiology: Risk http://health.knowledgeblog.org/2011/07/22/basic-statistics-for-epidemiology-risk/ http://health.knowledgeblog.org/2011/07/22/basic-statistics-for-epidemiology-risk/#respond Fri, 22 Jul 2011 16:32:44 +0000 http://health.knowledgeblog.org/?p=198

Author: Sara Muller, University of Keele

(based on Health Knowledge materials)

Risk has a very similar meaning in epidemiology as it does in everyday usage – it is about chance.  It is defined by Unwin et al, as “the probability that an event will occur

It is often used to compare the risk of an event between groups.  There are lots of ways to define the groups you might want to compare. For example, socio-demographic factors, or exposure to factors that may cause the disease.

There are several measures of risk, and we will deal with each in turn in this article.

  1. Absolute risk = incidence rate
  2. Relative risk
  3. Attributable risk
  4. Odds Ratio

A worked example deals with the association between smoking and cancer.

Lung Cancer

Yes No
Ever Smoked Yes 70 60
No 20 90

Absolute Risk

Absolute risk of lung cancer by smoking status

Smokers: \[70/70+60 = 70/130\] \[=0.538\]

Non-smokers: \[20/20+90 = 20/110\] \[=0.181\]

Relative Risk

The relative risk is the ratio of absolute risk (incidence rates).  Relative risk measures the strength of association between an exposure and a disease.  Groups are usually defined by exposure to a potential determinant/cause of the disease, but can be similar things, such as gender.

\[incidence rate of disease in group with exposure/incident rate of disease in group without exposure\]

If the result is:

<1        exposure decreases risk of disease

0        exposure has no effect on risk of disease

>1        exposure increases risk of disease

Using the absolute risks above the relative rate would be:

\[0.538/0.181 = 2.97\]

Those people who have ever smoked are 3 times more likely to die of lung cancer over a 15 year period than those who have never smoked.

Attributable Risk

Attributable risk measures the proportion of disease in the population (or just in the exposed group) that can be ‘attributed’ to the exposure.  It can be expressed in any of the same ways as a proportion.

AR population = incidence rate population – incidence rate non-exposed

AR exposed = incidence rate exposed – incidence rate non-exposed

An example of attributable risk is below:

Population incidence rate = \[70+20/70+20+60+90 = 90/240 = 0.375\]

AR population = \[0.375 – 0.181 = 0.194\]

AR exposed = \[0.538 – 0.181 – 0.357\]

This suggest that in the 15 year follow up period, 19% of lung cancer deaths in the population and 36% in smokers can be attributed to smoking.

Odds Ratio

Compare the odds of an event of interest between two groups using a ratio.  It is not the same as a risk ratio, although it will give similar results if the disease is rate.  It is often used in case-control studies.

Odds of exposure among cases/odds of exposure among controls.

If we to continue the example above the odds ratio calculation would be as follows:

Odds of disease in exposed = \[70/20\]

Odds of disease in unexposed =  \[60/90\]

Odds ratio = \[70/20/60/90 = 70*90/20*60 = 5.25\]

Those people how have ever smoked had 5.25 times the odds of developing lung cancer in the 15 year follow up period those who had never smoked.

]]>
http://health.knowledgeblog.org/2011/07/22/basic-statistics-for-epidemiology-risk/feed/ 0
Visual Presentation of Public Health Data http://health.knowledgeblog.org/2011/07/22/visual-presentation-of-public-health-data/ http://health.knowledgeblog.org/2011/07/22/visual-presentation-of-public-health-data/#respond Fri, 22 Jul 2011 14:08:08 +0000 http://health.knowledgeblog.org/?p=146

Author: Shelley O’Neill (NW SHA) and Georgina Moulton (University of Manchester)

(based on materials from Health Knowledge)

Presentation of results in Public Health is arguably the most important skill an analyst should possess. Charts and maps are always included in reports such as, JSNA and Health Impact Assessments to show results of analyses.

Shelley introduces the different ways in which results can be presented and when to use them.

]]>
http://health.knowledgeblog.org/2011/07/22/visual-presentation-of-public-health-data/feed/ 0
Basic Statistics for Epidemiology: Prevalence vs Incidence http://health.knowledgeblog.org/2011/07/22/basic-statistics-for-epidemiology/ http://health.knowledgeblog.org/2011/07/22/basic-statistics-for-epidemiology/#respond Fri, 22 Jul 2011 13:28:39 +0000 http://health.knowledgeblog.org/?p=172

Author Sara Muller, University of Keele (based on material from Health Knowledge)

Epidemiology vs Clinical Medicine

There are lots of definitions of epidemiology, but the one below is fairly comprehensive:

“…the study of the distribution and determinants of health-related states or events in specified populations, and the application of this study to control of health problems”

In short, epidemiology is sort of the who what, when, why, how and where of disease.  It doesn’t involve any experimentation or clinical trials, so it is really of interest to public health, because it is just about what happens.

A concept most people are probably familiar with is ‘clinical medicine’, where interest is in the individual patient and you want to see large and clinical relevant changes in that patient. In the case of a clinical trial, you might be interested in these relatively large changes in a select group of people. For example: Will this painkiller reduce the level of pain in this patient so that they are comfortable?

Epidemiology differs from clinical medicine, because the unit of interest is the population, not the individual. In epidemiology, we are interested in small changes that have an effect on the population level. For example, the slight raising of your cholesterol leads to only a very slight increased risk of you dying from a coronary heart disease, but if everyone in a population increased their cholesterol level very slightly, there would be a big jump in the total number of CHD deaths in the population.

Factors Affecting Health

There are many factors that can affect health.

At the biological level, our genetic heritage may make us susceptible to specific conditions such as hypertension, sickle cell anaemia, Cancer and haemophilia.

Then there is how we live – how much we exercise, what we eat, what we drink and what we might smoke. That some societies seem to live longer than others probably reflects differences in the interaction of these factors.

Then there is the environment. Hippocrates, ‘the father of medicine’, was one of the first to identify the environment as determinant. He noted that the seasons had an impact and the influence of where people lived.  It was a prophetic suggestion, later borne out in modern society. Along with the innovations of Industrial Revolution came urbanisation and in particular problems of squalid housing, poor sanitation and polluted water supplies. Concern at the combined effect of these factors gave rise to the first Public Health Act of 1848.

More latterly, the shrinking of the earth through advances in transport has now made it easier than ever for individuals – and diseases – to move freely across the globe. Whilst economic progress has many advantages there can be positive and negative impacts on health.

We often have to think about these more in epidemiology and public health than in other areas of medicine because we do not control for these things, e.g. in a RCT, we randomise out many of the effects

Quantifications of disease in population

Absolute counts of the incidence of disease is important, but just relying on counts makes it difficult for comparisons to be made. The bigger a population, the larger the number of cases is likely to be. One way to get around this is to consider the number of cases in relation to the population as a whole. Several possible approaches are possible and we shall review some of the more frequently encountered methods.

Ratio (also known as odds)

e-Lab link: http://elabdemo.nweh.org.uk

Calculating the ratio is the foundation for the calculation of many other measures.

a number/another number

where the two numbers are separate e.g. number of males, number of females and the same person is not counted in each group and the size of both or either group can change.

It allows the comparison between the number of people with disease in one population with the number of people with the disease in another population.  It doesn’t have any unit.

Let’s take an example of the number of deaths in males and females. We have the total number of deaths in each gender.

2005 all cause mortality

Females                      269,368

Males                          243,324

Divide number of deaths in females, by number of deaths in males to get the female to male death ratio.

\[ 269,368/243,324 = 1.107 \]

Proportion

Proportion is the fraction of a population who have a characteristic of interest.  Those who are included in the numerator are also included in the denominator.  As the numerator is a subgroup of the denominator the value is always between 0 and 1.  Values can be expressed as a percentage by multiplying by 100.  Again this is a dimensionless quantity, so it has no units.

Examples of proportion include:

  • Proportion of men in a population
  • Proportion of people in a sample with diabetes

Using the same example as before, let’s consider the proportion of deaths that are in females, rather than the ratio of female to male deaths.

The proportion of deaths that were in females:

\[ 269368/512692 = 0.525 \]

We can alternatively present this as 52.5%.

Rate

Rates provide a common time frame and unit of population. They allow a direct comparison of frequency of disease. Two requirements for the rate calculation are: (1) time frame and; (2)  a unit of population.

\[ Frequency of observed event in a given time period/total number in whom event might occur in that time period. \]

The denominator includes all those who are eligible to appear in the numerator i.e., those at risk of the observed event.

Time frame is important, especially if your event of interest is death: everyone will die at some point, so the time period has to be defined to get a sensible answer

An example is based around a group of 742 people with knee pain. They were followed up for 3 years after completing a survey. During the follow-up, the group as a whole consulted their GPs 202 times for knee surgery.

Rate of consultation for knee surgery was:

\[  202/742*3 = 202/2226 = 0.091 consultation per person per year. \]

Prevalence Rate

The prevalence rate is a measure of the proportion of a population affected by a specific condition in a specified time period.  Prevalence itself is the number of people in a population who have the disease of interest in a particular time period.  This isn’t very useful, as the larger the number of people in the population, the more people might have the disease, so a prevalence rate (often referred to simply as prevalence) is what we really want to know.

\[ Number of cases of disease in given time period/total number in population in that time period \]

Be careful to specify your total population properly in terms of socio-demographic and environmental factors. In looking at the prevalence of cervical cancer, you wouldn’t want to include men in the denominator as the prevalence estimate would be far too low.

Prevalences are usually given in three ‘types’:

  1. Point prevalence: relates to prevalence with respect to a specific point in time – Did you have an asthma attack on Monday?
  2. Period prevalence: related to prevalence over a defined period of time – Did you have an asthma attack in January?
  3. Lifetime prevalence: Have you ever had an asthma attack?

An example is based on the number of responders to a survey reporting knee pain in the past month.

All responders to a survey aged 50+                                                   787

Responders reporting knee pain in the past month                           287

The one prevalence rate of knee pain in the responders of the survey:

\[ 2874/7878 = 0.365 \]

Alternatively, this can be presented as 36.5% or 365 per 1,000 responders

Incidence Rate

Incidence is the number of new cases of a disease in a population.  As when considering prevalence, because of different population sizes, it is usual to consider a rate.

\[ Number of new cases of disease in given time period/total number in population at risk at that time period \]

For the calculation:

  • The time period should be specified, as the number of incident cases can be made arbitrarily large or small depending on the length of the time period being considered.
  • ‘At Risk’ population.  People who already have the disease at the start of the time period are not included in the denominator – if they already have the disease, they are not at risk of developing it.

Depending on your question, you might want to consider first ever instances of disease, or just new cases during your time period.  For example, if you consider back pain, you might want any flu where that episode of flu started during your 1 month time period of interest, or you might want any flu that started during your 1 month time period and where that was the first time that person had had flu.  This decision will change who is a member of our ‘at risk’ population.  Others ways of defining your ‘at risk’ group might be age, immunisation status, gender (don’t look at cervical cancer in men!)

Responders to BHPS with new CVD in 2007                                       264

Responders to BHPS with no new CVD in 2007                               1309

The one year incidence in CVD in responders to this survey is:

\[ 264 /13097+264 = 0.020 per year \]

Alternatively, this can be expressed as 2.0% per year or 20 per 1000 responders per year

Prevalence vs Incidence

So hopefully the difference between prevalence and incidence rates are clear, but they are related – along with the average duration of disease.  The following relationships hold:

Low incidence, long duration – chronic diseases, e.g. asthma, diabetes

High incidence, short duration – acute, common diseases, e.g. cold, chicken pox in children

Preventative measures might lower incidence, e.g. vaccination, public health campaigns, whereas clinical interventions may reduce decrease duration, or decrease mortality, resulting in an increase in disease duration.

This whole process can be seen in the following diagram.

Prevalence rates are generally used to describe the extent of a disease in a particular population whereas incidence rates look at the rate at which new cases of disease develop.  Whilst prevalence can be affected by how long people live with a condition, incidence does not take this into account

Prevalence is descriptive, often demonstrating public health ‘need’. On the other hand, incidence is useful for studying the causes of disease (the aetiology) or to look at the order in which events occur.  In disease with long durations and very low levels of incidence, there may be little difference between prevalence and incidence.

]]>
http://health.knowledgeblog.org/2011/07/22/basic-statistics-for-epidemiology/feed/ 0
Joint Strategic Needs Assessment http://health.knowledgeblog.org/2011/07/20/joint-strategic-needs-assessment/ http://health.knowledgeblog.org/2011/07/20/joint-strategic-needs-assessment/#respond Wed, 20 Jul 2011 13:12:18 +0000 http://health.knowledgeblog.org/?p=150

The Joint Strategic Needs Assessment (JSNA) has become a standard piece of work that has been conducted by local authorities and PCTs since the Local Government and Public Involvement in Health Act in 2007.  It is the responsibility of the Directors of Public Health, and Children’s and Adult Social Services.

An essential tool for commissioners, a JSNA identifies current and future health and wellbeing needs of a local population, in order to inform priorities and targets, and commissioning of services to reduce health inequalities.  It assesses the needs over a three to five year period, but often will include a longer term consideration of changes in demography and infrastructure developments.  Many groups and individuals contribute to the needs assessment, for example, public health nurses, social care, environmental health officers, teachers, health promotion trainers, GPs and midwives.

A strategic needs assessment differs to other needs assessments in that it is used to set strategic priorities rather than informing specific decisions.

An introduction to JSNAs is provided by Neil Bendel from the Greater Manchester Joint Health Care Unit in the video.

Further details about JSNAs can be found from useful websites:

Department of Health: http://www.dh.gov.uk/en/Publicationsandstatistics/Publications/PublicationsPolicyAndGuidance/DH_081097

Lancashire County Council (There dedicated team that concentrates on JSNA and other needs assessments have produced a useful resource that include needs assessment and other report templates): http://www.lancashire.gov.uk/office_of_the_chief_executive/lancashireprofile/jsna/needsassessments.asp

]]>
http://health.knowledgeblog.org/2011/07/20/joint-strategic-needs-assessment/feed/ 0
Essentials of SQL: Exercises http://health.knowledgeblog.org/2011/06/22/essentials-of-sql-exercises/ http://health.knowledgeblog.org/2011/06/22/essentials-of-sql-exercises/#respond Wed, 22 Jun 2011 13:45:58 +0000 http://health.knowledgeblog.org/?p=91

Authors: Georgina Moulton (georgina.moulton@manchester.ac.uk) and Lucy Bridges (lucy.bridges@manchester.ac.uk)

Queries modified from various internet resources including SQLZoo.net

Use the schema below for the AdventureWorksLT database to complete the exercises.

SQL Adventure Works LT Schema

Remember at each stage to comment your query and save it.

Exercise 1

You should have the AdventureWorksLT database schema.  From the information provided can you identify what is a primary key, a foreign key and the type of relationship between the tables.

Exercise 2

Scenario:

AdventureWorks management is attempting to learn more about their customers and they would like to contact each one by email and/or phone to see whether they would complete a survey.  You have been asked to produce a list of customers.

The main tasks in this exercise are:

Identify which table contains the information you require

Check what fields the table holds

Generate a table by using the SELECT statement with the FROM clause.

Exercise 3

Scenario

The marketing department needs a list of the top 15 most expensive items ordered by product number, which includes the fields: product number, list price and product name.

Task 1: Use the ORDER BY clause to format a result set

Identify the correct table in the database that contains the information you need.

Write a SELECT statement that includes, product name, list price and product number.

Sort the row by the list price in descending order column.

Execute the query and browse the result set.

Task 2: Use the ORDER BY and the DESC keyword to sort the list price

Add to the SELECT statement in Task 1, sort by product number in ascending order.

Look at the new result set.

Task 3: Add the TOP statement to get the most expensive items

Add the TOP statement to get the 15 most expensive items.

What is the most expensive item?  What is the 15th most expensive item?

 

 

Exercise 4

Scenario

The marketing department (again!) want a distinct list of customers for their campaign.  In their list they need the their full name and the company they are affiliated to.

Task 1: Identify the table

Task 2: Write the SELECT statement that retrieves the correct fields for marketing

Task 3: Make sure the list is a distinct list of customers

 

Exercise 5a

Scenerio

We wish to contact the company ‘Bike World’ via email.  Get the name and email address for this company.  Retrieve this details from the correct table using a SELECT statement and the WHERE clause.

Exercise 5b

Scenario

Select all customer names that have SalesPersons jillian or jose.

 

Exercise 6

Scenario

The marketing department is conducting an audit of catalog inventory of socks and tights.  In order to increase sales for these products, they have determined that most a willing to spend between £7.00 and £100.00 for these items.  They also think that the most popular sizes bought are M and L.  They have requested a list of all items the company carries within these parameters.

Task 1: Using a Comparison operator

Identify the table that holds the information you want to retrieve.

Generate a table using the SELECT statement using a comparison operator so that the ListPrice must be lower than £100.

Look at your results. How many data entries do you retrieve?

Task 2: Using the AND and LIKE operators

Building on the query in task 1, add that the Product Name column contains the string ‘Sock’.

Look at the results. How many data entries do you retrieve?

Task 3: Using the OR operator

Change the query from Task 2 so that you include rows with the Tights as well as Socks in the Name Column.

Execute the query and look at the results.  Browse the result set and note the additional rows for tights.

Task 4: Using more comparison operators!

Change the query to select rows to display all socks that are now between list prices £7.00 and £100.00.

Browse the results and note the number of rows that have changed and the column data that matches the new search conditions.

Task 5: Adding a condition that limits ‘tights’ to M and L

Add a search condition that limits the tights to sizes ‘M’ and ‘L’.

Execute the query and see how the results have changed. How have they changed?

Exercise 7

Scenario

The Finance department are investigating again, especially the postal charges that are directly related to weight and size of the product.  They would like a list of all products so they can make corrections in the system.

The main task for this exercise are as follows:

  • Generate a table using the SELECT statement with the NULL function
  • Generate a table using the SELECT statement with the IS NULL function
  • Generate a table using the SELECT statement with the ISNULL function to rename values
  • Use the CASE statement to rename values for different items
  • Generate a table using the SELECT statement with the ISNULL function and the COALESCE and CONVERT functions

Task 1: Using the NULL function

Write a query that retrieves rows from the product table that includes, product number, name, size and weight. Use the = operator to check the Size and Weight for a NULL value.

Browse the result set and note the total number of rows.  How many are there?

Task 2: Using the IS NULL function

Change the statement to IS NULL to select rows with a value of NULL in either the Size or Weight columns.

Task 3: Using the ISNULL function to rename values

In a new query window, enter and execute a SELECT statement that:

Access the product table

Displays the Product Number, Name, Size and Weight columns

Use the ISNULL() function to display ‘NA’ when a NULL value is encountered in the Size column

Browse the result and note the additional column and values

Also make a note of the column headings

Task 4 Using the CASE statement to substitute size and weight values for products

If the size value is null then substitute the value with NA.

Using the CASE statement, substitute the weights with specific values. If the weight is equal to null then introduce the following weights for these items:

Helmet                         4.00

Fork                             10.00

Socks                            1.00

Jersey                          2.00

Any other item           2.00

Task 5: Generate a table using the SELECT statement with the ISNULL function and the COALESCE and CONVERT functions

 

Rewrite the statement from task 3 using the COALESCE function to create a new column named Measurement so that:

If the Weight column has a value it is shown in the Measurement column

If the Weight column is NULL, but the Size column is not NULL, display the value in the Measurement column

If both columns have NULL values display ‘NA’

Exercise 8

Scenario

The products team are updating the system and need to make sure the sell start date, and discontinued date are in the system for all products that have a defined sell end date.  If there is no discontinued date then they are going to insert the date that is 10 years ahead of today’s date.  In addition, they also want to know the number of days that have elapsed since the sell end date and today.  They have passed the job over to you!  Create a table with headers that matches the requirements defined by the products team.

Exercise 9

Scenario

The Finance department want to know what is the total number of sales (in pounds) they have made each year. Write the SELECT Statement:

Task 1: Identify table for information required

 

Task 2: Identify a function that will allow you to retrieve the Year from the OrderDate

 

Task 3: Use the SUM function to add the TotalDue

 

Task 4: Order by and group by Year

 

Exercise 10

Scenario

You have been asked by the sales department to provide the average price for each product category.

Exercise 11

Scenario

Give the CompanyName of those customers with orders over £100000. Include the subtotal plus tax plus freight.  This query requires a join statement.

Task 1: Identify tables you need to get required information

Task 2: Identify common fields that link the tables together

Task 3: Write SELECT statement that mirrors the tasks above with the joins being in the FROM statement

 

Task 4: Add WHERE statement to make sure orders are over £100000.

Task 5: Group results by Company Name.

Exercise 12

Scenario

Where did the racing socks go? List the product name and the CompanyName for

— all Customers who ordered ProductModel ‘Racing Socks’.

Task 1: Identify tables you need to get required information

Task 2: Work out the common fields that link the tables together

Task 3: Write the SELECT statement that joins the tables together using the common fields

Task 4: Add a WHERE statement to restrict the query to Racing Socks.

Exercise 13

Scenario

Can you show the CompanyName for all customers with an address in City ‘Dallas’?

Exercise 14

Scenario

We have been asked by the Products team for some information about every product and its description for those that have a culture originating in English (En).  This information is required so that they know what is coming from England.  They are not really interested at this stage about other cultures, but they could be in future requests.

Task 1:  Identification of tables for information

As usual, identify the tables that are required for the product information.

Task 2: Identify common fields in tables to link them together

Identify the common fields in the tables identified in task 1 that link them together.

Write the query that joins them together and selects the product identifier, culture, product description, product model name

Task 3 :Filtering for the ‘en’ culture

Adding to the query in task 2, retrieve only products that come from an English (en) culture.

Exercise 15

Scenario

We have been asked by the AdventureWorks Finance Department to find out the total amount due from two customers Walter Brian and Walter Mays on all orders they have placed.  It is worth noting each time a customer places an order they are treated as a new customer, so they get a separate record.

Task 1: Investigating the Customer table for customers who have first name Walter

Using a simple SELECT statement retrieve all customers who have first name Walter.  What do you notice?  How many people have the first name?

Task 2: Grouping the customer records

Change the query from task 1 so that you group the records according to their last name.

Task 3: Identify table that you need to get the TotalDue information and join tables

Having identified the table you need to get the TotalDue information from, identify the common field that links that and the Customer table together.

Using the query from task 2, add the join statement that joins the two tables together

Task 4: Adding the TotalDue information using the SUM function

For each customer sales order, there is a total due, thus we need to add the total due figures together to produce one figure for the finance department.

Introduce in the SELECT statement a clause that adds the total due figures together and displays this figure.

Exercise 16

Scenario

The AdventureWorks team have been rung up by a customer ‘Mary’ and have jotted down a message that she would like a catalogue.  Unfortunately, the customer’s last name was not recorded, thus they do not know where to send the catalogue!  We have been asked to produce a list of all customers and their addresses with first name Mary. They need the information that will allow them to send a catalogue; for example, title, full name, company name and full address, including postal code etc. in alphabetical order for the last name.

Task 1:Investigating the tables to use

Identify the tables that contain the customer and address information for the mailing labels.

Conduct a query that will allow you to see all contents of each of the tables.

Task 2: Identifying customers that have first name ‘Mary’ and order according to last name

Using the Customer table, identify all customers that have first name ‘Mary’

Restrict the query to the information you require for mailing labels and make sure they are alphabetically ordered by last name.

Task 3: Retrieving the customer addresses

Look at how the address and customer tables can be linked together (hint: it may require the link of another table – remember you are looking for common fields).

Identify the fields that you require for the mailing list and note which table they come from.

Using the query from task 2, change it so, it can include the address fields.

Hint: this will require joining tables together!

Use aliases when possible to refer to the tables as it makes the query easier to read.

Task 4: Format the result by concatenating strings and assign column new names

Using the query above, concatenate the name together for one column called ‘Customer Name’and a column for each of the following information:

Address line 1

Address line 2

City, State Province, Postal Code as AddressLine3

CountryRegion

Task 5: Alter the query and use the SUBSTRING function

Instead of displaying the first name in full as Mary, we now just want to display the first name as initial.  Using the query form the previous task, modify it by using the substring function, to just pick out the initial M for Mary.

Exercise 17

Scenario

AdventureWorks have asked you to find all products with a minimum standard cost (that is equal to the product standard cost) for products in colours Blue, Yellow and Black.  This exercise is about writing subqueries, so we will write the query in two sections.

Part 1:  Inner query

Write a SELECT statement that retrieves the minimum standard cost for products grouped in colour as Blue, Yellow and Black.  Make sure the standard cost is above 0.0.

Part 2: Outer query

Write a SELECT statement that retrieves the product name, list price, colour from the product table and minimum standard cost (which will come from the inner query of part 1).

Now add an inner join statement that has the part 1 query as the table as the first part of the expression. Make sure this is in brackets. Give this statement and alias, such as msc.

For the ON part of the join statement, make sure the colour from the inner query is the same as the colour from the outer query AND the minimum standard cost of the msc table, is the same as the standard cost of the product.

Exercise 18

Scenario

For each product category in each colour, the products department want to know how many products come in each colour and the average list price.  Again this is a subquery exercise that includes both joins, group by and aggregate functions.

Part 1: Inner query 1 – (Derived table col)

Write a SELECT statement that retrieves the product category identifier, colour count and average list price for each product category identifier and colour from the SalesLT.Product table.  Also in your statement, make sure that if the colour is not recorded than substitute with ‘N/A’.

Part 2: Outer query

In this outer query we are to join the product category table onto the derived table col using an inner join on product category identifiers.

Write a SELECT statement that retrieves the product category name, colour, colour count and average list price.  In the FROM statement insert inner query 1 in brackets and make sure you give it the alias as col.

Now do an inner join linking to the product category table, on the fields product category identifier.

Order the results by product category name and colour.

Hard Exercise 19

Scenario

How many products in ProductCategory ‘Cranksets’ have been sold to an address in ‘London’?

 

Hard Exercise 20

Use the SubTotal value in SaleOrderHeader to list orders from the largest to the smallest. For each order show the CompanyName and the SubTotal and the total weight of the order.

Optional Exercises

Can you answer the following question?

How many items with ListPrice more than $1000 have been sold?

A “Single Item Order” is a customer order where only one item is ordered.  Show the SalesOrderID and the UnitPrice for every Single Item Order.

Answers

The answers to the exercises can be be found in the document SQL Exercise Answers . Do try to work them out for yourself before looking at them. However, if you are having difficulty it can be useful to work backwards from the answer.

]]>
http://health.knowledgeblog.org/2011/06/22/essentials-of-sql-exercises/feed/ 0
What is Public Health? http://health.knowledgeblog.org/2011/05/23/what-is-public-health/ http://health.knowledgeblog.org/2011/05/23/what-is-public-health/#respond Mon, 23 May 2011 13:36:01 +0000 http://health.knowledgeblog.org/?p=73

Author: Georgina Moulton (georgina.moulton@manchester.ac.uk)

Acknowledgements: HealthKnowledge syllabus and content

What is the first issue you think of when considering Public Health?

Is it the cholera epidemic in 1800s?  Or, the obesity epidemic in the noughties?

Public Health is something that we come into contact with every day of the week.  Just be reading the headlines of the newspapers we know what the current issues are with regards to the individuals and populations health; who will be affected, who and how it can be improved; and who disagrees.  In May 2011, the following headlines are around:

‘Five cups of coffee a day could beat breast cancer’

‘Caesarean risk: New research finds C-section babies are more likely to become obese in later life’

The newspapers and other published articles in journals, magazines and on the internet can influence our behaviour by how they are reported.

The foundations of Public Health start in 19th Century. John Gaunt (the father of epidemiology) analysed statistics of the mortality data.  The bills of mortality were issued weekly for London parishes detailing the number and causes of death.  His epidemiological work laid the foundations for statistical writings that served the basis for the great sanitary reforms of the 19th century.  Epidemiology is the science that underpins public health.

One of the first public health was the cholera epidemic.  Many theories had been formulated for the cause of this including the ‘bad air’ theory, but in 1849 John Snow published the “The Mode of Communication of Cholera”, where he discussed that cholera was spread through contaminated water rather than bad air.   He proved his theory through the investigation of the Broad Street pump in Soho towards the end of 1854.  Eventually the pump was removed and the number of cases diminished.  This discovery was the end of cholera in Britain.

This work, plus many more in the 1800s, lead to a number of Government Acts that improved the quality of environment and health of the population.

Public Health Definition

The definition of health from the World Health Organisation changed between 1948 and 1984 from:

“A state of complete physical, mental and social well-being and is not merely the absence of disease or infirmity.” to

“The extent to which an individual or group is able to realise aspirations, satisfy needs and to change or cope with the environment “

Although quite aspirational, these definitions reflect that health is not just concerned with the healthy wellbeing of a person, but also their social-wellbeing; and in 1984 there is a move away from looking only at individual health, but also the health of the population.  In the UK particularly, we have developed a healthcare framework that provides services to address health and social care for the individual and population.  The NHS ranges from primary care to secondary care and community based.

Public Health has been defined by Chief Medical Officers as:

“The science and art of preventing disease, prolonging life, and promoting health through the organised efforts of society” (Acheson 1988 in the Public Health in England report)

“Public health is concerned with improving the health of the population, rather than treating the diseases of individual patients.” (Chief Medical Officer)

Both statements highlight the importance of improving and not just treating the populations’ health, but also that this cannot be achieved alone and that society must share the responsibility.

The Faculty of Public Health sets to implement this through assuring an effective public health workforce, promoting public health knowledge and advocating for the very best conditions for good health.”

How we view and the indicators we use to determine the health of an individual and the health of the population are highlighted in the table below.

Individual Population
History Symptoms of illness Indicators of population health
Examination Signs of illness, bio- chemical tests Surveillance, epidemiological information, Health Needs Assessment
Diagnosis Label to describe what has gone wrong Key health issues
Prognosis Outlook associated with individual disease Outlook associated with trends and disease patterns
Treatment Individual interventions Population based interventions, Health Protection, screening, Vacc & Imm, NSFs

Public Health Functions

The main functions as defined by the (Faculty of Public Health) of public health are: (1) health protection; (2) health and social care; and (3) health improvement.  Most people are familiar with the idea of public health professionals of helping improve the nations’ health through the promotion and encouragement of healthy lifestyles (e.g., stop smoking; 5-a-day or increase in exercise) through the consideration of individuals wider determinants of health (figure x). These include: lifestyle factors such as drinking and smoking; social and community influences (e.g., does the community feel safe?); living and working conditions, for example. If houses are damp this could exacerbate asthma; and socioeconomic factors such as air pollution, unemployment levels.

However, public health also focuses on managing environmental health and communicable disease, emergency planning and disease and injury prevention. As well as considering the effectiveness and quality of healthcare interventions and services.  It will investigate whether the deployed resources are the best to meet the population needs; ensure that clinical guidelines are in place; audit and evaluate the services; and service planning via the commissioning cycle.

A large part of the Public Health agenda revolves around decreasing inequalities in health.  In February 2004, the Wanless Report highlighted the effect of socio-economic inequalities on health outcomes in the UK.  He stated that the “Persistent socio-economic inequalities in the UK, combined with a greater severity of market failures affecting lower socio-economic groups, seem to have contributed to significant inequalities in health outcomes which, unless tackled, will present a significant barrier to many in society becoming ‘fully engaged’”.

There are targets to reduce the differences in Life expectancy and Infant Mortality rates. These are often closely associated with deprivation.  For example, in the  NW, the health of people in Stockport, Flyde and Cheshire East is better than the national average while the health of people in Manchester, Knowsley, Liverpool are generally worse. One of the biggest factors for inequalities is premature CHD deaths. This is often something Public Health teams will target in an attempt to reduce inequalities.

A number of actions can be executed in order to reduce health inequalities:

•         Working with parents and children to influence their future health

•         Improving access to care

•         Tackling major killers (e.g., CHD and cancer have a large influence on overall inequalities in mortality and ill health)

•         Tackling the wider determinants of health through partnership working

Key Policies that have Influenced Public Health

Along with Wanless, there are a number of key papers and policies that have influenced the focus and development of public health.  The figure above shows the key polices since 1976 to the present day.  Before the late 1990s reports and white papers where relatively infrequent. However, with the drive of improving the NHS from the Labour Government, the number proliferated in conjunction with the increase in financial resource.  These focused on improving the nations’ health by providing ..  In fact the Wanless Report stated that “in order to meet people’s expectations and to deliver the highest quality over the next 20 years, the UK will need to devote more resources to health care and that this must be matched by reform to ensure that these resources are used effectively.

Each of these policies or initiatives had an impact on public health.  However, the largest change in the NHS and Public Health is yet to come with the publication of the Liberating the NHS White Paper (see article Changing Landscape in PHI).

All these white papers lead to a shift in how the NHS functions from a reactive service to a proactive service where the patient has responsibility for his/her own health and treatment is driven by the health needs of the local community and is delivered at the primary care level rather than the hospital (see table below).

Earlier decades 21st century
Treatment emphasis Public Health emphasis
Demand led priorities Needs-driven priorities
Hospital care centred Primary Care Centred
Provider dominated Consumer empowered
Professional opinion and therapeutic fashions Evidence-based standards
]]>
http://health.knowledgeblog.org/2011/05/23/what-is-public-health/feed/ 0