index.html 18 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!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>
74
75
<pre><code><a href="https://rdrr.io/r/utils/install.packages.html">install.packages("remotes")
remotes::install_gitlab("dscc/fso-metadata-r")</a></code></pre>
76
77
78
79
80
81
82
83
84
85
86
87
88
<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>
89
<pre><code>codelist &lt;- get_codelist(identifier, environment, language, export_format, version_format, annotations)</code></pre>
90
91
<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>
92
93
94
95
96
97
98
99
100
101
102
103
104
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="st">    - environment ("character", default="PRD" for production)</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="st">        Available are '</span>PRD<span class="st">', '</span>ABN<span class="st">', '</span>TEST<span class="st">', '</span>QA<span class="st">' and '</span>DEV<span class="st">'.</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="st">    - language ("character", default="all" for all languages, no filtering)</span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a><span class="st">        Available are '</span>all<span class="st">', '</span>fr<span class="st">', '</span>de<span class="st">', '</span>it<span class="st">', '</span>en<span class="st">'.</span></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="st">    - export_format ("character", default="SDMX-ML"): the export'</span>s format. </span>
<span id="cb4-8"><a href="#cb4-8" 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-9"><a href="#cb4-9" 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-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a><span class="st">        (2.0 or 2.1 when format is SDMX-ML).</span></span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a><span class="st">    - annotations (bool, default=FALSE): flag to include annotations</span></span>
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a><span class="st">Returns:</span></span>
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a><span class="st">    - codelist (data.frame) based on the export format</span></span>
<span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a><span class="st">        - a data.frame if export_format was CSV or XLSX</span></span>
<span id="cb4-15"><a href="#cb4-15" 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>
105
106
107
108
109
110
111
</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>
112
<pre><code>one_level_df &lt;- get_nomenclature_one_level(identifier, environment, level_number, filters, language, annotations)</code></pre>
113
114
<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>
115
116
117
118
119
120
121
122
123
124
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="st">    - environment ("character", default="PRD" for production)</span></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a><span class="st">        Available are '</span>PRD<span class="st">', '</span>ABN<span class="st">', '</span>TEST<span class="st">', '</span>QA<span class="st">' and '</span>DEV<span class="st">'.</span></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="st">    - level_number ("numeric"): level to export</span></span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a><span class="st">    - filter (list): additionnal filters in form of named list</span></span>
<span id="cb6-7"><a href="#cb6-7" 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-8"><a href="#cb6-8" 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-9"><a href="#cb6-9" 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-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a>Returns<span class="sc">:</span></span>
<span id="cb6-11"><a href="#cb6-11" 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-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a>        (Code, Parent and Name <span class="cf">in</span> the selected language)</span></code></pre></div>
125
126
127
<ol>
<li>Export multiple levels of a nomenclature (from <code>level_from</code> to <code>level_to</code>)</li>
</ol>
128
<pre><code>multiple_levels_df = get_nomenclature_multiple_levels(identifier, environment, level_from, level_to, filters, language, annotations)</code></pre>
129
130
<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>
131
132
133
134
135
136
137
138
139
140
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="st">    - environment ("character", default="PRD" for production)</span></span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a><span class="st">        Available are '</span>PRD<span class="st">', '</span>ABN<span class="st">', '</span>TEST<span class="st">', '</span>QA<span class="st">' and '</span>DEV<span class="st">'.</span></span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a><span class="st">    - level_from ("numeric"): the 1st level to include</span></span>
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a><span class="st">    - level_to ("numeric"): the last level to include</span></span>
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a><span class="st">    - filter (list): additionnal filters in form of named list</span></span>
<span id="cb8-8"><a href="#cb8-8" 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-9"><a href="#cb8-9" 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-10"><a href="#cb8-10" 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-11"><a href="#cb8-11" aria-hidden="true" tabindex="-1"></a>Returns<span class="sc">:</span></span>
<span id="cb8-12"><a href="#cb8-12" 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>
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<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>
174
175
<p>Practical <a href="https://renkulab.io/gitlab/dscc/metadata-auto-r-library/-/blob/master/demo.R">demo</a>.</p>
<p>A documentation page is also available <a href="https://dscc.gitlab.io/fso-metadata-r/">here</a>.</p>
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
</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>