Bokeh legend not mapped to specified field in source

I’ve created a bokeh app that displays birth data at the county and state levels between 1990 and 2007. The issue is that the legend I’ve defined doesn’t display information for all of the factors in the specified column (‘race’). Here is my source code:

from bokeh.io import output_notebook, output_file, show, curdoc
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, HoverTool, Slider, CDSView, BooleanFilter, NumeralTickFormatter
from bokeh.palettes import Spectral as palette
from bokeh.layouts import widgetbox, row, column
from bokeh.transform import factor_cmap
source = ColumnDataSource(data=dict(final_merge.reset_index()))

races = ['black', 'hispanic', 'other', 'white']

def set_bools(yr, lvl):
    return [True if (year == yr) and (level == lvl) else False for year, level in zip(source.data['year'], source.data['level'])]

def set_views(boolean):
    return CDSView(source=source, filters=[BooleanFilter(boolean)])

p1 = figure(x_axis_label = 'Number of Births', y_axis_label = 'Percentage of Births',
                title='Harris County Births 1990-2007', x_range=(0, x_max + 10000), y_range=(0, y_max + 5))
p2 = figure(x_axis_label = 'Number of Births', y_axis_label = 'Percentage of Births',
                title='Texas Births 1990-2007', x_range=(0, x_max + 10000), y_range=(0, y_max + 5))

bools1, bools2 = set_bools(1990, 'county'), set_bools(1990, 'state')
view1, view2 = set_views(bools1), set_views(bools2)

c1 = p1.circle(x='total', y='percent', size=10, color=factor_cmap('race', palette[4], races), legend='race', source=source)
c2 = p2.circle(x='total', y='percent', size=10, color=factor_cmap('race', palette[4], races), legend='race', source=source)

c1.view, c2.view = view1, view2
p1.legend.location = 'bottom_right'
p2.legend.location = 'bottom_right'

hover1 = HoverTool(tooltips=[('Total Births','@total'),('Percentage of All Births','@percent%')])
hover2 = HoverTool(tooltips=[('Total Births','@total'),('Percentage of All Births','@percent%')])

p1.add_tools(hover1)
p2.add_tools(hover2)

p1.xaxis[0].formatter = NumeralTickFormatter(format="0,")
p2.xaxis[0].formatter = NumeralTickFormatter(format="0,")

def update_plots(attr, old, new):
    time = slider.    value
bools1, bools2 = set_bools(time, 'county'), set_bools(time, 'state')
    view1, view2 = set_views(bools1), set_views(bools2)
    c1.view, c2.view = view1, view2
slider = Slider(start=1990, end=2007, step=1, value=1990, title='Year')
slider.on_change('value', update_plots)
layout = row(widgetbox(slider), p1, p2)

curdoc().add_root(layout)

I suspect that the error may have to do with the views I’ve defined because the legend is mapped correctly when I remove them, but the points are displayed incorrectly (obviously). When I view the plots, the glyph for ‘black’ is mapped correctly to the legend, but the other categories (‘hispanic’, ‘white’, ‘other’) appear as black dots in the legend although they appear correctly on the plot. Thanks in advance for the help!