Use a custom category set with the API

The following is a description on how to use a custom category set that will map to 211’s taxonomy terms. This will allow the client to maintain its own list of category and subcategory terms.  

Step 1 - Create a custom mapping

A custom category and subcategory mapping can be created that is more intuitive to your users instead of the 211 LA County taxonomy terms. Each category and subcategory needs to be mapped to a Taxonomy term ID. Michigan 211 can help to create a category/subcategory list.  

Step 2 - Store the custom mapping to a database

Store the mappings into a database or text file that can drive your UI to have the user of the application be able to select the services by your category and subcategory set. Below is an example of the structure that needs to be stored.

category

subcategory

taxonomy_term

category

subcategory

taxonomy_term

Child Care

Expectant/New Parent Assistance

LJ-5000.1500

Mental Health

Counseling Services

RP-1400.8000-160

Step 3 - Create a UI that the user is shown your list of categories and subcategories

The user interface will allow the user to select the category, subcategory, and geographic parameters (ex: zip code). The following below is an example of what the user interface might be. 

Step 4 - Get the taxonomy id from the custom database

Once the user has selected the parameters for the query. The taxonomy ID can then be received given the category and subcategory in the custom database.  

Step 5 - Call [GET /services/complete] call with the filter query string parameter

Now that we have the taxonomy ID, a zip code parameter can also be added in the example below. The zip code will only return services that are available for that zip code. 

The filter for this call will be {"$area:like":{"type":"zipcode","$table.field":[{"service_program_taxonomy.taxonomy_id":["FP0700.5000"]}],"name":"48235","distance_info":{"type":"zipcode","name":"48235"}}}

curl -X 'GET' \ 'https://directory-dev.mi-cie.org/v1/services/complete?query=%7B%22%24table.field%22%3A%20%5B%7B%22service_taxonomy.taxonomy_id%22%3A%20%22BD-1800.2000%22%7D%2C%20%7B%22physical_address.postal_code%22%3A%20%2249456%22%7D%5D%7D' \ -H 'accept: application/json' \ -H 'x-api-key: ZGV2ZWxvcG1******tOTg2ODhlMDY4ZGNk' \ -H 'authorization: Bearer eyJraWQiOiJsYmFFa05F***hmsrnqPtCIqhR8-gg'

Response

The following is a sample response from the query

[ { "id": 6227, "organization_id": 4048, "location_id": 4049, "rtm_service_id": 5083, "program_id": null, "name": "FOOD PANTRIES AND PERSONAL CARE ITEMS", "alternate_name": null, "description": "Provides emergency food and personal care items. The personal care items, like shampoo, body wash, toothpaste and toothbrushes are not guaranteed, as it depends on what has been donated.", "url": null, "email": null, "status": "1", "interpretation_services": null, "application_process": "Foodlink Referral required; Foodlink will email referral to pantry as calls come in helpinghands@frontier.com. For personal/grooming supplies, client can call to check availability or Foodlink worker can inquire on referral.", "wait_time": null, "fees": "No fees", "accreditations": null, "licenses": null, "eligibility": "Residents of Cass County; Assistance available 12x per year", "language": null, "payment_accepted": "Not applicable", "required_document": "The head of household must provide current Cass County Photo ID and social security cards for every member of the home. First time guests need a referral from either their caseworker, or from 2-1-1.", "service_area": "Cass County", "region": "GRYP", "contacts": [ { "id": "2309", "organization_id": "4048", "location_id": "4049", "service_id": "6227", "service_at_location_id": "", "name": "", "title": "", "department": "", "email": "" }, { "id": "2310", "organization_id": "4048", "location_id": "4049", "service_id": "6227", "service_at_location_id": "", "name": "Julie Watts", "title": "", "department": "", "email": "helpinghands@frontier.com" } ], "regular_schedule": [ { "id": "7959", "location_id": "4049", "service_id": "6227", "service_at_location_id": "", "weekday": "", "opens_at": "", "closes_at": "", "administrative_hours": "", "service_hours": "Tue and Thu 10am-3pmCome to back door, open vehicle trunk, ring doorbell, a", "site_hours": "" } ], "holiday_schedule": [], "phones": [ { "id": "13308", "organization_id": "4048", "location_id": "4049", "service_id": "6227", "contact_id": "2309", "service_at_location_id": "", "number": "2694458104", "extension": "", "type": "Main", "department": "", "language": "", "description": "" } ], "service_taxonomy": [ { "id": "8738", "service_id": "6227", "taxonomy_id": "BD-1800.2000", "taxonomy_detail": "Food Pantries", "category": "Clothing/Food/Personal Goods/Services", "subcategory": "Food" }, { "id": "8739", "service_id": "6227", "taxonomy_id": "BM-6500.6500-650", "taxonomy_detail": "Personal/Grooming Supplies", "category": "Clothing/Food/Personal Goods/Services", "subcategory": "Material goods" } ], "physical_address": [ { "id": "3937", "location_id": "4049", "attention": "", "address_1": "130 South Broadway Street", "address_2": "", "address_3": "", "address_4": "", "city": "Cassopolis", "county": "Cass", "region": "", "state_province": "MI", "postal_code": "49031", "country": "USA" } ], "locations": [ { "id": "4049", "organization_id": "4048", "organization_name": "HELPING HANDS OF CASS COUNTY", "name": "HELPING HANDS OF CASS COUNTY", "alternate_name": "Helping Hands", "description": "From Dowagiac: M62-downtown Cassopolis. Address is 130 S. Broadway (Just past the intersection of M-60 & M-62 (State & Broadway). From Edwardsburg: M62 to M60. At M-60 (State St.) turn left. At light by courthouse turn left. Helping Hands will be mid-bloc", "transportation": "No public transportation available", "latitude": "41.9102900", "longitude": "86.0126026" } ] } ]