In [ ]:
# If you haven installed pandas and matplotlib, uncomment these and run this cell:
#!pip install matplotlib
#!pip install pandas
In [3]:
import metatab
import pandas as pd
import matplotlib.pyplot
%matplotlib notebook
matplotlib.style.use('ggplot')
doc = metatab.open_package('..') # Assumes you started Jupyter in the same dir as the metadata file
# To run this from the package on the web
package_url='http://metatab.sandiegodata.org/zip/dss.ca.gov-residential_care_facilities-2017-1.zip'
doc = metatab.open_package(package_url)
doc
Out[3]:
California Residential Elder Care Facilities
dss.ca.gov-residential_care_facilities-2017-1
A list of licensed Residential Elder Care Facilities (RCFEs) from the California Department of Social Services.
Homepage CA DSS Care Facilities Home Page
Origin dss.ca.gov
Resources
facilities - data/facilities.csv
age_income_tract - data/age_income_tract.csv
geocoded-geographies - data/geocoded-geographies.csv
In [9]:
fac_resource = doc.resource('facilities')
fac = fac_resource.dataframe()
# Print out the errors, if there are any. The first version of the facilities file we downloaded was corrupt, with a
# lot of CSV formatting errors. We've asked for an update.
for k,v in fac.metatab_errors.items():
print(k, list(v)[0]) # Just print the first error on this field.
other_typea Failed to cast '07/07/2015, 01/27/2015, 01/09/2013, 09/10/2012' (<class 'rowpipe.valuetype.core.FailedValue'>) to int in 'other_typea': invalid literal for int() with base 10: '07/07/2015, 01/27/2015, 01/09/2013, 09/10/2012'
unfounded_allegations Failed to cast '07/27/2016' (<class 'rowpipe.valuetype.core.FailedValue'>) to int in 'unfounded_allegations': invalid literal for int() with base 10: '07/27/2016'
total_visits Failed to cast '98767, 87303(a)' (<class 'rowpipe.valuetype.core.FailedValue'>) to int in 'total_visits': invalid literal for int() with base 10: '98767, 87303(a)'
inspect_typeb Failed to cast '02/13/2015, 01/22/2015, 01/15/2015, 10/29/2014' (<class 'rowpipe.valuetype.core.FailedValue'>) to int in 'inspect_typeb': invalid literal for int() with base 10: '02/13/2015, 01/22/2015, 01/15/2015, 10/29/2014'
facility_capacity Failed to cast 'LICENSED' (<class 'rowpipe.valuetype.core.FailedValue'>) to int in 'facility_capacity': invalid literal for int() with base 10: 'LICENSED'
facility_zip Failed to cast '92683 0' (<class 'rowpipe.valuetype.core.FailedValue'>) to int in 'facility_zip': invalid literal for int() with base 10: '92683 0'
inspect_typea Failed to cast '10/24/2016' (<class 'rowpipe.valuetype.core.FailedValue'>) to int in 'inspect_typea': invalid literal for int() with base 10: '10/24/2016'
In [10]:
fac_resource
Out[10]:
facilities - data/RCFE02052017.csv
Header Type Description facility_type text
facility_number integer
facility_name text
licensee text
facility_administrator text
facility_telephone_number text
facility_address text
facility_city text
facility_state text
facility_zip integer
county_name text
regional_office integer
facility_capacity integer
facility_status text
license_first_date text
closed_date text
last_visit_date text
inspection_visits integer
complaint_visits integer
other_visits integer
total_visits integer
citation_numbers text
poc_dates text
all_visit_dates text
inspection_visit_dates text
inspect_typea integer
inspect_typeb integer
other_visit_dates text
other_typea integer
other_typeb integer
complaint_type_a integer
complaint_type_b integer
total_allegations integer
inconclusive_allegations integer
substantiated_allegations integer
unfounded_allegations integer
col41 text
In [5]:
fac.T # A good way to get a view of all columns and their typical values.
Out[5]:
0
1
2
3
4
5
6
7
8
9
...
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
facility_type
RCFE-CONTINUING CARE RETIREMENT COMMUNITY
RCFE-CONTINUING CARE RETIREMENT COMMUNITY
RCFE-CONTINUING CARE RETIREMENT COMMUNITY
RCFE-CONTINUING CARE RETIREMENT COMMUNITY
RCFE-CONTINUING CARE RETIREMENT COMMUNITY
RCFE-CONTINUING CARE RETIREMENT COMMUNITY
RCFE-CONTINUING CARE RETIREMENT COMMUNITY
RCFE-CONTINUING CARE RETIREMENT COMMUNITY
RCFE-CONTINUING CARE RETIREMENT COMMUNITY
RCFE-CONTINUING CARE RETIREMENT COMMUNITY
...
RESIDENTIAL CARE ELDERLY
RESIDENTIAL CARE ELDERLY
RESIDENTIAL CARE ELDERLY
RESIDENTIAL CARE ELDERLY
RESIDENTIAL CARE ELDERLY
RESIDENTIAL CARE ELDERLY
RESIDENTIAL CARE ELDERLY
RESIDENTIAL CARE ELDERLY
RESIDENTIAL CARE ELDERLY
RESIDENTIAL CARE ELDERLY
facility_number
15601302
216801686
330907913
197802543
421700369
191501662
191501668
565801963
374603618
374603617
...
347004853
496803611
490111878
435202020
435202420
366413280
197607821
397004511
397004913
435294321
facility_name
ACACIA CREEK - UNION CITY
ALDERSLY
ALTAVITA
ATHERTON BAPTIST HOMES
ATTERDAG VILLAGE OF SOLVANG
BRETHREN HILLCREST HOMES
BRITISH HOME IN CALIFORNIA LTD, THE
BROOKDALE CAMARILLO
BROOKDALE CARLSBAD
BROOKDALE CARMEL VALLEY
...
ZEPHYR COVE RESIDENTIAL CARE
ZIMPHER RCFE
ZIMPHER RESIDENTIAL CARE HOME
ZION CARE HOME I
ZION CARE HOME II
ZION HOMECARE, INC
ZION RESIDENTIAL CARE
ZOSING CARE HOME
ZOSING CARE HOME II
ZUZZETTE'S RESIDENTIAL CARE HOME
licensee
MASONIC HOMES CAL & ACACIA CREEK, MASONIC SEN LIV
ALDERSLY/LIFE CARE SERVICES,LLC
AIRFORCE VILLAGE WEST INC & ESKATON PROPERTIES...
ATHERTON BAPTIST HOMES
SOLVANG LUTHERAN HOME, INC.
BRETHREN HILLCREST HOMES
BRITISH HOME IN CALIFORNIA, LTD THE
S-H OPCO CAMARILLO,LLC-BKD TWENTY-ONE MGT CO,INC
S-H OPCO CARLSBAD LLC/BKD TWENTY-ONE MNGMNT CO...
S-H OPCO CARMEL VALLEY LLC/BKD 21 MNGMNT CO INC
...
ANDERSON, PAULINA
ZIMPHER RCFE
ZIMPHER, GREG A. & KAREN
ZION CARE HOMES, INC.
MARILOU A. PABLO
ZION HOMECARE, INC
ZION RESIDENTIAL CARE, INC.
GENE VELASQUEZ
ANGELICA P.VELASQUEZ
ECHEVERRIA, ZUZZETTE M.
facility_administrator
CHARLES MAJOR
CLARA ALLEN
BRUCE CAMERON
MARY MONNIER
CHRIS PARKER
MATTHEW NEELEY
MARLENE RAINEN
VINCENT GONZAGA
SASHA HIGHTOWER
JASON MCDONALD
...
ANDERSON, PAULINA
BLANCAFLOR,JOSEPHINE
BLANCAFLOR, JOSEPHINE D
MARILOU A. PABLO
PABLO, MARILOU
LEONEL C. HONRADA
ARTHUR AGUILAR
ANGELICA VELASQUES
VELASQUEZ, ANGELICA & GENE
ECHEVERRIA, MARIA
facility_telephone_number
(510) 441-3700
(415) 453-7425
(951) 697-2000
(626) 289-4178
(805) 688-3263
(909) 593-4917
(626) 355-7240
(805) 388-8086
(760) 720-9898
(858) 259-2222
...
(916) 393-3065
(707) 829-8539
(707) 829-8539
(408) 890-0084
(408) 926-9949
(909) 370-2271
(818) 620-2202
(916) 955-1033
(209) 955-1033
(408) 723-2334
facility_address
34400 MISSION BLVD.
326 MISSION AVENUE
17050 ARNOLD DRIVE
214 SOUTH ATLANTIC BLVD.
636 N ATTERDAG ROAD
2705 MOUNTAIN VIEW DRIVE
647 MANZANITA AVE
6000 SANTA ROSA ROAD
3140 EL CAMINO REAL
13101 HARTFIELD AVENUE
...
75 ZEPHYR COVE
476 EILEEN DR
476 EILEEN DRIVE
3592 PINE RIDGE WAY
14881 SAN PABLO AVENUE
2165 STEWART ST.
16654 SAN FERNANDO MISSION BLV
2777 WISTERIA LANE
2815 MIRASOL LANE
5103 CAMDEN AVENUE
facility_city
UNION CITY
SAN RAFAEL
RIVERSIDE
ALHAMBRA
SOLVANG
LA VERNE
SIERRA MADRE
CAMARILLO
CARLSBAD
SAN DIEGO
...
SACRAMENTO
SEBASTOPOL
SEBASTOPOL
SAN JOSE
SAN JOSE
COLTON
GRANADA HILLS
STOCKTON
STOCKTON
SAN JOSE
facility_state
CA
CA
CA
CA
CA
CA
CA
CA
CA
CA
...
CA
CA
CA
CA
CA
CA
CA
CA
CA
CA
facility_zip
94587
94901
92518
91801
93463
91750
91024
93012
92008
92130
...
95831
95472
95472
95127
95127
92324
91344
95212
95212
95124
county_name
ALAMEDA
MARIN
RIVERSIDE
LOS ANGELES
SANTA BARBARA
LOS ANGELES
LOS ANGELES
VENTURA
SAN DIEGO
SAN DIEGO
...
SACRAMENTO
SONOMA
SONOMA
SANTA CLARA
SANTA CLARA
SAN BERNARDINO
LOS ANGELES
SAN JOAQUIN
SAN JOAQUIN
SANTA CLARA
regional_office
15
21
18
28
29
28
28
31
8
8
...
27
21
21
26
26
18
31
27
27
26
facility_capacity
376
122
770
518
188
574
41
140
125
125
...
4
6
6
5
6
6
6
6
6
6
facility_status
LICENSED
LICENSED
LICENSED
LICENSED
LICENSED
LICENSED
LICENSED
LICENSED
LICENSED
LICENSED
...
LICENSED
PENDING
LICENSED
CLOSED
CLOSED
CLOSED
LICENSED
LICENSED
LICENSED
CLOSED
license_first_date
5/20/2010
11/5/2004
12/22/1989
3/31/1999
5/28/1993
7/2/1976
5/1/1976
8/29/2014
8/29/2014
8/29/2014
...
9/30/2011
None
10/22/1993
1/2/2008
None
10/9/2007
9/29/2009
1/29/2010
12/30/2011
4/21/2009
closed_date
None
None
None
None
None
None
None
None
None
None
...
None
None
None
5/19/2014
8/29/2016
10/1/2013
None
None
None
4/8/2013
last_visit_date
4/3/2015
4/4/2016
1/18/2017
12/20/2016
1/26/2017
1/24/2017
10/14/2015
1/20/2017
10/20/2016
9/9/2016
...
2/9/2016
3/7/2016
2/8/2016
5/19/2014
9/8/2016
10/3/2013
9/19/2016
6/10/2016
6/10/2016
6/19/2013
inspection_visits
1
2
1
1
1
1
1
0
0
0
...
2
0
2
1
0
2
1
2
2
1
complaint_visits
0
0
3
2
0
2
5
7
8
5
...
0
0
1
0
1
0
0
0
0
2
other_visits
0
0
4
1
5
4
0
3
7
11
...
2
3
1
1
5
0
0
1
1
19
total_visits
1
2
8
4
6
7
6
10
15
16
...
4
3
4
2
6
2
1
3
3
22
citation_numbers
None
None
87465(g), 87211(a)(1)(D)
None
None
87705(c)(3), 87705(f)(2), 87705(f)(1), 87303(e...
87468(a)(3), 87224(f), 87468(a)(3)
87468(a)(1), 87355(c), 87303(a), 87468(a)(2), ...
87465 a 5 , 87465 a 1 , 80072 (a) 1, 8, 87465,...
87465(g), 87464(d), 87464(d), 87456, 87456a(4)...
...
87465(h)(2) , 8765(h)(5), 1569.69, 87307(a) , ...
None
87465(a)(5), 87465(e), 87309(a), 87303(a)(2), ...
87309(a), 87203
HS1569.44(a)(1), 87608(a)(5)(B), 87303(e)(5), ...
None
None
87705(c)(5), 87303 e2, 87506(a), 87303(c), 873...
87705(c)(5), 87465(e), 87303(c), 87506(a), 874...
87112 (a)(a), 87465(a)(5), 87464(f)(3), 87224(...
poc_dates
None
None
11/05/2013, 11/05/2013
None
None
09/25/2014, 09/23/2014, 09/23/2014, 09/25/2014...
10/28/2015, 07/29/2013, 08/12/2015
01/23/2017, 12/05/2014, 04/15/2016, 04/08/2016...
08/31/2015, 05/15/2015, 02/20/2015, 02/19/2015...
12/02/2015, 12/02/2015, 12/22/2015, 12/02/2015...
...
02/10/2016, 02/23/2016, 02/23/2016, 08/01/2013...
None
05/15/2013, 05/15/2013, 12/11/2015, 12/11/2015...
05/06/2013, 05/06/2013
06/09/2016, 05/06/2014, 05/09/2014, 05/06/2014...
None
None
05/25/2016, 03/28/2013, 05/31/2016, 05/31/2016...
05/25/2016, 05/31/2016, 05/31/2016, 05/31/2016...
06/19/2013, 02/23/2013, 02/23/2013, 02/23/2013...
all_visit_dates
04/03/2015
04/04/2016, 10/25/2012
01/18/2017, 10/12/2016, 10/12/2016, 03/22/2016...
12/20/2016, 02/16/2016, 03/25/2015, 02/29/2012
01/26/2017, 11/02/2015, 09/01/2015, 06/22/2015...
12/18/2015, 07/21/2015, 10/02/2014, 10/02/2014...
10/14/2015, 07/29/2015, 07/22/2013, 07/22/2013...
01/11/2017, 04/06/2016, 04/06/2016, 04/06/2016...
10/20/2016, 06/14/2016, 01/27/2016, 11/24/2015...
03/28/2016, 03/28/2016, 03/24/2016, 03/23/2016...
...
02/09/2016, 10/08/2013, 07/25/2013, 02/24/2012
03/07/2016, 02/08/2016, 02/08/2016
02/08/2016, 12/10/2015, 05/14/2013, 04/16/2013
04/29/2013, 05/19/2014
09/08/2016, 08/31/2016, 08/23/2016, 06/08/2016...
10/03/2013, 10/10/2012
09/19/2016
06/10/2016, 05/24/2016, 02/27/2013
06/10/2016, 05/24/2016, 02/27/2013
06/19/2013, 04/08/2013, 04/05/2013, 03/14/2013...
inspection_visit_dates
04/03/2015
04/04/2016, 10/25/2012
12/10/2012
02/29/2012
05/18/2012
09/23/2014
02/14/2013
None
None
None
...
02/09/2016, 07/25/2013
None
12/10/2015, 04/16/2013
04/29/2013
None
10/03/2013, 10/10/2012
09/19/2016
05/24/2016, 02/27/2013
05/24/2016, 02/27/2013
05/24/2012
inspect_typea
0
0
0
0
0
6
0
0
0
0
...
1
0
9
0
0
0
0
2
1
0
inspect_typeb
0
0
0
0
0
0
0
0
0
0
...
4
0
4
2
0
0
0
5
5
0
other_visit_dates
None
None
01/18/2017, 03/22/2016, 11/05/2013, 10/29/2013
03/25/2015
01/26/2017, 11/02/2015, 09/01/2015, 06/22/2015...
10/02/2014, 10/02/2014, 10/02/2014, 04/24/2014
None
01/11/2017, 12/03/2014, 08/26/2014
10/20/2016, 06/14/2016, 01/27/2016, 11/24/2015...
03/28/2016, 03/24/2016, 03/15/2016, 03/10/2016...
...
10/08/2013, 02/24/2012
03/07/2016, 02/08/2016, 02/08/2016
02/08/2016
05/19/2014
09/08/2016, 08/31/2016, 08/23/2016, 06/08/2016...
None
None
06/10/2016
06/10/2016
04/08/2013, 04/05/2013, 03/14/2013, 03/05/2013...
other_typea
0
0
0
0
0
0
0
1
4
1
...
0
0
1
0
4
0
0
0
0
20
other_typeb
0
0
1
0
0
2
0
2
2
2
...
0
0
0
0
6
0
0
0
0
4
complaint_type_a
0
0
1
0
0
0
2
0
2
5
...
0
0
2
0
1
0
0
0
0
4
complaint_type_b
0
0
0
0
0
0
1
2
1
0
...
0
0
1
0
0
0
0
0
0
0
total_allegations
0
0
3
7
0
1
5
10
12
7
...
0
0
4
0
1
0
0
0
0
7
inconclusive_allegations
0
0
1
3
0
1
1
5
1
3
...
0
0
0
0
0
0
0
0
0
1
substantiated_allegations
0
0
2
0
0
0
3
2
3
2
...
0
0
1
0
1
0
0
0
0
6
unfounded_allegations
0
0
0
4
0
0
1
3
8
2
...
0
0
3
0
0
0
0
0
0
0
col41
None
None
None
None
None
None
None
None
None
None
...
None
None
None
None
None
None
None
None
None
None
37 rows × 11267 columns
In [6]:
# Save the facility addresses so we can send them to the Census geocoder
# https://www.census.gov/geo/maps-data/data/geocoder.html
sdfac = fac[fac.facility_city == 'SAN DIEGO'][['facility_number', 'facility_address',
'facility_city','facility_state', "facility_zip"]]
sdfac.to_csv('../data/sandiego.csv')
In [ ]:
Content source: CivicKnowledge/metatab-packages
Similar notebooks: