Exemplo n.º 1
0
def get_indicators_code(indicatorcode):
    """Get indicators code

    This function returns the metadata that describe the characteristics of a specific indicator,
    allowing the compression of the measured fact; also through the data request the complete data (for all spacetime)
    of the indicator is provided.

    Args:
        indicatorcode (string): an indicator code

    Examples:
        >>> get_indicators_code("AFILIACIONES")
        >>> get_indicators_code("PARO_REGISTRADO")
    """
    # URL params
    api = "indicators"
    path = "indicators"

    # Get URL
    url = resources.get_url(api, path, resource=indicatorcode)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 2
0
def get_structuralresources_variable_families_id_variables(
        id, limit=25, offset=0, query=None, orderby=None):
    """Get variable families (id) variables

    This function returns data from /v1.0/variablefamilies/{id}/variables

    Args:
        id (string): Variable family identificator.
        limit (int): Results limit. By default ``limit = 25``.
        offset (int): Displacement. Result from which it is returned.  By default ``offset = 0``.
        query (string): Query to filter the results.
        orderby (string): Field by which to sort the results.

    Examples:
        >>> get_structuralresources_variable_families_id_variables("VRF_DEMOGRAFICAS")
    """
    # Parse query
    query = resources.parse_param(query)

    # Parse orderBy
    orderby = resources.parse_param(orderby)

    # Build URL
    api = "structural-resources"
    path = "variablefamilies"
    resource = id + "/variables" + ".json"
    params = "?limit=" + str(limit) + "&offset=" + str(
        offset) + "&query=" + query + "&orderBy=" + orderby
    resource = resource + params
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 3
0
def get_structuralresources_codelists_agency_resource_version_codes_codeid(
        agencyid, resourceid, version, codeid):
    """Get codelists agency resource version codes (codeID)

    This function allows to consult a specific code of a version of a classification.

    Args:
        agencyid (string): Agency identificator.
        resourceid (string): Resource identificator.
        version (string): Specific resource version.
        codeid (string): Code identificator.

    Examples:
        >>> get_structuralresources_codelists_agency_resource_version_codes_codeid(
            "ISTAC", "CL_AREA_ES", "01.000", "ES706A01")
    """
    # Build URL
    api = "structural-resources"
    path = "codelists"
    resource = agencyid + "/" + resourceid + "/" + version + "/codes/" + codeid + ".json"
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 4
0
def get_structuralresources_codelists(limit=25,
                                      offset=0,
                                      query=None,
                                      orderby=None):
    """Get codelists

    This function allows to obtain the list of classifications.

    Args:
        limit (int): Results limit. By default ``limit = 25``.
        offset (int): Displacement. Result from which it is returned.  By default ``offset = 0``.
        query (string): Query to filter the results.
        orderby (string): Field by which to sort the results.

    Examples:
         >>> get_structuralresources_codelists()
    """
    # Parse query
    query = resources.parse_param(query)

    # Parse orderby
    orderby = resources.parse_param(orderby)

    # Build URL
    api = "structural-resources"
    path = "codelists" + ".json"
    params = "?limit=" + str(limit) + "&offset=" + str(
        offset) + "&query=" + query + "&orderby=" + orderby
    path = path + params
    url = resources.get_url(api, path)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 5
0
def get_structuralresources_category_schemes_agency_resource_version_categories_id(
        agencyid, resourceid, version, categoryid):
    """Get category schemes agency resource version categories (id)

    This function returns the content from /v1.0/categoryschemes/{agencyID}/{resourceID}/{version}/categories/
    {categoryID}

    Args:
        agencyid (string): Identifier of the agency that publishes.
        resourceid (string): Resource identifier.
        version (string): Specific version of the resource.
        categoryid (string): category identifier

    Examples:
        >>> get_structuralresources_category_schemes_agency_resource_version_categories_id("ISTAC", "TEMAS_CANARIAS",
            "01.000", "060")
        >>> get_structuralresources_category_schemes_agency_resource_version_categories_id("ISTAC", "TEMAS_CANARIAS",
            "01.000", "060.060_010.060_010_010")
    """
    # Build URL
    api = "structural-resources"
    path = "categoryschemes"
    resource = agencyid + "/" + resourceid + "/" + version + "/categories/" + categoryid
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 6
0
def get_indicators_systems(limit=25, offset=0):
    """Get indicators systems

    This function returns a list of indicator systems published in the ISTAC-indicators database.
    The indicators are simple or compound statistics, however a single indicator can rarely provide useful
    information about complex phenomena such as the economic situation, living conditions, schooling or others.
    Indicator systems are generally designed to generate more and more accurate information about the
    conditions of a phenomenon; and for this they are organized in dimensions or areas of analysis, under which the
    indicators are integrated.

    Args:
        limit (int): Results limit. By default ``limit = 25``.
        offset (int): Displacement. Result from which it is returned. By default ``offset = 0``.

    Examples:
        >>> get_indicators_systems()

    """
    # Build URL
    api = "indicators"
    path = "indicatorsSystems"

    path = path + "?limit=" + str(limit) + "&offset=" + str(offset)
    url = resources.get_url(api, path)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 7
