reports, jumping from the report file to the input file. The links have to have a specific structure,
and if SP recognizes a link click with such form, it uses them to redirect users to a particular line in
the input file.
Lastly, the HTML file is produced as a single, dependency-free file in the output folder along with the
text results file. This file can then be easily shared, creating a straightforward channel for transmitting
the computation results in formatted and interactive ways.
Section 3 Implementation details
The report was implemented using JavaScript, namely React.js. As one of the objectives was to
compile all source codes into one file to make it easily shareable, another used framework was Webpack
with a custom configuration to produce a standalone offline-working .html file. The implementation
comprised about 3,500 lines of code, which was directly caused by the complexity of the data processed
before rendering the report. The structure of the .json file can be seen in Fig. 2. This structure is very
nested and follows the inner data structure of LGC, not the format needed for front-end rendering,
and thus needs to be heavily processed to obtain all the data required for rendering the front end from
all around the file. This processing is done only once upon opening the file. To prevent recomputing
and secure reasonable performance even for big files (cca. ten thousand observations), all of this
processing and other smaller computations use useMemo() function to cache the results and prevent
recomputing on each re-render.
For the sake of the maintainability of the code, all the paths to the data from the .json file used in
the front end are specified in a single file so that future maintainers don’t have to search for the way
of obtaining data from .json if the file structure changes. It just suffices to change the path. The
path syntax is similar to web paths, e.g.
measECHO/ i / d i s t a n c e s R e s i d u a l s /0/ fV alue ,
returning distance residual of ECHO measurement type, where the subparts are keys in nested dictio-
naries. However, not all of the displayed values can be found directly in the .json file, and in keeping
with the theme described above, I introduced a notation for calculating directly from paths using
exclamation marks, as can be seen in this snippet (three dots standing for missing parts of code):
e x p o rt c ons t generateDVERObsCols = ( ) => {
r e t u r n {
. . .
TGTLINE : f i e l d G e n ( . . . { path : " l k p : t a r g etP o s " } ) ,
CALC : . . . path : " ! d i s t a n c e s /0/ f V al u e !+! r e s i d u a l s /0/ f V alu e ! " . . .
} ;
} ;
The CALC value was computed by adding values from two paths. The snippet also illustrates another
feature: taking the link position from the precomputed lookup (lkp) table, where the key is the value
in the path. This feature is introduced since the lookup information is at a very different location than
the rest of the data when processing the current observation. It thus would create big textual and
performance overhead to use a normal path. The exclamation computation approach also supports
mathematical operations such as sqrt() or abs(). An example of full-column data definition can be
found in Fig. 3.
The source code for the tool implementation can be found here. It follows the classical React.js file
structure, as shown in Fig. 4.
2