Niigata Journal of Health and Welfare
Online ISSN : 2435-8088
Print ISSN : 1346-8782
Brief Communications
Addition of simple input completion function to Fatsia
Hiroki InoueHachiro Uchiyama
Author information
JOURNAL FREE ACCESS FULL-TEXT HTML

2024 Volume 23 Issue 2 Pages 65-72

Details
Abstract

The purpose of study: A new code editing screen has been added to Fatsia, a software that supports Bayesian simulations on RStan, enabling users to create their own models. The purpose of this study is to examine the possibility and practicality of implementing the input completion function on this editing screen. Materials and Methods: Three specifications were defined for the input completion function: an autocomplete function, a snippet function, and a completion function for filenames and folder paths. The display timing of predictive candidate words was limited to simple cases. Results: An input completion function that displays a context menu on the new code editing screen of Fatsia was implemented and distributed. To assess its effectiveness, the number of keystrokes was compared between cases where the input completion function was used and cases where it was not, using sample text. The input completion function proved successful in reducing the amount of typing work required. Discussion: This study showed that limiting specifications enabled the construction of a simple input completion function for program source code in a relatively easy manner. The implementation of this input completion function led to reduced input time and fewer typing errors. Moreover, it is believed that the combination of this function with an existing template feature can enhance the overall utility of Fatsia. The performances of RStudio, IntelliSense in Visual Studio, and Fatsia were compared, and future improvements to Fatsia’s input completion function were considered.

Introduction

Fatsia [1], which was previously developed by the author of this paper and commenced its general distribution in 2021, is a support software designed to facilitate the simple execution of Bayesian model simulations using Rstan [2]. It provides several types of Bayesian models as templates.

Users can choose from the available templates, utilize their own prepared data files, and then follow the step-by-step instructions presented on the Fatsia interface to initiate the Markov Chain Monte Carlo (MCMC) method through RStan. This can be accomplished using intuitive mouse actions and minimal keystrokes.

Although Fatsia allows users to edit models based on templates, the general operation from template selection to model execution on RStan is one-way. This semi-automatic operation may limit the user’s degree of freedom in model construction.

Consequently, a new code editing screen was introduced in the Fatsia menu (Figure 1) that enables the reading and execution of user-prepared models. This includes Stan files and R files with any name, which can be created on Fatsia or other code editors. These files are saved to any file path other than the specified file path of Fatsia, and they allow Bayesian simulations to be executed without the need for templates. An overview of this screen is presented in Table 1.

Because the new screen does not include a template function, an input completion function was considered necessary to efficiently support editing work conducted by the user when repeating simulations.

The present study explains the development process of installing a simple input completion function by applying the context menu display to the additional code editing screen and discusses its feasibility and usefulness.

Materials and Methods

1. Construction procedure

This development involved reconstructing the Fatsia (previous version) with the incorporation of source code using Microsoft Visual Basic 2019. The modifications made to the program are as follows: In Microsoft Visualstudio 2019, “ContextMenuStrip” elements corresponding to each character were integrated, and for each newly added “ContextMenuStrip”, a “ToolStripMenuItem” was introduced to store candidate word data. These additions were performed manually.

Event handlers were also added to display each context menu and select candidate words based on mouse operations.

2. Specifications of input completion function

Specifications for the input completion function were formulated as follows, referring to the existing code editors, RStudio [3] and Visual Studio (IntelliSense) [4].

1) Autocomplete function

In the autocomplete function, when part of a word is typed, predictive candidate words are displayed to complete the input. Because Stan and R are programming languages, their vocabularies are limited compared to those of natural languages. Accordingly, we compiled a word dataset in advance. The display timing of the predictive candidate word is set so that the candidate word is displayed by inputting the first letter, which is the easiest to search.

2) Snippet function

The snippet function allows the user to pre-save a fragment of reusable code and retrieve it when needed. This function is incorporated because programming languages tend to involve repetitive use of certain terms in input, particularly in comparison to natural languages.

3) Function that completes filename and folder path

With RStan, when running a simulation on R with the Stan library installed, it is essential to include the filename and folder path of the data and Stan files in the R script. Therefore, the filename and folder path specified by the user on screens 2 and 3 are set so that they can be pasted on the R file edit screen (screen 4) with a simple graphical user interface operation.

3. Assessment of input completion function

The total number of keystrokes for using (A) and not using (B) as the input completion function was counted when typing actual Stan and R sample text on the keyboard. The comparison between the total number of keystrokes in scenarios A and B was conducted to evaluate the efficacy of the developed input completion function.

Results

1. After construction

The input completion function was implemented on the code editing screen added to Fatsia. The user interface appeared nearly identical to previous versions. Operation verification was conducted by meticulously comparing the PC display, word by word, with the word data set presented in Results 2 1) (1). Fatsia did not exhibit any operational delay even after adding the input completion function. The updated version of Fatsia is available for free download from the University Hospital Medical Information Network (UMIN: https://up-load.umin.ac.jp/fileshare/registrant.cgi).

2. Implementation

1) Autocomplete function

The context menu that appears when the first letter of a word (lowercase alphabet or symbol) is typed is used to suggest a predictive candidate word from the word dataset. If the candidate word is selected by a mouse click or Enter key, it is pasted to the editor screen as a return value.

