# Metadata Auto
## Introduction
This repository aims to simplify the access to the [Swiss Federal Statistical Office](https://www.bfs.admin.ch/bfs/en/home.html) metadata.
Following the implementation in the [interoperability platform](https://www.i14y.admin.ch) and the [SIS portal](https://sharepoint.admin.ch/edi/bfs/fr-ch/News/Pages/go-life-neues-sis-portals.aspx), the APIs are made available here in python.
This public library is made available for the internal FSO staff, the federal administration and for external actors.
## Installation
You can install the library with
```
pip install fso_metadata
```
then at the beginning of your python script, you will need to
```
import fso_metadata
```
## Functionnalities
Based on the metadata that you want, you will call certain functions and parameters.
In the first part, we describe the API available from everywhere, then we describe the API available only from within the confederation network.
### Available everywhere with the interoperability plateform (i14y)
#### Codelists
1. Export a codelist based on an identifier
```
response = get_codelist(
identifier,
export_format="SDMX-ML",
version_format=2.1,
annotations=False
)
```
Parameters:
- identifier (str): the codelist's identifier
- environment (str, default="PRD"): environment to call
Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.
- export_format (str, default="SDMX-ML"): the export's format.
Available are CSV, XLSX, SDMX-ML or SDMX-JSON.
- version_format (float, default=2.1): the export format's version
(2.0 or 2.1 when format is SDMX-ML).
- annotations (bool, default=False): flag to include annotations
Returns:
- response (pd.DataFrame or dict) based on the export format
- a pd.DataFrame if export_format was CSV or XLSX
- a dictionnary if export_format was SDMX-ML or SDMX-JSON.
#### Nomenclatures
1. Export one level of a nomenclature
```
response = get_nomenclature_one_level(
identifier,
level_number,
filters={},
language='fr',
annotations=False
)
```
Parameters:
- identifier (str): nomenclature's identifier
- environment (str, default="PRD"): environment to call
Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.
- level_number (int): level to export
- filter (default={}): additionnal filters
- language (str, default='fr'): response data's language
Available are 'fr', 'de', 'it', 'en'.
- annotations (bool, default=False): flag to include annotations
Returns:
- response (pd.DataFrame): dataframe with 3 columns
(Code, Parent and Name in the selected language)
2. Export multiple levels of a nomenclature (from `level_from` to `level_to`)
```
response = get_nomenclature_multiple_levels(
identifier,
level_from,
level_to,
filters={},
language='fr',
annotations=False
)
```
Parameters:
- identifier (str): nomenclature's identifier
- environment (str, default="PRD"): environment to call
Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.
- level_from (int): the 1st level to include
- level_to (int): the last level to include
- filter (default={}): additionnal filters
- language (str, default='fr'): response data's language
Available are 'fr', 'de', 'it', 'en'.
- annotations (bool, default=False): flag to include annotations
- post_processing (bool, default=False): flag to post-process
Returns:
- response (pd.DataFrame): dataframe columns from `level_from` to `level_to` codes
As the APIs continue to be implemented, further functionnalities will be added.
## Background
All the APIs made available in this library are also documented in Swagger UI should you want to do more experiments through a UI. See [here](https://www.i14y.admin.ch/api/index.html) for APIs of the interoperability platform (public).
## Example
Examples for each API are provided in the notebook [examples.ipynb](https://renkulab.io/gitlab/dscc/meatadata-auto/-/blob/master/examples.ipynb).
Raw data
{
"_id": null,
"home_page": "https://renkulab.io/gitlab/pauline.maury-laribiere/meatadata-auto",
"name": "fso-metadata",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "metadata,automation,open-data,API,SMS 2.0,statistics,IOP",
"author": "Pauline Maury Laribi\u00e8re, Lancelot Marti",
"author_email": "pauline.maury-laribiere@bfs.admin.ch, lancelot.marti@bfs.admin.ch",
"download_url": "https://files.pythonhosted.org/packages/39/fb/ed3b82dc4f2bfca9885217defdad421e7ef759498f0c4bc6a426a3eaa100/fso_metadata-0.8.3.tar.gz",
"platform": null,
"description": "# Metadata Auto\n\n## Introduction\n\nThis repository aims to simplify the access to the [Swiss Federal Statistical Office](https://www.bfs.admin.ch/bfs/en/home.html) metadata. \nFollowing the implementation in the [interoperability platform](https://www.i14y.admin.ch) and the [SIS portal](https://sharepoint.admin.ch/edi/bfs/fr-ch/News/Pages/go-life-neues-sis-portals.aspx), the APIs are made available here in python.\nThis public library is made available for the internal FSO staff, the federal administration and for external actors.\n\n## Installation\n\nYou can install the library with\n```\npip install fso_metadata\n```\n\nthen at the beginning of your python script, you will need to \n```\nimport fso_metadata\n```\n\n## Functionnalities\nBased on the metadata that you want, you will call certain functions and parameters. \nIn the first part, we describe the API available from everywhere, then we describe the API available only from within the confederation network.\n\n### Available everywhere with the interoperability plateform (i14y)\n#### Codelists\n1. Export a codelist based on an identifier\n```\nresponse = get_codelist(\n identifier, \n export_format=\"SDMX-ML\", \n version_format=2.1, \n annotations=False\n)\n```\n\n Parameters:\n - identifier (str): the codelist's identifier\n - environment (str, default=\"PRD\"): environment to call\n Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.\n - export_format (str, default=\"SDMX-ML\"): the export's format. \n Available are CSV, XLSX, SDMX-ML or SDMX-JSON.\n - version_format (float, default=2.1): the export format's version \n (2.0 or 2.1 when format is SDMX-ML).\n - annotations (bool, default=False): flag to include annotations\n Returns:\n - response (pd.DataFrame or dict) based on the export format\n - a pd.DataFrame if export_format was CSV or XLSX\n - a dictionnary if export_format was SDMX-ML or SDMX-JSON.\n\n\n#### Nomenclatures\n \n1. Export one level of a nomenclature\n```\nresponse = get_nomenclature_one_level(\n identifier, \n level_number, \n filters={}, \n language='fr', \n annotations=False\n)\n```\n\n Parameters:\n - identifier (str): nomenclature's identifier\n - environment (str, default=\"PRD\"): environment to call\n Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.\n - level_number (int): level to export\n - filter (default={}): additionnal filters\n - language (str, default='fr'): response data's language \n Available are 'fr', 'de', 'it', 'en'.\n - annotations (bool, default=False): flag to include annotations\n Returns:\n - response (pd.DataFrame): dataframe with 3 columns \n (Code, Parent and Name in the selected language)\n\n\n2. Export multiple levels of a nomenclature (from `level_from` to `level_to`)\n```\nresponse = get_nomenclature_multiple_levels(\n identifier, \n level_from, \n level_to, \n filters={}, \n language='fr', \n annotations=False\n)\n```\n\n Parameters:\n - identifier (str): nomenclature's identifier\n - environment (str, default=\"PRD\"): environment to call\n Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.\n - level_from (int): the 1st level to include\n - level_to (int): the last level to include\n - filter (default={}): additionnal filters\n - language (str, default='fr'): response data's language \n Available are 'fr', 'de', 'it', 'en'.\n - annotations (bool, default=False): flag to include annotations\n - post_processing (bool, default=False): flag to post-process\n Returns:\n - response (pd.DataFrame): dataframe columns from `level_from` to `level_to` codes\n\n\nAs the APIs continue to be implemented, further functionnalities will be added.\n\n## Background\nAll the APIs made available in this library are also documented in Swagger UI should you want to do more experiments through a UI. See [here](https://www.i14y.admin.ch/api/index.html) for APIs of the interoperability platform (public).\n\n## Example\n\nExamples for each API are provided in the notebook [examples.ipynb](https://renkulab.io/gitlab/dscc/meatadata-auto/-/blob/master/examples.ipynb).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "FSO metadata access automation. Seamless access to SMS 2.0 APIs in Python.",
"version": "0.8.3",
"split_keywords": [
"metadata",
"automation",
"open-data",
"api",
"sms 2.0",
"statistics",
"iop"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "573bf8da823081a28c0dad4dc59ff91e4ef112ff277be9dcd7b5c5ac36cfd434",
"md5": "f09eff693ca95a210c8cfed8968924b4",
"sha256": "6b7702b848482707189ded81c47272593cd6782836ae75057ef33a180e867499"
},
"downloads": -1,
"filename": "fso_metadata-0.8.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f09eff693ca95a210c8cfed8968924b4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7852,
"upload_time": "2023-01-24T14:47:04",
"upload_time_iso_8601": "2023-01-24T14:47:04.696506Z",
"url": "https://files.pythonhosted.org/packages/57/3b/f8da823081a28c0dad4dc59ff91e4ef112ff277be9dcd7b5c5ac36cfd434/fso_metadata-0.8.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "39fbed3b82dc4f2bfca9885217defdad421e7ef759498f0c4bc6a426a3eaa100",
"md5": "c7328a8e2946e56c6d4e766cc056dc62",
"sha256": "567e71a364f255aeaaeaf75aebfb953c43e3dd37c2fc1c2e885039198b9e8e60"
},
"downloads": -1,
"filename": "fso_metadata-0.8.3.tar.gz",
"has_sig": false,
"md5_digest": "c7328a8e2946e56c6d4e766cc056dc62",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7463,
"upload_time": "2023-01-24T14:47:08",
"upload_time_iso_8601": "2023-01-24T14:47:08.195154Z",
"url": "https://files.pythonhosted.org/packages/39/fb/ed3b82dc4f2bfca9885217defdad421e7ef759498f0c4bc6a426a3eaa100/fso_metadata-0.8.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-24 14:47:08",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "fso-metadata"
}