0
def get_structuralresources_variables(limit=25,
                                      offset=0,
                                      query=None,
                                      orderby=None):
    """Get variables

    This function returns data from /v1.0/variables

    Args:
        limit (int): Results limit. By default ``limit = 25``.
        offset (int): Displacement. Result from which it is returned.  By default ``offset = 0``.
        query (string): Query to filter the results.
        orderby (string): Field by which to sort the results.

    Examples:
        >>> get_structuralresources_variables()
    """
    # Parse query
    query = resources.parse_param(query)

    # Parse orderBy
    orderby = resources.parse_param(orderby)

    # Build URL
    api = "structural-resources"
    path = "variables" + ".json"
    url = resources.get_url(api, path)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 8
0
def get_indicators_systems_code_instances(indicatorsystemcode, q=None, order=None, limit=25, offset=0, fields=None,
                                          representation=None, granularity=None):
    """Get indicators system code instances

    This function returns instances of indicators associated with a specific indicator system. An instance of an
    indicator is nothing more than a spatio-temporal query of an indicator when it is incorporated into a specific
    indicator system.

    Args:
        indicatorsystemcode (string): with an indicator system code
        q (string): Query of metadata on which the searches can be built are: ``id`` and ``geographicalValue``.
        order (string): Order. Possible values are: ``update`` and ``id`` and order criteria are ``ASC`` and ``DESC``.
        limit (int): Results limit. By default ``limit = 25``.
        offset (int): Displacement. Result from which it is returned.  By default ``offset = 0``.
        fields (string): Use of the answer by adding new fields. Possible values are: ``+metadata``, ``+data`` and
            ``+observationsMetadata``.
        representation (string): Allows filtering the observations by their value. Its use only makes sense when
            ``+data`` and/or ``+observationsMetadata`` has been included.
        granularity (string): Allows to filter the observations through the granularities of the same.
            Its use only makes sense when ``+data`` and/or ``+observationsMetadata`` has been included.

    Examples:
        >>> get_indicators_systems_code_instances("C00075H")
        >>> get_indicators_systems_code_instances("C00075H", q = 'id EQ "INDICADORES_MUNICIPALES"')
    """
    # Parse order
    order = resources.parse_param(order)

    # Parse fields
    fields = resources.parse_param(fields)

    # Parse representation
    representation = resources.parse_param(representation)

    # Parse granularity
    granularity = resources.parse_param(granularity)

    # Build URL
    api = "indicators"
    path = "indicatorsSystems"
    resource = indicatorsystemcode + "/indicatorsInstances"
    if q is not None:
        q = resources.parse_param(q)
        params = "?q=" + q + "&order=" + order + "&limit=" + str(limit) + "&offset=" + str(
            offset) + "&fields=" + fields + "&representation=" + representation + "&granularity=" + granularity
    else:
        params = "?order=" + order + "&limit=" + str(limit) + "&offset=" + str(
            offset) + "&fields=" + fields + "&representation=" + representation + "&granularity=" + granularity

    resource = resource + params
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 9
0
def get_indicators(q="", order="", limit=25, offset=0, fields=None, representation=None):
    """Get indicators

    This function returns a list of indicators published in the ISTAC-indicators database. An indicator is a measure
    used to know the intensity of a phenomenon in spacetime. This measure can refer to different spatial or temporal
    granularities.

    Args:
        q (string): Metadata query on which the searches can be built using ``id``, ``subjectCode`` or
            ``geographicValue``.
        order (string): Order. Possible values are: ``update`` and ``id``. Order criteria are ``ASC`` and ``DESC``.
        limit (int): Results limit. By default ``limit = 25``.
        offset (int): Displacement. Result from which it is returned.  By default ``offset = 0``.
        fields (string): Use of the answer by adding new fields. Possible values are: ``+metadata``, ``+data`` and
            ``+observationsMetadata``.
        representation (string): Allows filtering the observations by their value. Its use only makes sense when
            ``+data`` and/or ``+observationsMetadata`` has been included.

    Examples:
        >>> get_indicators(q = 'id IN ("AFILIACIONES", "EMPLEO_REGISTRADO_AGRICULTURA")', order = "id ASC",
                fields = "+data", representation ="GEOGRAPHICAL[35003|35005],MEASURE[ABSOLUTE]")

    """
    # URL params
    api = "indicators"
    path = "indicators"

    # Parse order
    order = resources.parse_param(order)

    # Parse fields
    fields = resources.parse_param(fields)

    # Parse representation
    representation = resources.parse_param(representation)

    # Get indicators using query (q) parameter
    if q is not None:
        q = resources.parse_param(q)
        params = "&order=" + order + "&limit=" + str(limit) + "&offset=" + str(
            offset) + "&fields=" + fields + "&representation=" + representation
        path = path + "?q=" + q + params
    else:
        params = "?order=" + order + "&limit=" + str(limit) + "&offset=" + str(
            offset) + "&fields=" + fields + "&representation=" + representation
        path = path + params

    # Get URL
    url = resources.get_url(api, path)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 10
0
def get_structuralresources_codelists_agency_resource_version_codes(
        agencyid,
        resourceid,
        version,
        limit=25,
        offset=0,
        query=None,
        orderby=None,
        openness=None,
        order=None,
        fields=None):
    """Get codelists agency resource version codes

    This function allows to consult the codes of a version of a classification. Note that if wildcards are used
    as ``~all`` or one of the ``limit``, ``offset``, ``query`` or ``orderBy`` parameters,
    the list will be automatically paginated.

    Args:
        agencyid (string): Agency identificator.
        resourceid (string): Resource identificator.
        version (string): Specific resource version.
        limit (int): Results limit. By default ``limit = 25``.
        offset (int): Displacement. Result from which it is returned.  By default ``offset = 0``.
        query (string): Query to filter the results.
        orderby (string): Field by which to sort the results.
        openness (string): Opening established for viewing.
        order (string): Order established for visualization.
        fields (string): Additional fields that you want to show in the answer.

    Examples:
        >>> get_structuralresources_codelists_agency_resource_version_codes("ISTAC", "CL_AREA_ES", "01.000")
    """
    # Parse query
    query = resources.parse_param(query)

    # Parse orderby
    orderby = resources.parse_param(orderby)

    # Parse fields
    fields = resources.parse_param(fields)

    # Build URL
    api = "structural-resources"
    path = "codelists"
    resource = agencyid + "/" + resourceid + "/" + version + "/codes" + ".json"
    params = "?limit=" + str(limit) + "&offset=" + str(offset) + "&query=" + query + "&orderby=" + orderby + \
             "&openness=" + openness + "&order=" + order + "&fields=" + fields
    resource = resource + params
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 11
0
def get_structuralresources_concept_types():
    """Get concept types

    This function returns the content from /v1.0/conceptTypes

    Examples:
        >>> get_structuralresources_concept_types()
    """
    # Build URL
    api = "structural-resources"
    path = "conceptTypes"
    url = resources.get_url(api, path)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 12
0
def get_indicators_subjects():
    """Get subjects

    This function returns all subjects which the ISTAC classifies its statistical operations.

    Examples:
        >>> get_indicators_subjects()
    """
    # Build URL
    api = "indicators"
    path = "subjects"

    # Get content
    url = resources.get_url(api, path)
    content = resources.get_content(url)

    return content
