MEDICATIONS COSTS USING SQL

I use medication data from a simulated hospital database on the Sythea website for analyzing in this post.

The medications table have columns such as ‘start date’, ‘stop date’, ‘patientid’, ‘encounterid', ‘descriptions’, ‘base_cost’, ‘dispense’, ‘total cost’.

pasted-movie.png

Another table called ‘encounters’ have information about the encounters that patients get medications with total claim costs for encounters. Two tables are merged together.

pasted-movie.png

I found some abnormalities such as no ‘stop date’ that means medications might provide for abnormal duration of time leading to very high costs.

pasted-movie.png

Therefore, I decide to filter data from encounters that last for 1 year (360 days).

pasted-movie.png

I save out this table to csv file then connect to Tableau to analyze and visualize data.

From 1959 to 2024, there are 117 patients with 8,884 encounters for 6 types of visits in this dataset.

Number of encounters and total medication costs over years as following:

pasted-movie.png

Medication costs by encounter typespasted-movie.png

Medication cost - total claim cost ratio by the encounter types.

pasted-movie.png

In this dataset, there are many encounters in which the medication costs is higher than total claim costs. I can’t explain these abnormalities.

Abnormal medication cost ratio occurs among encounter types with numbers as following:

pasted-movie.png

In these encounter sub-groups, the medication cost is higher than total claim costs, especially some encounters have ratios more than 20.