Class: API

API


new API(config, _locale)

A service for making requests from the symptom checker api

Parameters:
Name Type Description
config Configuration

A reference to the configuration for this instance.

_locale Locale

A reference to the locale instance to bind to. This makes it possible for the application to clear its cache during run time language changes.

Members


<inner> search :search

For searching against titles and keywords on the Symptom Checker API.

Type:
  • search

Methods


<inner> clearCache()

For clearing the in-memory cache, like for a mid-session language change


<inner> getBodyAreas(callback)

This requests the body area index and performs a callback

Parameters:
Name Type Description
callback requestCallback

with err, titles

Returns:

callback(err, [bodyarea])

Type
requestCallback

<inner> getDosageTables(age, callback)

This requests a dosage table index for the specified age group and performs a callback.

Parameters:
Name Type Description
age string

'adult', 'peds'

callback requestCallback

callsback with err, titles

Returns:
  • callback with err, titles
Type
requestCallback

<inner> getFirstAid(callback)

This requests the first aid index and performs a callback.

Parameters:
Name Type Description
callback requestCallback

callsback with err, titles

Returns:
  • callback with err, titles
Type
requestCallback

<inner> getHelp(age, callback)

This requests the supplemental index and performs a callback

Parameters:
Name Type Description
age string

'adult', 'peds'

callback requestCallback

callsback with err, titles

Returns:
  • callback with err, titles
Type
requestCallback

<inner> getIndex(age, callback)

This requests a symptom checker index for the specified age and performs a callback

Parameters:
Name Type Description
age string

'adult', 'child', 'peds', or an age in number of days

callback requestCallback

callsback with err, titles

Returns:
  • callback with err, titles
Type
requestCallback

<inner> getParentAdvice(callback)

This requests the parent advice index and performs a callback.

Parameters:
Name Type Description
callback requestCallback

callsback with err, titles

Returns:
  • callback with err, titles
Type
requestCallback

<inner> getParentAdviceCategories(callback)

This requests the parent advice category index and performs a callback

Parameters:
Name Type Description
callback requestCallback

with err, categories

Returns:

callback(err, [category])

Type
requestCallback

<inner> getParentAdviceTopic(id, callback)

This requests a parent advice topic with id and performs a callback

Parameters:
Name Type Description
id string

the id for the topic

callback requestCallback

callsback with err, topic

Returns:
  • callback(err, topic)
Type
requestCallback

<inner> getSpecialTopic(type, id, callback)

This requests a special topic with id and performs a callback

Parameters:
Name Type Description
type string

the type of topic (image, specialtopic, dosage)

id string

the id for the topic

callback requestCallback

callsback with err, topic

Returns:
  • callback(err, topic)
Type
requestCallback

<inner> getTopic(id, callback)

This requests a symptom checker topic for the specified id performs a callback

Parameters:
Name Type Description
id string

the id for the topic

callback requestCallback

callsback with err, topic

Returns:
  • callback(err, topic)
Type
requestCallback

<inner> getUrl(path)

Creates a symptom checker api request url using the path for the requested resource

Parameters:
Name Type Description
path string

the path component for the requested resource, omiting parameters, those should be appended to the url after it is formed

Returns:

url - url with required authentication parameters for symptom checker api request

Type
string

<inner> hyperlinkDosageTables(age, str, topiclinkCallback, requestCallback)

This gets the dosage tables for an age group, parses their titles into keywords and marks up the provided string with hyperlinks to the dosage table topics.

Parameters:
Name Type Description
age string

'adult', 'peds'

str string

a string that containing dosage table keyword references

topiclinkCallback topiclinkCallback

callsback with url for special topics

requestCallback requestCallback

callsback with err, titles

Returns:
  • callback with err, titles
Type
requestCallback

<inner> searchKeywords(age, searchstring, callback)

For searching the symptom checker, dosage table and first aid keywords for an age group

Parameters:
Name Type Description
age string

specifying the age group 'adult' or 'child' to get the searchable titles for

searchstring string

specifying the search string to use.

callback requestCallback

a callback function providing (err, keywords)


<inner> searchParentAdviceKeywords(searchstring, callback)

For searching parent advice keywords

Parameters:
Name Type Description
searchstring string

specifying the search string to use.

callback requestCallback

a callback function providing (err, keywords)


<inner> searchParentAdviceTitles(searchstring, callback)

For searching the parent advice titles

Parameters:
Name Type Description
searchstring string

specifying the search string to use.

callback requestCallback

a callback function providing (err, titles)


<inner> searchTitles(age, searchstring, callback)

For searching the symptom checker, dosage table and first aid titles for an age group

Parameters:
Name Type Description
age string

specifying the age group 'adult' or 'child' to get the searchable titles for

searchstring string

specifying the search string to use.

callback requestCallback

a callback function providing (err, titles)


<inner> setEnvironment(env)

For clearing the in memory cache, like for a mid session language change

Parameters:
Name Type Description
env string

specifiying the subdomain for the api base url