Commit d4352b19 authored by Pauline Maury Laribière's avatar Pauline Maury Laribière
Browse files

remove last commir

parent 96c4a5a9
Pipeline #269388 passed with stage
in 20 seconds
......@@ -2,36 +2,266 @@
## Introduction
This is a Renku project - basically a git repository with some
bells and whistles. You'll find we have already created some
useful things like `data` and `notebooks` directories and
a `Dockerfile`.
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 R.
This public library is made available for the internal FSO staff, the federal administration and for external actors.
## Working with the project
## Installation
The simplest way to start your project is right from the Renku
platform - just click on the `Environments` tab and start a new session.
This will start an interactive environment right in your browser.
You can install the library with
To work with the project anywhere outside the Renku platform,
click the `Settings` tab where you will find the
git repo URLs - use `git` to clone the project on whichever machine you want.
### Changing interactive environment dependencies
## 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.
Initially we install a very minimal set of packages to keep the images small.
However, you can add python and conda packages in `requirements.txt` and
`environment.yml`, and R packages to `install.R` (listed as, for example,
`install.packages("ggplot2")`), to your heart's content. If you need more fine-grained
control over your environment, please see [the documentation](https://renku.readthedocs.io/en/latest/user/advanced_interfaces.html#dockerfile-modifications).
### 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)
```
## Project configuration
Parameters:
- identifier (str): the codelist's identifier
- 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.
Project options can be found in `.renku/renku.ini`. In this
project there is currently only one option, which specifies
the default type of environment to open, in this case `/rstudio`.
#### ContentConfigurations
## Moving forward
1. Return the display information for the available configured content
```
response = get_content_creation()
```
Returns:
- response (dict): the configured content's display information
Once you feel at home with your project, we recommend that you replace
this README file with your own project documentation! Happy data wrangling!
\ No newline at end of file
2. Return an identifier's nomenclature's information
```
response = get_identifier_content(identifier)
```
Parameters:
- identifier (str): the nomenclature's identifier
Returns:
- response (dict): the nomenclature's information
#### Datasets
1. Get the dataset description
```
response = get_dataset_description(identifier, language='fr')
```
Parameters:
- identifier (str): the nomenclature's identifier
- language (str, default='fr'): the language of the response data.
Available are 'fr', 'de', 'it', 'en'.
Returns:
- response: description's dictionnary
2. Get the dataset information
```
response = get_dataset_information(identifier, language='fr')
```
Parameters:
- identifier (str): the nomenclature's identifier
- language (str, default='fr'): the language of the response data.
Available are 'fr', 'de', 'it', 'en'.
Returns:
- response: information's dictionnary
#### Data Structures
1. Get the data structure
```
response = get_data_structure(identifier, language='fr')
```
Parameters:
- identifier (str): the nomenclature's identifier
- language (str, default='fr'): the language of the response data.
Available are 'fr', 'de', 'it', 'en'.
Returns:
- response: data structure's dictionnary
#### Nomenclatures
1. Get the nodes of a path within a nomenclature
```
response = get_nomenclature_path_nodes(identifier, path, filters={}, language='fr')
```
Parameters:
- identifier (str): the nomenclature's identifier
- path (str): the path leading to the nodes
- filters (dict, default={}): the filters to apply
- language (str, default='fr'): the language of the response data.
Available are 'fr', 'de', 'it', 'en'.
Returns:
- response: dictionnary of the nodes
2. 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
- 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)
3. 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
- 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
Returns:
- response (pd.DataFrame): dataframe columns from `level_from` to `level_to` codes
4. Search query within a nomenclature
```
response = query_nomenclature(identifier, query, page_number, page_size, fiters={}, language='fr')
```
Parameters:
- identifier (str): the nomenclature's identifier
- query (str): the search query
- page_number (int): the number of the result page to return
- page_size (int): the size of each page result
- filter (default={}): additionnal filters
- language (str, default='fr'): response data's language
Available are 'fr', 'de', 'it', 'en'.
Returns:
- response (dict): the query result
### Available only internally (Intern to confederation or via VPN)
All these function start with `dcat_`
#### Agents
1. List all agents
```
response = dcat_list_all_agents()
```
Returns:
- response (dict): all agents
2. Get the agent with the corresponding agent id
```
response = dcat_get_agent_from_id(agent_id)
```
Parameters:
- agent_id (str): agent's id
Returns:
- response (dict): agent with this id
#### Datasets
1. List all datasets
```
response = dcat_list_all_datasets()
```
Returns:
- response (dict): list of all datasets
2. Get all distributions for the dataset with the corresponding dataset id
```
response = dcat_get_distributions_from_dataset_id(dataset_id)
```
Parameters:
- dataset_id (str): dataset's id
Returns:
- response (dict): distributions for the dataset with dataset's id
3. Get the dataset with the corresponding id
```
response = dcat_get_dataset_from_id(dataset_id)
```
Parameters:
- dataset_id (str): dataset's id
Returns:
- response (dict): the dataset
4. Get the dataset with the corresponding identifier
```
response = dcat_get_dataset_from_identifier(identifier: str)
```
Parameters:
- identidier (str): dataset's identifier
Returns:
- response (dict): the dataset
5. Get all distributions for the dataset with the corresponding dataset identifier.
```
response = dcat_get_distributions_from_dataset_identifier(identifier)
```
Parameters:
- identidier (str): dataset's identifier
Returns:
- response (dict): all distributions for the dataset with the corresponding identifier
#### Distribution
1. List all distributions
```
response = dcat_list_all_distributions()
```
Returns:
- response (dict): all distributions
2. Get the distribution with the corresponding id
```
response = dcat_get_distribution_from_id(distribution_id)
```
Parameters:
- distribution_id (str): distribution's id
Returns:
- response (dict): the distribution
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.
- [Here](https://www.i14y.admin.ch/api/index.html) for APIs of the interoperability platform (public).
- [Here](https://dcat.app.cfap02.atlantica.admin.ch/api/index.html) for dcat APIs (internal to configuration).
## Example
Examples for each API are provided in the [R Markdown](https://TODO).
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment