We begin by loading in the data. Once this is done, and we have the testing, training, and validation datasets for both demographic and encounter data, we can join these two datasets to get demographics on the patient level rather than the encounter level.

Once the data is prepped, we can group on the sex field to get patient counts by sex.

Finally, we use the plotly package to plot the results.