Exemplo n.º 13
0
def get_statisticalresources_datasets_agency_resource(agencyid,
                                                      resourceid,
                                                      lang="es",
                                                      limit=25,
                                                      offset=0,
                                                      orderby=None,
                                                      query=None):
    """Get datasets (agencyID / resourceID)
    
    This function allows to obtain all the versions of a statistical cube with a certain identifier and that also 
    maintains a certain organization.
    
    Args:
        agencyid (string): Identifier of the maintainer organization of the resource. A possible value is ``ISTAC``.
        resourceid (string): Resource identifier. A possible value is ``C00010A_000002``.
        lang (string): Language in which you want to get the answer.
        limit (int): Results limit. By default ``limit=25``.
        offset (int): Displacement. Result from which it is returned. By default ``offset=0``.
        orderby (string): Order. Possible values are ``ID ASC`` or ``ID DESC``,
        query (string): Metadata query on which the searches can be built.
        
    Examples:
        >>> get_statisticalresources_datasets_agency_resource(agencyid = "ISTAC", resourceid = "C00010A_000002")
     
    """
    # URL params
    api = "statistical-resources"
    path = "datasets"

    # Parse order
    orderby = resources.parse_param(orderby)

    # Parse query
    query = resources.parse_param(query)

    # Build URL
    params = "?lang=" + lang + "&limit=" + str(limit) + "&offset=" + str(offset) + "&orderby=" + orderby + \
             "&query=" + query
    resource = agencyid + "/" + resourceid + ".json" + params
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 14
0
def get_structuralresources_geoinfo(variableid,
                                    resourceid,
                                    fields="",
                                    limit=25,
                                    offset=0,
                                    query=None,
                                    orderby=None):
    """Get geoinfo

    This function returns data from /v1.0/variables/{variableID}/variableelements/{resourceID}/geoinfo

    Args:
        variableid (string): Variable identificator.
        resourceid (string): Resource identificator.
        fields (string): Additional fields that you want to show in the answer.
        limit (int): Results limit. By default ``limit = 25``.
        offset (int): Displacement. Result from which it is returned.  By default ``offset = 0``.
        query (string): Query to filter the results.
        orderby (string): Field by which to sort the results.

    Examples:
      >>> get_structuralresources_geoinfo("VR_TERRITORIO", "MUN_ICOD_VINOS")
    """
    # Parse fields
    fields = resources.parse_param(fields)

    # Parse query
    query = resources.parse_param(query)

    # Parse orderBy
    orderby = resources.parse_param(orderby)

    # Build URL
    api = "structural-resources"
    path = "variables"
    resource = variableid + "/variableelements/" + resourceid + "/geoinfo" + ".json"
    params = "?fields=" + fields + "&limit=" + str(limit) + "&offset=" + str(offset) + "&query=" + query + "&orderBy=" \
             + orderby
    resource = resource + params
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 15
0
def get_indicators_time_granularities():
    """Get time granularities

    This function returns a list of temporary granularity treated in the ISTAC data bank-indicators ordered from
    highest to lowest granularity. For example annual, quarterly or monthly granularity.

    Examples:
        >>> get_indicators_time_granularities()
    """
    # Build URL
    api = "indicators"
    path = "timeGranularities"

    # Get content
    url = resources.get_url(api, path)
    content = resources.get_content(url)

    return content
Exemplo n.º 16
0
def get_indicators_geographic_granularities():
    """Get geographic granularities

    This function returns a list of geographic granularities treated in the ISTAC-indicators database.
    For example provincial, insular or municipal granularity.

    Examples:
        >>> get_indicators_geographic_granularities()
    """
    # Build URL
    api = "indicators"
    path = "geographicGranularities"
    url = resources.get_url(api, path)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 17
0
def get_structuralresources_category_schemes_agency_resource_version_categories(
        agencyid,
        resourceid,
        version,
        limit=25,
        offset=0,
        query=None,
        orderby=None):
    """Get category schemes agency resource version categories

    This function returns the content from /v1.0/categoryschemes/{agencyID}/{resourceID}/{version}/categories

    Args:
        agencyid (string): Identifier of the agency that publishes.
        resourceid (string): Resource identifier.
        version (string): Specific version of the resource.
        limit (int): Results limit. By default ``limit = 25``.
        offset (int): Displacement. Result from which it is returned.  By default ``offset = 0``.
        query (string): Query to filter the results.
        orderby (string): Field by which to sort the results.

    Examples:
        >>> get_structuralresources_category_schemes_agency_resource_version_categories("ISTAC", "TEMAS_CANARIAS",
            "01.000")
    """
    # Parse query
    query = resources.resources.get_content(query)

    # Parse orderby
    orderby = resources.resources.get_content(orderby)

    # Build URL
    api = "structural-resources"
    path = "categoryschemes"
    resource = agencyid + "/" + resourceid + "/" + version + "/categories"
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 18
0
def get_structuralresources_codelists_agency_resource(agencyid,
                                                      resourceid,
                                                      limit=25,
                                                      offset=0,
                                                      query=None,
                                                      orderby=None):
    """Get codelists agency resource

    This function allows to obtain all the versions of a classification with a certain identifier and that is also kept
    by a certain organization.

    Args:
        agencyid (string): Agency identificator.
        resourceid (string): Resource identificator.
        limit (int): Results limit. By default ``limit = 25``.
        offset (int): Displacement. Result from which it is returned.  By default ``offset = 0``.
        query (string): Query to filter the results.
        orderby (string): Field by which to sort the results.

    Examples:
        >>> get_structuralresources_codelists_agency_resource("ISTAC", "CL_AREA_ES")
    """
    # Parse query
    query = resources.parse_param(query)

    # Parse orderby
    orderby = resources.parse_param(orderby)

    # Build URL
    api = "structural-resources"
    path = "codelists"
    resource = agencyid + "/" + resourceid + ".json"
    params = "?limit=" + str(limit) + "&offset=" + str(
        offset) + "&query=" + query + "&orderby=" + orderby
    resource = resource + params
    url = resources.get_url(api, path, resource)

    # Get Content
    content = resources.get_content(url)

    return content
Exemplo n.º 19
0
def get_structuralresources_codelist_families_id(id=None):
    """Get codelist families

    This function allows to obtain a family of classifications in particular.

    Args:
        id (string): codelist family identificator

    Examples:
        >>> get_structuralresources_codelist_families_id()
    """
    # Build URL
    api = "structural-resources"
    path = "codelistfamilies"
    resource = id + ".json"
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 20
0
def get_structuralresources_variable_families_id(id):
    """Get variable families (id)

    This function returns data from /v1.0/variablefamilies/{id}

    Args:
        id (string): Variable family identificator.

    Examples:
        >>> get_structuralresources_variable_families_id("VRF_DEMOGRAFICAS")
    """
    # Build URL
    api = "structural-resources"
    path = "variablefamilies"
    resource = id + ".json"
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 21
0
def get_indicators_systems_code_instances_code_data(indicatorsystemcode, indicatorinstancecode, representation=None,
                                                    granularity=None, fields=None):
    """Get indicators system code instances code data

    This function returns data of an indicator unit associated with a specific indicator system. An instance of an
    indicator is nothing more than a spatio-temporal query of an indicator when it is incorporated into a specific
    indicator system.

    Args:
        indicatorsystemcode (string): Indicator system code
        indicatorinstancecode (string): Indicator instance code
        representation (string): Allows filtering the observations by their value.
        granularity (string): Allows to filter the observations through the granularities of the same.
        fields (string): Allows you to customize the response by excluding fields. The possible values are:
            ``-observationsMetadata``.

    Examples:
        >>> get_indicators_systems_code_instances_code_data("C00075H", "21af0477-d63b-493b-ad02-4ab181547223")
    """
    # Parse representation
    representation = resources.parse_param(representation)

    # Parse granularity
    granularity = resources.parse_param(granularity)

    # Parse fields
    fields = resources.parse_param(fields)

    # Build URL
    api = "indicators"
    path = "indicatorsSystems"
    resource = indicatorsystemcode + "/indicatorsInstances/" + indicatorinstancecode + "/data"
    params = "?representation=" + representation + "&granularity=" + granularity + "&fields=" + fields
    resource = resource + params
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 22
0
def get_statisticalresources_datasets_agency_resource_version(
        agencyid, resourceid, version, dim=None, fields=None, lang="es"):
    """Get datasets (agencyID / resourceID / version)
    
    This function allows to obtain all the versions of a statistical cube with a certain identifier and that also 
    maintains a certain organization.
    
    Args:
        agencyid (string): Identifier of the maintainer organization of the resource. A possible value is ``ISTAC``.
        resourceid (string): Resource identifier. A possible value is ``C00010A_000002``.
        version (string): Resource version. A possible value is ``001.000``.
        dim (string): Allows filtering the data obtained in the response. A example is ``TIME_PERIOD:2009|2010``.
        fields (string): Allows you to customize the response by excluding fields from it. The possible values are
            ``-metadata`` and ``-data``.
        lang (string): Language in which you want to get the answer.
        
    Examples:
        >>> get_statisticalresources_datasets_agency_resource_version(agencyid = "ISTAC", resourceid = "C00010A_000002", 
                version = "001.000")
    """
    # URL params
    api = "statistical-resources"
    path = "datasets"

    # Parse dim
    dim = resources.parse_param(dim)

    # Parse fields
    fields = resources.parse_param(fields)

    # Build URL
    params = "?dim=" + dim + "&fields=" + fields + "&lang=" + lang
    resource = agencyid + "/" + resourceid + "/" + version + ".json" + params
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 23
0
def get_structuralresources_concept_schemes_agency(agencyid,
                                                   limit=25,
                                                   offset=0,
                                                   query=None,
                                                   orderby=None):
    """Get concept schemes agency

    This function returns the content from /v1.0/conceptschemes/{agencyID}

    Args:
        agencyid (string): Identifier of the agency that publishes.
        limit (int): Results limit. By default ``limit = 25``.
        offset (int): Displacement. Result from which it is returned.  By default ``offset = 0``.
        query (string): Query to filter the results.
        orderby (string): Field by which to sort the results.

    Examples:
        >>> get_structuralresources_concept_schemes_agency("ISTAC")
        >>> get_structuralresources_concept_schemes_agency("ESTAT", query = "ID EQ 2090", orderby = "ID ASC")
    """
    # Parse query
    query = resources.parse_param(query)

    # Parse orderby
    orderby = resources.parse_param(orderby)

    # Build URL
    api = "structural-resources"
    path = "conceptschemes"
    resource = agencyid
    params = "?limit=" + str(limit) + "&offset=" + str(
        offset) + "&orderby=" + orderby + "&query=" + query
    resource = resource + params
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 24
0
def get_statisticalresources_datasets(lang="es",
                                      limit=25,
                                      offset=0,
                                      orderby=None,
                                      query=None):
    """Get datasets

    This function allows consulting all existing statistical data cubes.

    Args:
        lang (string): Language in which you want to get the answer.
        limit (int): Results limit. By default ``limit=25``.
        offset (int): Displacement. Result from which it is returned. By default ``offset=0``.
        orderby (string): Order. Possible values are ``ID ASC`` or ``ID DESC``,
        query (string): Metadata query on which the searches can be built.

    Examples:
        >>> get_statisticalresources_datasets()
    """
    # URL params
    api = "statistical-resources"
    path = "datasets" + ".json"

    # Parse order
    orderby = resources.parse_param(orderby)

    # Parse query
    query = resources.parse_param(query)

    # Build URL
    params = "?lang=" + lang + "&limit=" + str(limit) + "&offset=" + str(offset) + "&orderby=" + orderby + \
             "&query=" + query
    path = path + params
    url = resources.get_url(api, path)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 25
0
def get_structuralresources_variableelements_resource(variableid, resourceid):
    """Get variableelements resource

    This function returns data from /v1.0/variables/{variableID}/variableelements/{resourceID}

    Args:
        variableid (string): Resource identificator.
        resourceid (string): Variable identificator.

    Examples:
        >>> get_structuralresources_variableelements_resource("VR_SEXO", "FEMALE")
    """
    # Build URL
    api = "structural-resources"
    path = "variables"
    resource = variableid + "/variableelements/" + resourceid + ".json"
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 26
0
def get_indicators_geographical_values(geographicalgranularitycode,
                                       subjectcode=None,
                                       systemcode=None):
    """Get geographical values

    This function returns values of a geographical granularity that in turn are part of a specific theme or system of
    indicators.

    Args:
        geographicalgranularitycode (string): geographical granularity code
        subjectcode (string): subject code
        systemcode (string): system code

    Examples:
        >>> get_indicators_geographical_values("REGIONS")
        >>> get_indicators_geographical_values("REGIONS", subjectcode = "051", systemcode = "C00067A")
    """
    # Build URL
    api = "indicators"
    path = "geographicalValues"
    if subjectcode is not None:
        if systemcode is not None:
            path = path + "?subjectCode=" + subjectcode + "&systemCode=" + systemcode + "&geographicalGranularityCode="\
                   + geographicalgranularitycode
        else:
            path = path + "?subjectCode=" + subjectcode + "&geographicalGranularityCode=" + geographicalgranularitycode
    else:
        if systemcode is not None:
            path = path + "?systemCode=" + systemcode + "&geographicalGranularityCode=" + geographicalgranularitycode
        else:
            path = path + "?geographicalGranularityCode=" + geographicalgranularitycode

    url = resources.get_url(api, path)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 27
0
def get_indicators_code_data(indicatorcode, representation=None, granularity="", fields=None):
    """Get indicators code data

    This function returns complete data (for all spacetime) of the indicator.
    On the other hand, metadata describing the characteristics of a specific
    indicator are offered through the metadata request, allowing the compression
    of the measured fact.

    Args:
        indicatorcode (string): an indicator code
        representation (string): Allows filtering the observations by their value.
        granularity (string): Allows to filter the observations through the granularities of the same.
        fields (string): Allows you to customize the response by excluding fields. The possible values are:
            ``-observationsMetadata``.

    Examples:
        >>> get_indicators_code_data("AFILIACIONES")
    """
    # Parse representation
    representation = resources.parse_param(representation)

    # Parse granularity
    granularity = resources.parse_param(granularity)

    # Parse fields
    fields = resources.parse_param(fields)

    # Build URL
    api = "indicators"
    path = "indicators"
    resource = indicatorcode + "/data" + "?representation=" + representation + "&granularity="\
        + granularity + "&fields=" + fields
    url = resources.get_url(api, path, resource=resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 28
0
def get_indicators_systems_code(indicatorsystemcode):
    """Get indicators system code

    This function returns metadata of a system of indicators published in the ISTAC-indicators database.
    The indicators are simple or compound statistics, however a single indicator can rarely provide useful
    information about complex phenomena such as the economic situation, living conditions, schooling or others.

    Args:
        indicatorsystemcode (string): an indicator system code

    Examples:
        >>> get_indicators_systems_code("C00075H")
    """
    # Build URL
    api = "indicators"
    path = "indicatorsSystems"
    resource = indicatorsystemcode
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 29
0
def get_indicators_systems_code_instances_code(indicatorsystemcode, indicatorinstancecode):
    """Get indicators system code instances code

    This function returns metadata of an indicator set associated with a specific indicator system. An instance of an
    indicator is nothing more than a spatio-temporal query of an indicator when it is incorporated into a specific
    indicator system.

    Args:
        indicatorsystemcode (string) indicator system code
        indicatorinstancecode (string) indicator instance code
    Examples:
        >>> get_indicators_systems_code_instances_code("C00075H", "21af0477-d63b-493b-ad02-4ab181547223")
    """
    # Build URL
    api = "indicators"
    path = "indicatorsSystems"
    resource = indicatorsystemcode + "/indicatorsInstances/" + indicatorinstancecode
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content
Exemplo n.º 30
0
def get_structuralresources_categorisations_agency_resource(
        agencyid, resourceid, limit=25, offset=0, query=None, orderby=None):
    """Get categorisations agency resource

    This function returns the content from /v1.0/categorisations/{agencyID}/{resourceID}

    Args:
        agencyid (string): Identifier of the agency that publishes.
        resourceid (string): Resource identifier.
        limit (int): Results limit. By default ``limit = 25``.
        offset (int): Displacement. Result from which it is returned.  By default ``offset = 0``.
        query (string): Query to filter the results.
        orderby (string): Field by which to sort the results.

    Examples:
        >>> get_structuralresources_categorisations_agency_resource("ISTAC", "cat2")
    """
    # Parse query
    query = resources.resources.get_content(query)

    # Parse orderby
    orderby = resources.resources.get_content(orderby)

    # Build URL
    api = "structural-resources"
    path = "categorisations"
    resource = agencyid + "/" + resourceid
    params = "?limit=" + str(limit) + "&offset=" + str(
        offset) + "&orderby=" + orderby + "&query=" + query
    resource = resource + params
    url = resources.get_url(api, path, resource)

    # Get content
    content = resources.get_content(url)

    return content