Skip to content
index.html 16 KiB
Newer Older
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Metadata Auto R • fso.metadata</title>
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="bootstrap-toc.css">
<script src="bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="pkgdown.css" rel="stylesheet">
<script src="pkgdown.js"></script><meta property="og:title" content="Metadata Auto R">
<meta property="og:description" content="This package aims to simplify the access to the Swiss Federal Statistical Office metadata. Following the implementation in the interoperability platform and the SIS portal, 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.">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body data-spy="scroll" data-target="#toc">
    <div class="container template-home">
      <header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="navbar-brand">
        <a class="navbar-link" href="index.html">fso.metadata</a>
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.0.1</span>
      </span>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
<li>
  <a href="index.html">
    <span class="fas fa-home fa-lg"></span>
     
  </a>
</li>
<li>
  <a href="reference/index.html">Reference</a>
</li>
      </ul>
<ul class="nav navbar-nav navbar-right"></ul>
</div>
<!--/.nav-collapse -->
  </div>
<!--/.container -->
</div>
<!--/.navbar -->

      

      </header><div class="row">
  <div class="contents col-md-9">
<div id="fso-metadata-auto-r-package" class="section level1">
<div class="page-header"><h1 class="hasAnchor">
<a href="#fso-metadata-auto-r-package" class="anchor"></a>FSO Metadata Auto R Package</h1></div>
<div id="introduction" class="section level2">
<h2 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h2>
<p>This repository aims to simplify the access to the <a href="https://www.bfs.admin.ch/bfs/en/home.html">Swiss Federal Statistical Office</a> metadata. Following the implementation in the <a href="https://www.i14y.admin.ch">interoperability platform</a> and the <a href="https://sharepoint.admin.ch/edi/bfs/fr-ch/News/Pages/go-life-neues-sis-portals.aspx">SIS portal</a>, 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.</p>
</div>
<div id="installation" class="section level2">
<h2 class="hasAnchor">
<a href="#installation" class="anchor"></a>Installation</h2>
<p>You can install the library with</p>
<pre><code><a href="https://devtools.r-lib.org/reference/remote-reexports.html">devtools::install_url("https://renkulab.io/gitlab/dscc/metadata-auto-r-library/-/archive/v002/metadata-auto-r-library-v002.tar.gz")</a></code></pre>
<p>then at the beginning of your R script, you will need to</p>
<pre><code><a href="https://renkulab.io/gitlab/dscc/metadata-auto-r-library">library("fso.metadata")</a></code></pre>
</div>
<div id="functionnalities" class="section level2">
<h2 class="hasAnchor">
<a href="#functionnalities" class="anchor"></a>Functionnalities</h2>
<p>Based on the metadata that you want, you will call certain functions and parameters.</p>
<div id="codelists" class="section level3">
<h3 class="hasAnchor">
<a href="#codelists" class="anchor"></a>Codelists</h3>
<ol>
<li>Export a codelist based on an identifier</li>
</ol>
<pre><code>codelist &lt;- get_codelist(identifier, export_format, version_format, annotations)</code></pre>
<div class="sourceCode" id="cb4"><pre class="sourceCode R"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>Parameters<span class="sc">:</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>    <span class="sc">-</span> <span class="fu">identifier</span> (<span class="st">"character"</span>)<span class="sc">:</span> the codelist<span class="st">'s identifier</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="st">    - export_format ("character", default="SDMX-ML"): the export'</span>s format. </span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a>        Available are CSV, XLSX, SDMX<span class="sc">-</span>ML or SDMX<span class="sc">-</span>JSON.</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a>    <span class="sc">-</span> <span class="fu">version_format</span> (<span class="st">"numeric"</span>, <span class="at">default=</span><span class="fl">2.1</span>)<span class="sc">:</span> the export format<span class="st">'s version </span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a><span class="st">        (2.0 or 2.1 when format is SDMX-ML).</span></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="st">    - annotations (bool, default=FALSE): flag to include annotations</span></span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a><span class="st">Returns:</span></span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a><span class="st">    - codelist (data.frame) based on the export format</span></span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a><span class="st">        - a data.frame if export_format was CSV or XLSX</span></span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a><span class="st">        - a json if export_format was SDMX-ML or SDMX-JSON.</span></span></code></pre></div>
</div>
<div id="nomenclatures" class="section level3">
<h3 class="hasAnchor">
<a href="#nomenclatures" class="anchor"></a>Nomenclatures</h3>
<ol>
<li>Export one level of a nomenclature</li>
</ol>
<pre><code>one_level_df &lt;- get_nomenclature_one_level(identifier, level_number, filters, language, annotations)</code></pre>
<div class="sourceCode" id="cb6"><pre class="sourceCode R"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>Parameters<span class="sc">:</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a>    <span class="sc">-</span> <span class="fu">identifier</span> (<span class="st">"character"</span>)<span class="sc">:</span> nomenclature<span class="st">'s identifier</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="st">    - level_number ("numeric"): level to export</span></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a><span class="st">    - filter (list): additionnal filters in form of named list</span></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="st">    - language ("character", default='</span>fr<span class="st">'): response data'</span>s language </span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a>        Available are <span class="st">'fr'</span>, <span class="st">'de'</span>, <span class="st">'it'</span>, <span class="st">'en'</span>.</span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a>    <span class="sc">-</span> <span class="fu">annotations</span> (bool, <span class="at">default=</span><span class="cn">FALSE</span>)<span class="sc">:</span> flag to include annotations</span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a>Returns<span class="sc">:</span></span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a>    <span class="sc">-</span> <span class="fu">response</span> (data.frame)<span class="sc">:</span> dataframe with <span class="dv">3</span> columns </span>
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a>        (Code, Parent and Name <span class="cf">in</span> the selected language)</span></code></pre></div>
<ol>
<li>Export multiple levels of a nomenclature (from <code>level_from</code> to <code>level_to</code>)</li>
</ol>
<pre><code>multiple_levels_df = get_nomenclature_multiple_levels(identifier, level_from, level_to, filters, language, annotations)</code></pre>
<div class="sourceCode" id="cb8"><pre class="sourceCode R"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>Parameters<span class="sc">:</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a>    <span class="sc">-</span> <span class="fu">identifier</span> (<span class="st">"character"</span>)<span class="sc">:</span> nomenclature<span class="st">'s identifier</span></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="st">    - level_from ("numeric"): the 1st level to include</span></span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a><span class="st">    - level_to ("numeric"): the last level to include</span></span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a><span class="st">    - filter (list): additionnal filters in form of named list</span></span>
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a><span class="st">    - language ("character", default='</span>fr<span class="st">'): response data'</span>s language </span>
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a>        Available are <span class="st">'fr'</span>, <span class="st">'de'</span>, <span class="st">'it'</span>, <span class="st">'en'</span>.</span>
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true" tabindex="-1"></a>    <span class="sc">-</span> <span class="fu">annotations</span> (bool, <span class="at">default=</span><span class="cn">FALSE</span>)<span class="sc">:</span> flag to include annotations</span>
<span id="cb8-9"><a href="#cb8-9" aria-hidden="true" tabindex="-1"></a>Returns<span class="sc">:</span></span>
<span id="cb8-10"><a href="#cb8-10" aria-hidden="true" tabindex="-1"></a>    <span class="sc">-</span> <span class="fu">multiple_levels_df</span> (data.frame)<span class="sc">:</span> dataframe columns from <span class="st">`</span><span class="at">level_from</span><span class="st">`</span> to <span class="st">`</span><span class="at">level_to</span><span class="st">`</span> codes</span></code></pre></div>
<p>As the APIs continue to be implemented, further functionnalities will be added.</p>
</div>
<div id="upcoming-function-data-structures" class="section level3">
<h3 class="hasAnchor">
<a href="#upcoming-function-data-structures" class="anchor"></a>Upcoming function: Data Structures</h3>
<ol>
<li>Get the data structure (not available yet)</li>
</ol>
<pre><code>data_structure &lt;- get_data_structure(identifier, language)</code></pre>
<div class="sourceCode" id="cb10"><pre class="sourceCode R"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>Parameters<span class="sc">:</span></span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a>    <span class="sc">-</span> <span class="fu">identifier</span> (<span class="st">"character"</span>)<span class="sc">:</span> the nomenclature<span class="st">'s identifier</span></span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a><span class="st">    - language ("character", default='</span>fr<span class="st">'): the language of the response data. </span></span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a><span class="st">        Available are '</span>fr<span class="st">', '</span>de<span class="st">', '</span>it<span class="st">', '</span>en<span class="st">'.</span></span>
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a><span class="st">Returns:</span></span>
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a><span class="st">    - data_structure: data structure</span></span>
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a><span class="st">    </span></span></code></pre></div>
</div>
</div>
<div id="background" class="section level2">
<h2 class="hasAnchor">
<a href="#background" class="anchor"></a>Background</h2>
<p>All the APIs made available in this library are also documented in Swagger UI should you want to do more experiments through a UI.</p>
<ul>
<li>
<a href="https://www.i14y.admin.ch/api/index.html">Here</a> for APIs of the interoperability platform (public).</li>
<li>
<a href="https://dcat.app.cfap02.atlantica.admin.ch/api/index.html">Here</a> for dcat APIs (internal to configuration).</li>
</ul>
</div>
<div id="example" class="section level2">
<h2 class="hasAnchor">
<a href="#example" class="anchor"></a>Example</h2>
<p>Examples for each API are provided in the <a href="https://renkulab.io/gitlab/dscc/metadata-auto-r-library/-/blob/master/example.Rmd">R Markdown</a>.</p>
</div>
</div>
  </div>

  <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
    <div class="license">
<h2>License</h2>
<ul class="list-unstyled">
<li>GPL (&gt;= 2)</li>
</ul>
</div>
<div class="developers">
<h2>Developers</h2>
<ul class="list-unstyled">
<li>Pauline Maury Laribiere <br><small class="roles"> Author, maintainer </small>  </li>
</ul>
</div>

  </div>
</div>


      <footer><div class="copyright">
  <p>Developed by Pauline Maury Laribiere.</p>
</div>

<div class="pkgdown">
  <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.6.1.</p>
</div>

      </footer>
</div>

  


  </body>
</html>