-
Notifications
You must be signed in to change notification settings - Fork 0
/
bookdown-FORESTRY.tex
1604 lines (1270 loc) · 71.8 KB
/
bookdown-FORESTRY.tex
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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
174
175
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{book}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
pdftitle={Forestry Production and Trade in the SWS},
hidelinks,
pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage{longtable,booktabs}
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{colortbl}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage{makecell}
\usepackage{xcolor}
\title{Forestry Production and Trade in the SWS}
\author{Bruno Caetano Vidigal and Francy Lisboa
Statistician - ESS - Methodological Innovation Team}
\date{2020-04-16}
\begin{document}
\maketitle
{
\setcounter{tocdepth}{1}
\tableofcontents
}
\hypertarget{welcome}{%
\chapter*{\texorpdfstring{\textbf{Welcome}}{Welcome}}\label{welcome}}
\addcontentsline{toc}{chapter}{\textbf{Welcome}}
\textbf{Forestry Production and Trade (FPT)} is migrating its statistical processes into the Corporate Statistical Working System (SWS). This document describes the main institutional actors involved in the migration as well as the FPT - SWS resources (\textbf{code lists}, \textbf{datasets}, \textbf{data tables}) that have been created to support the SWS plugins (R modules) to meet technical unit requirements. Furthermore, the SWS plugins are presented in the form of chapters providing a detailed description of their workflows involving \textbf{input -\textgreater{} processing -\textgreater{} output} as well as results showing whether the modules have lived up to expectations.
\begin{rmdnote}
\textbf{IMPORTANT:} Use the \textbf{Chrome browser} to have a correct
vizualization of HTML outputs in this online document.
\end{rmdnote}
\begin{center}\includegraphics{images/forestry_cover_book} \end{center}
\hypertarget{preface}{%
\chapter*{\texorpdfstring{\textbf{Preface}}{Preface}}\label{preface}}
\addcontentsline{toc}{chapter}{\textbf{Preface}}
\hypertarget{how-to-use-this-book}{%
\section*{\texorpdfstring{\textbf{How to use this book}}{How to use this book}}\label{how-to-use-this-book}}
\addcontentsline{toc}{section}{\textbf{How to use this book}}
This book contains the entire documentation of the migration of the Forestry Production and Trade statistical processes to the Statistical Working System (SWS).
The chapters are organized by modules.
\begin{table}[H]
\centering\begingroup\fontsize{12}{14}\selectfont
\begin{tabular}{l|l}
\hline
\rowcolor[HTML]{a9c9a7} Chapter & Description\\
\hline
Ch \textbackslash{}@ref(ForestryFramework) & Provides the framework and entire overview.\\
\hline
Ch \textbackslash{}@ref(ForestryUNECEITTOInputData) & Provides the whole documentation of the module Forestry\_UNECE\_ITTO\_Input\_Data.\\
\hline
Ch \textbackslash{}@ref(ForestryValidationInput) & Provides the whole documentation of the module Forestry\_Validation\_Input.\\
\hline
Ch \textbackslash{}@ref(ForestryCarryForward) & Provides the whole documentation of the module faoswsForestryCarryForward.\\
\hline
Ch \textbackslash{}@ref(faoswsForestryAggregation) & Provides the whole documentation of the module faoswsForestryAggregation..\\
\hline
Ch \textbackslash{}@ref(ForestryValidationAnnualChanges) & Provides the whole documentation of the module ForestryValidationAnnualChanges.\\
\hline
Ch \textbackslash{}@ref(ForestryValidationNegativeConsump) & Provides the whole documentation of the module ForestryValidationNegativeConsumption.\\
\hline
Ch \textbackslash{}@ref(ForestryValidationUnitPrice) & Provides the whole documentation of the module ForestryValidationUnitPrice.\\
\hline
Appendix & Describe all code lists, reference tables (datatables) and data sets.\\
\hline
\end{tabular}
\endgroup{}
\end{table}
\hypertarget{why-to-use-the-sws}{%
\section*{\texorpdfstring{\textbf{Why to use the SWS}}{Why to use the SWS}}\label{why-to-use-the-sws}}
\addcontentsline{toc}{section}{\textbf{Why to use the SWS}}
The Statistical Working System (SWS) is a corporate system that supports data collection, processing and validation, metadata management, and quality assessment of FAO's main statistical domains in line with the Generic Statistical Business Process Model. It has a dual nature -- both technological and statistical -- and for this reason, is developed by two different teams (the IT Division {[}CIO{]} and the Statistics Division {[}ESS{]}). The SWS provides an end-to-end solution for inputting and storing raw data, performing automated statistical processes (e.g.~imputation, validation, etc.), and producing data that are ready for dissemination. Moreover, the reasons why you should use the SWS are:
\begin{itemize}
\tightlist
\item
The SWS improves data quality by \textbf{centralizing and standardizing} the maintenance of data, classification systems, methodologies, and standards.
\item
The SWS is \textbf{cost-efficient} in terms of statistical development and functionalities:
\begin{itemize}
\tightlist
\item
Technical units can adopt methods and even pieces of codes developed for other units: documentation and scripts are open;
\item
Users have direct access to some common datasets, thus removing duplication of efforts;
\item
New functionalities reflect the requirements of all users and are available to all users, with economies of scale on IT development.
\end{itemize}
\item
Users have \textbf{full control of the quality} of the data they are producing:
\begin{itemize}
\tightlist
\item
Increased use of advanced and semi-automated statistical methods reduce the need for manual interventions and ensure that results are reproducible;
\item
Establishment and use of a `basic' set of quality and performance indicators for processes and outputs based on the FAO Statistical Quality Assurance Framework (SQAF);
\item
Assessment and publication of quality indicators on a regular basis.
\end{itemize}
\item
The SWS ensures \textbf{corporate data consistency} through the adoption of statistical standards. In particular, the SWS
\begin{itemize}
\tightlist
\item
Facilitates the adoption of corporate standard classifications, metadata and code lists through seamless integration with the corporate Reference Data Management system;
\item
Reduces the fragmentation and duplication of sources (e.g.~population data), thus reducing inconsistencies across technical units;
\item
Provides flexible tools for a wide range of data collection processes including web data scraping and questionnaire management, thus reducing the duplication of data collection efforts.
\end{itemize}
\item
The SWS preserves \textbf{institutional knowledge} by recording the history of data revisions, automating methodology and calculations, and providing end users with unambiguous instructions to follow.
\end{itemize}
Go to the \href{https://hqlqasws1.hq.un.fao.org:8443/sws/}{Statistical Working System} website (restricted access).
\hypertarget{migration-actors}{%
\section*{\texorpdfstring{\textbf{Migration actors}}{Migration actors}}\label{migration-actors}}
\addcontentsline{toc}{section}{\textbf{Migration actors}}
Any migration into the SWS requires the interaction between at least three actors:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
The \textbf{technical unit} interested in automating either some or all its analytical processes in the SWS. The technical unit can be treated as client demanding services from the counterparts responsible for the implementation of its data and statistical assets in the SWS. Therefore, a successful Forestry Production and Trade migration depends on the coordination between the technical division and other parts. In the Forestry Production and Trade migration to SWS the technical unit is represented by:
\end{enumerate}
\begin{itemize}
\tightlist
\item
\textbf{Arvydas Lebedys} \emph{Forestry Officer (FOA)}
\item
\textbf{Roberto Bargigia} \emph{Forestry clerk (FOA)}
\item
\textbf{Iana Arkhipova} \emph{Statistician (FOA)}
\end{itemize}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{1}
\tightlist
\item
The \textbf{ESS - Methodological Innovation Team} (ESS - SWS) responsible for the implementation and documentation of the required statistical processes. From the ESS - SWS team the focal points are:
\end{enumerate}
\begin{itemize}
\tightlist
\item
\textbf{Bruno Caetano Vidigal} \emph{Statistician (ESS)}
\item
\textbf{Francy Lisboa} \emph{Agronomist/Statistician (ESS)}
\item
\textbf{Luís G. Silva e Silva} \emph{Statistician (ESS)}
\item
\textbf{Carola Fabi} \emph{Senior Statistician (ESS)}
\end{itemize}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{2}
\tightlist
\item
The \textbf{CIO - SWS} the \textbf{primary backend and frontend maintainer of the SWS} and responsible for the implementation and documentation of non-statistical processes (IT infrastructure). The CIO - SWS team have as interlocutors:
\end{enumerate}
\begin{itemize}
\tightlist
\item
\textbf{Enrico Anello} \emph{Full Stack Developer (CIO)}
\item
\textbf{Matteo Terrinoni} \emph{Lead Front End Developer (CIO)}
\item
\textbf{John Rowell} \emph{Information Technology Officer (CIO)}
\end{itemize}
\hypertarget{ForestryFramework}{%
\chapter{\texorpdfstring{\textbf{Forestry Production and Trade - Framework}}{Forestry Production and Trade - Framework}}\label{ForestryFramework}}
This book focuses on the migration of the Forestry Production and Trade statistical processes to SWS. Therefore, it is important to provide an overview of the statistical value chain carried by FOA. The next sections summarize the Forestry Production and Trade data collection and information management methodology.
\begin{figure}
{\centering \includegraphics[width=1\linewidth]{images/Forestry_workflow}
}
\caption{Workflow of the Forestry Production and Trade process}\label{fig:forestryWorkflow}
\end{figure}
\hypertarget{data-collection}{%
\section{\texorpdfstring{\textbf{Data Collection}}{Data Collection}}\label{data-collection}}
The Forestry Production and Trade data collection relies on the \href{http://www.fao.org/forestry/statistics/jfsq/en/}{Joint Forestry Sector Questionnaire distpatch}. The dispatch of the \href{http://www.fao.org/forestry/statistics/jfsq/en/}{same harmonized questionnaire} is carried out by FAO by its international partners:
\begin{itemize}
\tightlist
\item
\textbf{ITTO} : The \href{https://www.itto.int/}{International Tropical Timber Organization}
\item
\textbf{Eurostat} : The \href{https://ec.europa.eu/eurostat}{European Statistics}
\item
\textbf{UNECE} : The \href{http://www.unece.org/info/ece-homepage.html}{United Nations Economic Comission for Europe}
\end{itemize}
FAO sends questionnaires to countries in May/June and the deadline for the first response is September 1st. The partners send out questionnaires between April and June and FAO receives validated data from partners from July to November.
\hypertarget{entering-data}{%
\section{\texorpdfstring{\textbf{Entering Data}}{Entering Data}}\label{entering-data}}
Both data coming from either questionnaires or FAO partners are entered in the SWS by the user through csv files. Once the data are in the system, a validation procedure takes place.
\hypertarget{aggregates}{%
\section{\texorpdfstring{\textbf{Aggregates}}{Aggregates}}\label{aggregates}}
Once the data has been validated, the user is ready to go ahead and generate the aggregates through the module \textbf{faoswsForestryAggregation}. More information about this module is found in the chapter \ref{faoswsForestryAggregation}.
\hypertarget{validationdissemination}{%
\section{\texorpdfstring{\textbf{Validation/Dissemination}}{Validation/Dissemination}}\label{validationdissemination}}
After calculating the aggregates, three modules are ran in order to perform other kinds of validation (annual changes, negative consumption and unit value). More information about these modules are found in the chapters \ref{ForestryValidationAnnualChanges}, \ref{ForestryValidationNegativeConsump} and \ref{ForestryValidationUnitPrice}.
After the step validation, the FOA unit responsible for Forestry Production and Trade can disseminate the data in the FAOSTAT.
\hypertarget{ForestryUNECEITTOInputData}{%
\chapter{\texorpdfstring{\textbf{The Forestry\_UNECE\_ITTO\_Input\_Data module}}{The Forestry\_UNECE\_ITTO\_Input\_Data module}}\label{ForestryUNECEITTOInputData}}
The \textbf{Forestry\_UNECE\_ITTO\_Input\_Data} module is essentially a data harvester. It pulls the raw data provided by partners from the datatable \texttt{UNECE/ITTO\ Input\ Data} and coverts it into a SWS-compliant dataset format. The module deals not only with the data itself, but also with the metadata available.
It is important to note that, while the process described above is automated, the user must upload the \emph{.csv} file format to the datatable \texttt{UNECE/ITTO\ Input\ Data}.
\textbackslash begin\{figure\}
\{\centering \includegraphics[width=1\linewidth]{images/forestryInputDataUNECE}
\}
\textbackslash caption\{Workflow of the Forestry\_UNECE\_ITTO\_Input\_Data module\}\label{fig:forestryInputData}
\textbackslash end\{figure\}
\hypertarget{steps}{%
\section{\texorpdfstring{\textbf{Steps}}{Steps}}\label{steps}}
The module is straightforward as it checks if the data for countries/items coming from the input data does exist in the \textbf{forestry\_prod\_trade} dataset.
To do so, the module checks the code lists for countries (\textbf{geographicAreaM49}) and for items (\textbf{measuredItemForestry}) as they are used to build the forestry data set. In case there is any inconsistency, a message will pop up in the system warning the user and a input data validation will be needed.
\hypertarget{running-the-module}{%
\section{\texorpdfstring{\textbf{Running the module}}{Running the module}}\label{running-the-module}}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
Log in the SWS;
\item
Click on \textbf{New Query};
\item
Select \textbf{Forestry domain} and \textbf{forestry\_prod\_trade dataset};
\item
Select whatever geographicAreaM49, measuredElement, measuredItemForestry and timePointYears. After that, run the query;
\textbackslash begin\{figure\}
\end{enumerate}
\{\centering \includegraphics[width=1\linewidth]{images/query_forestry_unece_itto_input_data_plugin}
\}
\caption{Steps 1 to 4}
\label{fig:queryUneceItto}
\textbackslash end\{figure\}
5. Click on \textbf{Run plugin} on the top-right;
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{5}
\tightlist
\item
Select the \textbf{Forestry\_UNECE\_ITTO\_Input\_Data} module, choose the \emph{parameters} (Start and End year) and click on \textbf{Run plugin};
\end{enumerate}
\textbackslash begin\{figure\}
\{\centering \includegraphics[width=1\linewidth]{images/forestry_select_plugin_unece_itto_input_data}
\}
\textbackslash caption\{Select the Forestry\_UNECE\_ITTO\_Input\_Data plugin and run it\}\label{fig:UneceIttoPlugin}
\textbackslash end\{figure\}
7. Wait for the results to appear in the session;
8. Click on \textbf{Save to dataset}.
\hypertarget{ForestryValidationInput}{%
\chapter{\texorpdfstring{\textbf{The Forestry\_Validation\_Input module}}{The Forestry\_Validation\_Input module}}\label{ForestryValidationInput}}
The \textbf{Forestry\_Validation\_Input} module aims to validate the input data used to calculate aggregates. It plays an important role in detecting inconsistency, if any, as this is the precedent step before the aggregates.
\textbackslash begin\{figure\}
\{\centering \includegraphics[width=0.85\linewidth]{images/forestryInputDataValidation}
\}
\textbackslash caption\{Workflow of the Forestry\_Validation\_Input module\}\label{fig:forestryInputDataValidation}
\textbackslash end\{figure\}
\hypertarget{steps-1}{%
\section{\texorpdfstring{\textbf{Steps}}{Steps}}\label{steps-1}}
This plugin will be ran over the dataset \textbf{forestry\_prod\_trade} doing the following checks:
\begin{itemize}
\tightlist
\item
check and identify broken series (e.g.~the country A has data for item I and element E for 1961, 1962, 1963, 1965. In this example, there's a break in the series in 1964);
\item
check and identify combinations that cannot exist (based on the the datatable \texttt{Forestry\ Product\ Aggregation\ Elements});
\item
spot countries that should not have data in a given year;
\item
check inconsistency in the trade data (e.g.~if both trade value and quantity exist).
\end{itemize}
An email will be sent to the user with the four outputs above. This plugin should be tested before the aggregation step. If there's no problem in the dataset, the data is ready to be used as an input to calculate the aggregates.
\hypertarget{running-the-module-1}{%
\section{\texorpdfstring{\textbf{Running the module}}{Running the module}}\label{running-the-module-1}}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
Log in the SWS;
\item
Click on \textbf{New Query};
\item
Select \textbf{Forestry domain} and \textbf{forestry\_prod\_trade dataset};
\item
Select whatever geographicAreaM49, measuredElement, measuredItemForestry and timePointYears. After that, run the query;
\textbackslash begin\{figure\}
\end{enumerate}
\{\centering \includegraphics[width=1\linewidth]{images/query_forestry_unece_itto_input_data_plugin}
\}
\caption{Steps 1 to 4}
\label{fig:queryForestryprodtrade}
\textbackslash end\{figure\}
5. Click on \textbf{Run plugin} on the top-right;
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{5}
\tightlist
\item
Select the \textbf{Forestry\_Validation\_Input} module, choose the \emph{parameters} (Start and End year) and click on \textbf{Run plugin};
\end{enumerate}
\textbackslash begin\{figure\}
\{\centering \includegraphics[width=1\linewidth]{images/forestry_input_validation_plugin}
\}
\textbackslash caption\{Select the Forestry\_Validation\_Input plugin and run it\}\label{fig:InputValidationPlugin}
\textbackslash end\{figure\}
7. Wait for the results to appear in the session;
8. Click on \textbf{Save to dataset}.
\hypertarget{ForestryCarryForward}{%
\chapter{\texorpdfstring{\textbf{The faoswsForestryCarryForward module}}{The faoswsForestryCarryForward module}}\label{ForestryCarryForward}}
A step right before calculating the aggregates is to \emph{Carry-Forward} the input data (\textbf{forestry\_prod\_trade} dataset). This step is paramount while the \emph{new data} coming from partners and questionnaires do not arrive. Thus, the whole process does not get stuck and the aggregates are calculated.
\begin{figure}
{\centering \includegraphics[width=0.85\linewidth]{images/forestryCarryForward}
}
\caption{Workflow of the faoswsForestryCarryForward module}\label{fig:forestryCarryForward}
\end{figure}
\hypertarget{steps-2}{%
\section{\texorpdfstring{\textbf{Steps}}{Steps}}\label{steps-2}}
The module is straightforward as it just imputes data by the carry-forward method. The module is smart enough to inform the user in case there is already data for the chosen year or if the year in question is too far from the last available year with data.
\hypertarget{running-the-module-2}{%
\section{\texorpdfstring{\textbf{Running the module}}{Running the module}}\label{running-the-module-2}}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
Log in the SWS;
\item
Click on \textbf{New Query};
\item
Select \textbf{Forestry domain} and \textbf{forestry\_prod\_trade dataset};
\item
Select whatever geographicAreaM49, measuredElement, measuredItemForestry and timePointYears. After that, run the query;
\textbackslash begin\{figure\}
\end{enumerate}
\{\centering \includegraphics[width=1\linewidth]{images/query_forestry_unece_itto_input_data_plugin}
\}
\caption{Steps 1 to 4}
\label{fig:queryCarryForward}
\textbackslash end\{figure\}
5. Click on \textbf{Run plugin} on the top-right;
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{5}
\tightlist
\item
Select the \textbf{faoswsForestryCarryForward} module, choose the \emph{parameter} (Year to impute) and click on \textbf{Run plugin};
\end{enumerate}
\begin{figure}
{\centering \includegraphics[width=1\linewidth]{images/carry_forward_plugin}
}
\caption{Select the faoswsForestryCarryForward plugin and run it}\label{fig:CarryForwardPlugin}
\end{figure}
7. Wait for the results to appear in the session;
8. Click on \textbf{Save to dataset}.
\hypertarget{faoswsForestryAggregation}{%
\chapter{\texorpdfstring{\textbf{The faoswsForestryAggregation module}}{The faoswsForestryAggregation module}}\label{faoswsForestryAggregation}}
The module \textbf{faoswsForestryAggregation} comprehend the main step in the \emph{Forestry Production and Trade} process as it calculates the agrgegates by region and item that will be disseminated through \textbf{Faostat}.
\begin{figure}
{\centering \includegraphics[width=0.85\linewidth]{images/faoswsForestryAggregation}
}
\caption{Workflow of the faoswsForestryAggregation module}\label{fig:faoswsForestryAggregationWorkflow}
\end{figure}
\hypertarget{steps-3}{%
\section{\texorpdfstring{\textbf{Steps}}{Steps}}\label{steps-3}}
The module can be basically split into four parts as below.
\hypertarget{read-in-the-data}{%
\subsection{\texorpdfstring{\textbf{Read in the data}}{Read in the data}}\label{read-in-the-data}}
The module uses the \textbf{forestry\_prod\_trade} dataset as input. According to the technical unit, they will be constantly changing this dataset throughout the data cycle, specially when new data come in or the officers decide to make changes based on their domain knowledge.
\hypertarget{get-regional-aggregation}{%
\subsection{\texorpdfstring{\textbf{Get regional aggregation}}{Get regional aggregation}}\label{get-regional-aggregation}}
After reading in the input dataset, the module geographically aggregates the primary commodities based on FAOSTAT - UNSD M49 mapping. Please, for a full representation of this table consult either the Appendix \ref{tab:m49fsisomapping} or \href{http://www.fao.org/faostat/en/\#data/FO}{this link}.
\hypertarget{get-forestry-commodity-aggregation}{%
\subsection{\texorpdfstring{\textbf{Get Forestry commodity aggregation}}{Get Forestry commodity aggregation}}\label{get-forestry-commodity-aggregation}}
Once a data set with regional aggregate is ready, the module moves to producing commodity aggregations at the national and regional levels.
Since there is an interplay between commodity groups, the module carries the aggregation in tandem, with four commodity groups being aggregated first and then rest of aggregates.
\begin{table}
\caption{\label{tab:tab1}First commodity groups to be calculated by the faoswsForestryAggregation module}
\centering
\fontsize{12}{14}\selectfont
\begin{tabular}[t]{llll}
\toprule
\rowcolor[HTML]{a9c9a7} CommodityGroup & CommodityGroupName & CommodityCode & CommodityName\\
\midrule
1656 & Chemical wood pulp & 1660 & Chemical wood pulp, sulphite, unbleached\\
1656 & Chemical wood pulp & 1661 & Chemical wood pulp, sulphite, bleached\\
1656 & Chemical wood pulp & 1662 & Chemical wood pulp, sulphate, unbleached\\
1656 & Chemical wood pulp & 1663 & Chemical wood pulp, sulphate, bleached\\
1674 & Printing and writing papers & 1612 & Printing and writing papers, uncoated, wood containing\\
\addlinespace
1674 & Printing and writing papers & 1615 & Printing and writing papers, uncoated, wood free\\
1674 & Printing and writing papers & 1616 & Printing and writing papers, coated\\
1675 & Other paper and paperboard & 1676 & Household and sanitary papers\\
1675 & Other paper and paperboard & 1681 & Wrapping and packaging paper and paperboard\\
1675 & Other paper and paperboard & 1683 & Other paper and paperboard n.e.s.\\
\addlinespace
1681 & Wrapping and packaging paper and paperboard & 1617 & Case materials\\
1681 & Wrapping and packaging paper and paperboard & 1618 & Cartonboard\\
1681 & Wrapping and packaging paper and paperboard & 1621 & Wrapping papers\\
1681 & Wrapping and packaging paper and paperboard & 1622 & Other papers mainly for packaging\\
\bottomrule
\end{tabular}
\end{table}
\hypertarget{get-unit-values}{%
\subsection{\texorpdfstring{\textbf{Get Unit values}}{Get Unit values}}\label{get-unit-values}}
Once the import and export figures are calculated for values and quantity, the unit price, which is the quotient between values and quantity, can be easily calculated for both primary and group commodities at the national and regional levels.
\hypertarget{get-back-the-original-flags}{%
\subsection{\texorpdfstring{\textbf{Get back the original flags}}{Get back the original flags}}\label{get-back-the-original-flags}}
With unit values already in the data sets (national and regional), the last step is to recovery the flags from the original input. Data records added during the processing come either from geographic or commodity aggregation. Therefore, these records have \textbf{``E''} (Aggregation) as flagObservationStatus and \textbf{``s''} (summation) as flagMethod.
\hypertarget{convert-faostat-regions-to-sws-regions}{%
\subsection{\texorpdfstring{\textbf{Convert FAOSTAT regions to SWS regions}}{Convert FAOSTAT regions to SWS regions}}\label{convert-faostat-regions-to-sws-regions}}
The processed regional data set uses FAOSTAT codes for regions. To be able to save the results in the SWS, regions must be converted to SWS regional codes compatible with the \textbf{geographicAreaM49} in the \textbf{forestry\_prod\_trade\_agg} dataset. For this, the module uses the following function.
\hypertarget{binding-national-and-regional-data}{%
\subsection{\texorpdfstring{\textbf{Binding national and regional data}}{Binding national and regional data}}\label{binding-national-and-regional-data}}
Binding national and regional data sets.
\hypertarget{compare-before-and-after-aggregations}{%
\subsection{\texorpdfstring{\textbf{Compare before and after aggregations}}{Compare before and after aggregations}}\label{compare-before-and-after-aggregations}}
As a validation tool, the faoswsForestryAggregation module also needs to return what has changed from the input dataset. The module flags values where the absolute difference between the input dataset and the aggregate dataset is higher than 0.1.
\hypertarget{save-data-in-the-sws-share-drive-and-database}{%
\subsection{\texorpdfstring{\textbf{Save data in the SWS Share Drive and database}}{Save data in the SWS Share Drive and database}}\label{save-data-in-the-sws-share-drive-and-database}}
The data with primary and grouped commodities at the national and regional levels can be accessed by the user as a csv file in the \href{file://hqlprsws1.hq.un.fao.org/sws_r_share/ForestryProdAndTrade/output/faoswsForestryAggregation/}{SWS shared drive}. The full data is saved in the folder \textbf{ForestryProdAndTrade -\textgreater{} output -\textgreater{} faoswsForestryAggregation -\textgreater{} results}, whereas the comparison csv file is saved in the folder \textbf{ForestryProdAndTrade -\textgreater{} output -\textgreater{} faoswsForestryAggregation -\textgreater{} comparisons}. Every time the module runs these files are updated.
In the SWS - database, the data is found in the dataset \textbf{forestry\_prod\_trade\_agg}.
\hypertarget{running-the-module-3}{%
\section{\texorpdfstring{\textbf{Running the module}}{Running the module}}\label{running-the-module-3}}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
Log in the SWS;
\item
Click on \textbf{New Query};
\item
Select \textbf{Forestry domain} and \textbf{forestry\_prod\_trade\_agg dataset};
\item
Select whatever geographicAreaM49, measuredElement, measuredItemForestry and timePointYears. After that, run the query;
\textbackslash begin\{figure\}
\end{enumerate}
\{\centering \includegraphics[width=1\linewidth]{images/forestry_prod_trade_agg_query}
\}
\caption{Steps 1 to 4}
\label{fig:queryAggregates}
\textbackslash end\{figure\}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{4}
\tightlist
\item
Select the \textbf{faoswsForestryAggregation} module, choose the \emph{parameters} (Start and End year) and click on \textbf{Run plugin};
\end{enumerate}
\begin{figure}
{\centering \includegraphics[width=1\linewidth]{images/aggregate_parameters}
}
\caption{Select the faoswsForestryAggregation plugin and run it}\label{fig:AggregatePlugin}
\end{figure}
6. Wait for a window message to appear in the session: \textbf{ForestryAggregation module ran successfully!!!};
7. Click on \textbf{Save to dataset}.
\hypertarget{ForestryValidationAnnualChanges}{%
\chapter{\texorpdfstring{\textbf{The ForestryValidationAnnualChanges module}}{The ForestryValidationAnnualChanges module}}\label{ForestryValidationAnnualChanges}}
The module \textbf{ForestryValidationAnnualChanges} pulls out records with significant abnormal high annual changes on production, imports and exports according to parameters set by the user.
\begin{figure}
{\centering \includegraphics[width=0.85\linewidth]{images/ForestryValidationAnnualChanges}
}
\caption{Workflow of the ForestryValidationAnnualChanges module}\label{fig:forestryAnnualChanges}
\end{figure}
\hypertarget{steps-4}{%
\section{\texorpdfstring{\textbf{Steps}}{Steps}}\label{steps-4}}
The module applies simple check in the data. Basically it does the following.
\hypertarget{read-in-data}{%
\subsection{Read in data}\label{read-in-data}}
The module reads data from \textbf{forestry\_prod\_trade\_agg} dataset and from the datatables listed in the figure \ref{fig:ForestryValidationUnitPriceWorkflow}.
\hypertarget{data-filtering}{%
\subsection{Data filtering}\label{data-filtering}}
After pulling the needed data, the module applies filters using the parameters chosen by the user accordingly. The module has two kinds of parameters:
\begin{itemize}
\tightlist
\item
time range (\emph{start} and \emph{end} year of the process) - \textbf{Start year} and \textbf{End year};
\item
quantity threshold (minimum quantity analysed) - \textbf{Production Qty threshold}.
\item
percentage change - \textbf{Percentage Change}.
\end{itemize}
\hypertarget{annual-change-check}{%
\subsection{Annual Change check}\label{annual-change-check}}
At this stage, there are only the target data as the time range and quantity threshold were applied. Therefore, the module verifies if within the remaining data there is any item with an percentage annual change beyond its limits.
\hypertarget{email-the-user}{%
\subsection{Email the user}\label{email-the-user}}
The final step of this module is to email the user with the output.
\hypertarget{running-the-module-4}{%
\section{\texorpdfstring{\textbf{Running the module}}{Running the module}}\label{running-the-module-4}}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
Log in the SWS;
\item
Click on \textbf{New Query};
\item
Select \textbf{Forestry domain} and \textbf{forestry\_prod\_trade\_agg dataset};
\item
Select whatever geographicAreaM49, measuredElement, measuredItemForestry and timePointYears. After that, run the query;
\textbackslash begin\{figure\}
\end{enumerate}
\{\centering \includegraphics[width=1\linewidth]{images/forestry_prod_trade_agg_query}
\}
\caption{Steps 1 to 4}
\label{fig:queryAnnualChanges}
\textbackslash end\{figure\}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{4}
\tightlist
\item
Select the \textbf{ForestryValidationAnnualChanges} module, choose the \emph{parameters} (Start and End year ; Percentage change ; Production Qty threshold) and click on \textbf{Run plugin};
\end{enumerate}
\begin{figure}
{\centering \includegraphics[width=1\linewidth]{images/annual_changes_parameters}
}
\caption{Select the ForestryValidationAnnualChanges plugin and run it}\label{fig:AnnualChangesPlugin}
\end{figure}
6. Wait for a window message to appear in the session;
\begin{figure}
{\centering \includegraphics[width=1\linewidth]{images/annual_changes_message}
}
\caption{ForestryValidationAnnualChanges module ran successfully}\label{fig:AnnualChangesPluginResults}
\end{figure}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{6}
\tightlist
\item
Get your results sent by email.
\textbackslash begin\{figure\}
\end{enumerate}
\{\centering \includegraphics[width=0.8\linewidth]{images/annual_changes_email_sent}
\}
\caption{Email sent to the user with results}
\label{fig:AnnualChangesPluginEmail}
\textbackslash end\{figure\}
\hypertarget{ForestryValidationNegativeConsump}{%
\chapter{\texorpdfstring{\textbf{The ForestryValidationNegativeConsump module}}{The ForestryValidationNegativeConsump module}}\label{ForestryValidationNegativeConsump}}
The module \textbf{ForestryValidationNegativeConsump} is part of the validation procedure before dissemination. As per its name, it carries data validation on the negative consumption, if any. It is up to the user decides the parameters to be used in this phase.
\begin{figure}
{\centering \includegraphics[width=0.85\linewidth]{images/ForestryValidationNegativeConsump}
}
\caption{Workflow of the ForestryValidationNegativeConsump module}\label{fig:ForestryValidationNegativeConsumpWorkflow}
\end{figure}
\hypertarget{steps-5}{%
\section{\texorpdfstring{\textbf{Steps}}{Steps}}\label{steps-5}}
The module can be basically split into four parts as below.
\hypertarget{read-in-data-1}{%
\subsection{Read in data}\label{read-in-data-1}}
The module reads data from \textbf{forestry\_prod\_trade\_agg} dataset and from the datatables listed in the figure \ref{fig:ForestryValidationNegativeConsumpWorkflow}.
\hypertarget{data-filtering-1}{%
\subsection{Data filtering}\label{data-filtering-1}}
After pulling the needed data, the module applies filters using the parameters chosen by the user accordingly. The module has two kinds of parameters:
\begin{itemize}
\item
time range (\emph{start} and \emph{end} year of the process) - \textbf{Start year} and \textbf{End year};
\item
negative consumption threshold - \textbf{Negative consumption threshold}. For instance, in this case if the user chooses \texttt{-1000}, the module will filter the time series that contain at least one data point with a \texttt{Consumption\ \textless{}=\ -1000}. For the sake of clarification, Consumption is definied as below:
\begin{itemize}
\tightlist
\item
\textbf{Consumption = Production + Imports - Exports}
\end{itemize}
\end{itemize}
\hypertarget{negative-consumption-check}{%
\subsection{Negative consumption check}\label{negative-consumption-check}}
At this stage, the module performs the \emph{Negative Consumption} check over the data by using the parameter chosen by the user.
\hypertarget{email-the-user-1}{%
\subsection{Email the user}\label{email-the-user-1}}
The final step of this module is to email the user with one \emph{.csv} file - negative consumption report.
\hypertarget{running-the-module-5}{%
\section{\texorpdfstring{\textbf{Running the module}}{Running the module}}\label{running-the-module-5}}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
Log in the SWS;
\item
Click on \textbf{New Query};
\item
Select \textbf{Forestry domain} and \textbf{forestry\_prod\_trade\_agg dataset};
\item
Select whatever geographicAreaM49, measuredElement, measuredItemForestry and timePointYears. After that, run the query;
\textbackslash begin\{figure\}
\end{enumerate}
\{\centering \includegraphics[width=1\linewidth]{images/forestry_prod_trade_agg_query}
\}
\caption{Steps 1 to 4}
\label{fig:queryNegConsump}
\textbackslash end\{figure\}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{4}
\tightlist
\item
Select the \textbf{ForestryValidationNegativeConsump} module, choose the \emph{parameters} (Start and End year ; Negative Consumption threshold) and click on \textbf{Run plugin};
\end{enumerate}
\begin{figure}
{\centering \includegraphics[width=1\linewidth]{images/negative_comsumption_parameters}
}
\caption{Select the ForestryValidationNegativeConsump plugin and run it}\label{fig:NegConsumpPlugin}
\end{figure}
6. Wait for a window message to appear in the session;
\begin{figure}
{\centering \includegraphics[width=1\linewidth]{images/negative_consump_message}
}
\caption{ForestryValidationNegativeConsump module ran successfully}\label{fig:negConsumpPluginResults}
\end{figure}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{6}
\tightlist
\item
Get your results sent by email.
\textbackslash begin\{figure\}
\end{enumerate}
\{\centering \includegraphics[width=0.8\linewidth]{images/negative_consump_email_sent}
\}
\caption{Email sent to the user with results}
\label{fig:NegConsumpPluginEmail}
\textbackslash end\{figure\}
\hypertarget{ForestryValidationUnitPrice}{%
\chapter{\texorpdfstring{\textbf{The ForestryValidationUnitPrice module}}{The ForestryValidationUnitPrice module}}\label{ForestryValidationUnitPrice}}
The module \textbf{ForestryValidationUnitPrice} pulls out records with significant abnormal high or low import/export unit price, given a threshold (\emph{quantity}) set by the user.
\begin{figure}
{\centering \includegraphics[width=1\linewidth]{images/ForestryValidationUnitPrice}
}
\caption{Workflow of the ForestryValidationUnitPrice module}\label{fig:ForestryValidationUnitPriceWorkflow}
\end{figure}
\hypertarget{steps-6}{%
\section{\texorpdfstring{\textbf{Steps}}{Steps}}\label{steps-6}}
The module can be basically split into four parts as below.
\hypertarget{read-in-data-2}{%
\subsection{Read in data}\label{read-in-data-2}}
The module reads data from \textbf{forestry\_prod\_trade\_agg} dataset and from the datatables listed in the figure \ref{fig:ForestryValidationUnitPriceWorkflow}.
\hypertarget{data-filtering-2}{%
\subsection{Data filtering}\label{data-filtering-2}}
After pulling the needed data, the module applies filters using the parameters chosen by the user accordingly. The module has two kinds of parameters:
\begin{itemize}
\tightlist
\item
time range (\emph{start} and \emph{end} year of the process) - \textbf{Start year} and \textbf{End year};
\item
trade quantity threshold (minimum trade quantity analysed) - \textbf{Export Qty threshold} and \textbf{Import Qty threshold}.
\end{itemize}
\hypertarget{unit-price-check}{%
\subsection{Unit Price check}\label{unit-price-check}}
At this stage, there are only the target data as the time range and trade quantity threshold were applied. Therefore, the module verifies if within the remaining data there is any item with a unit price beyond its limits. Please, see the datatable \protect\hyperlink{trade-outlier-tresholds}{Trade outlier tresholds} for more information on the limits by each item or go access it in the SWS.
\hypertarget{email-the-user-2}{%
\subsection{Email the user}\label{email-the-user-2}}
The final step of this module is to email the user with two \emph{.csv} files - unit price for imports and exports.
\hypertarget{running-the-module-6}{%
\section{\texorpdfstring{\textbf{Running the module}}{Running the module}}\label{running-the-module-6}}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
Log in the SWS;
\item
Click on \textbf{New Query};
\item
Select \textbf{Forestry domain} and \textbf{forestry\_prod\_trade\_agg dataset};
\item
Select whatever geographicAreaM49, measuredElement, measuredItemForestry and timePointYears. After that, run the query;
\textbackslash begin\{figure\}
\end{enumerate}
\{\centering \includegraphics[width=1\linewidth]{images/forestry_prod_trade_agg_query}
\}
\caption{Steps 1 to 4}
\label{fig:queryUnitPrice}
\textbackslash end\{figure\}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{4}
\tightlist
\item
Select the \textbf{ForestryValidationUnitPrice} module, choose the \emph{parameters} (Start and End year ; Imports and Exports Quantity thresholds) and click on \textbf{Run plugin};
\end{enumerate}
\begin{figure}
{\centering \includegraphics[width=1\linewidth]{images/forestry_select_plugin_unit_price}
}
\caption{Select the ForestryValidationUnitPrice plugin and run it}\label{fig:UnitPricePlugin}
\end{figure}
6. Wait for a window message to appear in the session;
\begin{figure}
{\centering \includegraphics[width=1\linewidth]{images/result_unit_price_plugin}
}