metadata

Calls used to retrieve metadata about areas, ages, sexes, value notes, calculation methods, rates, and indicator metadata.

fingertips_py.metadata.get_age_from_id(age_id, is_test=False)

Returns an age name from given id.

Parameters:
  • age_id – Age id used in Fingertips as an integer

  • is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

Age, or age range, as a string

fingertips_py.metadata.get_age_id(age, is_test=False)

Returns an ID for a given age.

Parameters:
  • age – Search term of an age or age range as a string

  • is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

Code used in Fingertips to represent the age as an integer or age range as a string

fingertips_py.metadata.get_all_ages(is_test=False)

Returns a dictionary of all the age categories and their IDs as the dictionary key.

Parameters:

is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

Age codes used in Fingertips in a dictionary

fingertips_py.metadata.get_all_areas(is_test=False)

Retreives all area types.

Parameters:

is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

A dictionary of all area types used in Fingertips

fingertips_py.metadata.get_all_profiles(is_test=False)

Returns all profiles.

Parameters:

is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

A dictionary of all profiles in Fingertips including information on domains and sequencing

fingertips_py.metadata.get_all_sexes(is_test=False)

Returns a dictionary of all sex categories and their IDs as dictionary key.

Parameters:

is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

Sex categories used in Fingertips with associated codes as a dictionary

fingertips_py.metadata.get_all_value_notes(is_test=False)

Returns a dictionary of all value notes and their IDs as dictionary key.

Parameters:

is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

Data value notes and their associated codes that are used in Fingertips as a dictionary

fingertips_py.metadata.get_area_type_ids_for_profile(profile_id)

Returns a list of area types used within a given profile.

Parameters:

profile_id – ID used in Fingertips to identify a profile as integer or string

Returns:

A list of area type IDs used within a given profile

fingertips_py.metadata.get_area_types_as_dict(is_test=False)

Returns all area types and related information such as ID and name with dictionary key value as ID.

Parameters:

is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

A dictionary of area types

fingertips_py.metadata.get_area_types_for_profile(profile_id, is_test=False)

Retrieves all the area types that have data for a given profile.

Parameters:
  • profile_id – ID used in Fingertips to identify a profile as integer or string

  • is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

A list of dictionaries of area types with relevant information

fingertips_py.metadata.get_areas_for_area_type(area_type_id, is_test=False)

Returns a dictionary of areas that match an area type id given the id as integer or string.

Parameters:
  • area_type_id – ID of area type (ID of General Practice is 7 etc) used in Fingertips as integer or string

  • is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

A dictionary of dictionaries with area codes as the key

fingertips_py.metadata.get_domains_in_profile(profile_id)

Returns the domain IDs for a given profile.

Parameters:

profile_id – ID used in Fingertips to identify a profile as integer or string

Returns:

A list of domain IDs

fingertips_py.metadata.get_metadata(indicator_ids=None, domain_ids=None, profile_ids=None)

Returns a dataframe object of metadata for a given indicator, domain, and/or profile given the relevant IDs. At least one of these IDs has to be given otherwise an error is raised.

Parameters:
  • indicator_ids – [OPTIONAL] Number used to identify an indicator within Fingertips as integer or string

  • domain_ids – [OPTIONAL] Number used to identify a domain within Fingertips as integer or string

  • profile_ids – [OPTIONAL] ID used in Fingertips to identify a profile as integer or string

Returns:

A dataframe object with metadata for the given IDs or an error if nothing is specified

fingertips_py.metadata.get_metadata_for_all_indicators(include_definition='no', include_system_content='no', is_test=False)

Returns the metadata for all indicators in a dictionary.

Parameters:
  • include_definition – optional to include definitions

  • include_system_content – optional to include system content

  • is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

dictionary of all indicators

fingertips_py.metadata.get_metadata_for_all_indicators_from_csv(is_test=False)

Returns a dataframe from the csv of all metadata for all indicators.

Parameters:

is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

A dataframe of all metadata for all indicators

fingertips_py.metadata.get_metadata_for_domain_as_dataframe(group_ids, is_test=False)

Returns a dataframe of metadata for a given domain ID or list of domain IDs.

Parameters:

group_ids – Number or list of numbers used to identify a domain within Fingertips as integer or string

Returns:

Dataframe object with metadata for the indicators for a given domain ID

fingertips_py.metadata.get_metadata_for_indicator(indicator_number, is_test=False)

Returns the metadata for an indicator given the indicator number as integer or string.

Parameters:
  • indicator_number – Number used to identify an indicator within Fingertips as integer or string

  • is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

A dictionary of metadata for the given indicator

fingertips_py.metadata.get_metadata_for_indicator_as_dataframe(indicator_ids, is_test=False)

Returns a dataframe of metadata for a given indicator ID or list of indicator IDs.

Parameters:

indicator_ids – Number or list of numbers used to identify an indicator within Fingertips as integer or string

Returns:

Dataframe object with metadate for the indicator ID

fingertips_py.metadata.get_metadata_for_profile_as_dataframe(profile_ids)

Returns a dataframe of metadata for a given profile ID or list of profile IDs.

Parameters:

profile_ids – ID or list of IDs used in Fingertips to identify a profile as integer or string

Returns:

Dataframe object with metadata for the indicators for a given group ID

fingertips_py.metadata.get_multiplier_and_calculation_for_indicator(indicator_number)

Returns the multiplier and calculation method for a given indicator.

Parameters:

indicator_number – Number used to identify an indicator within Fingertips as integer or string

Returns:

A tuple of multiplier and calculation method from Fingetips metadata

fingertips_py.metadata.get_profile_by_id(profile_id, is_test=False)

Returns a profile as an dictionary which contains information about domains and sequencing.

Parameters:
  • profile_id – ID used in Fingertips to identify a profile as integer or string

  • is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

A dictionary of information about the profile

fingertips_py.metadata.get_profile_by_key(profile_key)

Returns a profile object given a key (as the stub following ‘profile’ in the website URL). For example, give, a URL of the form https://fingertips.phe.org.uk/profile/general-practice/data#page/3/gid/2000…, the key is ‘general-practice’.

Parameters:

profile_key – The exact key for the profile.

Returns:

A dictionary of the profile metadata including domain information or an error message

fingertips_py.metadata.get_profile_by_name(profile_name)

Returns a profile object given a name to search – try to be specific to get better results.

Parameters:

profile_name – A string or part of a string that is used as the profile name

Returns:

A dictionary of the profile metadata including domain information or an error message

fingertips_py.metadata.get_sex_from_id(sex_id, is_test=False)

Returns a sex name given an ID.

Parameters:
  • sex_id – ID used in Fingertips to represent the sex as integer

  • is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

Sex category as string

fingertips_py.metadata.get_sex_id(sex, is_test=False)

Returns an ID for a given sex.

Parameters:
  • sex – Sex category as string (Case sensitive)

  • is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

ID used in Fingertips to represent the sex as an integer

fingertips_py.metadata.get_value_note_id(value_note, is_test=False)

Returns a value note ID for a given value note.

Parameters:
  • value_note – Value note as string

  • is_test – Used for testing. Returns a tuple of expected return and the URL called to retrieve the data

Returns:

ID used in Fingertips to represent the value note as an integer