(1) Creation of a word dataset

Word datasets for Stan and R were compiled as follows.

(i) Stan

For functions, a list of 630 alphabetical words was obtained from the end index of Stan Functions Reference Version 2.32 [5]. For non-functions, a list of 79 alphabetical words was compiled from sample code text in the main volume of the Stan Reference Manual Version 2.32 [6].

(ii) R

Based on Akiyama (2015) [7], a list of 56 alphabetical words required to run Stan in R was compiled.

(2) Timing of the predictive candidate proposal

The display timing of the context menu was set for the following cases:

(i) The last character of the string at the time of input is acquired, and a context menu created from the word dataset for each character is displayed (Figure 2).

(ii) A character is specified by the mouse cursor, and a context menu is displayed corresponding to that character (Figure 3).

(3) Correspondence to frequent candidate words displayed by each character input

Although the logic for displaying candidate words was simple, the frequent display of context menus for each character input can hinder input operations. Therefore, the following functions were implemented.

(i) Ability to toggle the autocomplete function on and off by pressing the Alt key. Alternatively, this function can be disabled by unchecking the “Autocomplete” checkbox at the top of the screen using the mouse (Figure 4).

(ii) The return value is the character string of the candidate word itself + one half-width space.

Furthermore, in cases where numerous words begin with the same letter during single-letter input, the vertical length of the displayed context menu for candidate words can increase substantially.

(iii) In such cases, the context menu is organized into two layers where words are grouped according to their beginning letters (Figure 5).

2) Snippet function

In this study, the last-used three words from the word dataset were automatically registered for reuse. It was possible to paste the word selected from a list in the context menu by right clicking the mouse at the location specified by the cursor (Figure 6).

3) Function that completes filename and folder path

On the R file editing screen (4 in Table 1), when the user specified a location with the mouse, the F1 key pasted the filename and folder path of the data file and the F2 key pasted the filename and folder path of the Stan file (Figure 7).

3. Assessment by comparing the number of keystrokes

When inputting Stan (Figure 8) and R (Figure 9) sample data, 83 keystrokes were used for configuration A (including 9 for the Alt key and 11 for the Shift key), and 154 keystrokes were used for configuration B (with 25 for the Shift key).

As shown in Figure 9, a noticeable disparity in keystrokes was evident when the input completion function was applied to the underlined filename and folder path. Without considering the underlined text, configuration A required 72 keystrokes (including four for the Alt key and 11 for the Shift key), whereas configuration B used 105 keystrokes (with 20 for the Shift key).

Therefore, the employment of the input completion function for both Stan and R sample text resulted in a significant reduction in typing effort, as frequent mouse selections could be employed.

Discussion

1. Feasibility and usefulness of implementing input completion function in Fastia

This study demonstrated that applying the context menu function of the programming language utilized in development facilitated the creation of a simple input completion function for program source code relatively easily, even in end-user development. Furthermore, a comparison of the number of keystrokes using sample text revealed that this implementation decreased user workload, suggesting a potential enhancement in the efficiency of simulation model building in Fatsia.

In this study, the assessment index used was the number of keystrokes, making it challenging to objectively quantify the potential reduction in input time and typing effort of the operator. Nevertheless, this input completion function facilitates mouse usage over keyboard input, resulting in a reduced keystroke count and potentially minimizing typing errors. This is anticipated to contribute to shorter input times and minimize the typing effort of a user. A reduction in the number of keystrokes is just one indicator. Feedback from actual users is sent to the corresponding author’s email address written on the Fatsia explanation screen “About Fatsia.” However, because the sample text was limited and the repetition of the same words was fairly low, only one opportunity to employ the snippet function was available within the sample text. Therefore, it was suggested that registering more than three words would be beneficial. These results indicate that enhancing the utility of Fatsia can be achieved by integrating the template’s user-friendly approach with the implementation of this system.

2. Comparison with previous software and future plans

RStudio [3], IntelliSense [4], as previously mentioned in Materials and Methods 2, and Fatsia were compared. IntelliSense was used as the standard for the input completion function owing to its wide usage. No particular operational difference was observed between Fatsia, RStudio, and IntelliSense in terms of the display, selection, and decision of lists of candidate words (↑ or ↓ + Enter key). It should be noted that Fatsia’s input completion function, as depicted in Figure 3, is novel and not available in the other two frameworks. However, as shown in Table 2, Fatsia had some features that were not yet implemented. These should be added in the future research on this topic.

Furthermore, we intend to make continuous improvements, such as extending the snippet function, responding to the appearance of new, unknown words that may occur owing to version upgrades and specification changes in R and Stan, and reflecting user feedback.

Acknowledgments

We would like to thank Editage (www.editage.jp) for English language editing.

Compliance with Ethical Standards

This study was conducted without involving humans or animals, and it did not incorporate any materials of human or animal origin, thereby eliminating ethical considerations. No conflicts of interest need to be disclosed concerning this paper.

References
 
© 2024 Niigata Society of Health and Welfare

This article is licensed under a Creative Commons [Attribution-NonCommercial-NoDerivatives 4.0 International] license.
https://creativecommons.org/licenses/by-nc-nd/4.0/
feedback
Top