Dynamic Software Architecture Design for Virtual Rehabilitation System for Manual Motor Dexterity

—The architectural design is fundamental in the construction process of a virtual rehabilitation system since it allows to understand the components and their interaction, and it is a guide to develop the software. This article proposes a dynamic architecture design that could be used independently of software and hardware in a virtual rehabilitation system for motor dexterity. This proposal contributes to the software engineering area since it provides a starting point for the development of virtual rehabilitation systems. The system implementation was done with two tracking devices (hardware) and two rehabilitation games (software). It was validated with the User Experience Questionnaire (UEQ). Results show that the use of a dynamic architecture allowed to use different devices efficiently and quickly, regardless of the game, preventing the user from feeling a change or difficulty in carrying out the tasks.


INTRODUCTION
Software architecture as a subfield in engineering defines the structure, operation, properties and relationship between software elements [1,2].
Today the changing nature of technology has driven the customization and application of modern design techniques to meet the software requirements of emerging systems [2], one of them is Virtual Rehabilitation Systems (RhV) [3]. These types of systems have simplified the need for physical environments and have shown good results in the area of rehabilitation through repetition, sensory feedback, multisensory stimulation, and motivation [4].
Based on the literature review [5][6][7][8][9][10][11] it was seen that existing designs based on proposed software architectures for RhV systems are poorly described or difficult to maintain and evolve over time.
Even seeing that the recurring variation between the different proposals [5][6][7][8][9][10][11] is that its components, despite maintaining the same functional purpose, are continually added, eliminated, and replaced due to the characteristics of the patients, budgetary limitations, or the variety of options available that allow the development of these systems, such as Tech-MCS for remote control of therapy [12], CyberTouch or SaeboGlove applied to the rehabilitation of upper extremities [13,14], Leap motion, among others.
Giving a system the ability to adapt to these aspects that are already structural is a case of application of a Dynamic Architecture. A type of architecture where there is variation between the number of nodes and links that compose them topologically [15].
It is essential to encourage this type of architecture so that the systems evolve and adapt since there are various diseases that cause problems in motor dexterity such as epileptic encephalopathy, which presents abnormalities associated with progressive brain dysfunction and causes motor impairment due to epileptic activity generated by seizures [16]. Another example is Acquired Brain Injury (ACD) which produces physical, neurocognitive, and/or psychological deficiencies [17]. Its fundamental consequence is the loss of previously developed brain functions that involve the motor and sensory systems [18].
Other examples are autism, cerebral palsy, and stroke, among others. All these conditions cause motor difficulties in the daily life of those who suffer from them, becoming severely disabling on many occasions and requiring rehabilitation tasks. According to the World Health Organization (WHO) [19] 16% of the world's populationexperiences significant disability today.
The objective of the work was the design of a dynamic software architecture for virtual rehabilitation systems to improve manual motor dexterity. The implementation was validated with the development of a system that, based on the architecture, can dynamically exchange tracking devices. In this case, this validation was used with two low-cost tracking devices: Leap Motion and a prototype of a haptic glove.
This work emphasizes the use of low-cost devices to demonstrate their applicability from a budgetary point of view, considering that most of the explored systems use expensive and high-priced materials, causing them not to be accessible to the public, for this reason, it proposes the use of Leap Motion and which according to a previous study [20,21] has shown acceptance, accuracy, and effectiveness to capture specific movements for physical therapies.
The rest of the paper is organized as follow: Section II describes the background Section III presents the dynamic architecture proposal and the dynamic architecture applied in (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 14, No. 2, 2023 79 | P a g e www.ijacsa.thesai.org the virtual rehabilitation system, Section IV shows the results and discussion and, Section V describes the conclusions.

A. Related Works
The design of the architecture in virtual rehabilitation systems is a fundamental part of their creation, however, the literature does not show many related works that focus on this point. In Avola's work [11], a framework for the rapid prototyping of virtual rehabilitation systems is proposed. This proposal also includes a description of libraries to be used as well as information on software development such as avatars and stage design. Another proposal by Avola [22] shows a framework to develop low-cost serious 3D games, this system allows physiotherapists to create personalized rehabilitation exercises without special programming knowledge.
Regarding the design of dynamic software architectures, the work of Cuesta [23] informally elaborates a reflexive model of software architectural description with the scope to dynamic systems but does not go into depth in a practical aspect. Other works such as the ones done by León [5] and Ortiza [6] do not focus their proposal on architecture and show proposals for systems with isolated architectures in their case of application.

B. Software Architecture
The software architecture of a computer program or system is the structure or structures of the system, comprising software components, the externally visible properties of those components, and the relationships between them [24].
Software architecture is important for a wide variety of technical and non-technical reasons. Some of the reasons are: 1) An architecture will inhibit or enable quality attributes, 2) Decisions that are made in an architecture allow reasoning and managing changes as the system evolves, 3) The analysis of an architecture allows an early prediction of the qualities of a system 4) A documented architecture improves communication between interested parts. 5) Architecture defines a set of constraints on the subsequent implementation. 6) Architecture is the key artifact that allows the architect and project manager to reason about cost and schedule. 7) Architecture-based development focuses attention on component assembly, rather than simply creating it [24]. Architecturally significant requirements (ASR) are those requirements that have a significant impact on the architecture of a software system. They are a subcategory of general software requirements.

C. Dynamic Architecture
The objective of Software Architecture is to describe the structure of systems, and this should include both its static and changing -dynamic-parts. In fact, in many systems, the differential feature, which distinguishes it from other similar systems, is the dynamic behavior of its architecture; often, it can be even more important than the static schema of departure [15].
Systems have grown in diversity and complexity, which is why the need for dynamic architectures now arises. A dynamic architecture has as its main characteristic the addition, elimination, or replacement of components, sometimes even as part of normal operation, so structurally they must be taken into account during the design [23]. When the evolution of architecture is continuous, and the changes inside it follow a predefined pattern, then it must be considered that this pattern is an intrinsic part of the structure.

A. Dynamic Architecture Proposal
For the dynamic architecture proposal, the steps shown in Table I have been carried out.   TABLE I. DEVELOPMENT METHODOLOGY

Description Methodology
Step 1: Identification of system quality attribute requirements.
Step 2: Identification of architecturally significant requirements.
Step 3: Identification of architecture components.
Step 4: Classification of components: Identification of static and/or dynamic components.
Step 5: Design of architecture components.
Step 6: Documentation of architecture and validation of design decisions.
Step 7: Analysis and evaluation of software architecture.

B. Dynamic Software Architecture for Virtual Rehabilitation Systems
For architecture design, the steps described in Table I were considered.

1) Identification of system quality attribute requirements:
Virtual Reality (VR) technology applied to rehabilitation finds its foundation in the field of motor learning [25]. Virtual Reality attributes that align with the motor learning variables (VAM) defined by Levac & Sveistrup [26] are practice: enriched environment and motivation (Table II). These variables are related to software quality attributes for systems.

2) Identification
of architecturally significant requirements: The functional requirements that have been considered to develop the architecture are shown in Table III.

3) Identification of architecture components:
The approach is presented in four components that are described below a) Component a -data capture: This component seeks to integrate tracking devices to achieve the detection of rehabilitation movements. A sub-component to consider will be a calibration section, to alleviate lighting, latency, and proximity range issues.
b) Component b -controller: This component is the one that receives and stores information as established in the configurations of the rehabilitation sessions or movements. A subcomponent to consider will be a data reporter along with its respective connection to the database.

4) Classification of component -Identification of static and/or dynamic components:
Given that there are a variety of options for tracking devices on the market, as well as games or virtual environments, components A and D (Fig. 1) are proposed as dynamic so that, depending on the demographic, budgetary or patient conditions, they can be replaced. or complemented (added). On the other hand, components B and C (Fig. 1) are considered static since they must be the control axis of the system. 5) Design of architecture components: Fig. 1 shows the generic design of the architecture proposed together with the four identified components. An application instance of the proposed architecture for each of the components is detailed below. 81 | P a g e www.ijacsa.thesai.org a) Component a -data capture: In this step, two devices have been selected to capture data from the detection of rehabilitation movements: Leap Motion Controller and a Haptic Glove. A calibration section was also considered in this module, to alleviate lighting, latency, and proximity range issues.
Leap Motion Controller (LMC): It is an optical device without markers oriented to control gestural movement. It detects hand movements, fingers, and even objects around its range of vision. LCM can control different interfaces on any computer simply by executing hand movements without touching screens [21]. This device is small and cheap compared to others on the market. LMC dimensions are: 75 mm long, 25 mm wide, and 11 mm high. Its structure consists of two cameras that contain monochrome sensors sensitive to infrared light, whose function is to capture all images [27]. The coverage area (Fig. 2) of the Leap Motion device: it is a hemisphere with a radius of 61 cm, which depends on the viewing angle of the lenses of the two cameras, as well as the maximum intensity provided by the USB connection to the LEDs.
Haptic Glove: The device allows to perform movements in order to control an avatar. This glove uses a sensor that detects supination and pronation movements of the hand, as well as abduction and adduction movements of the wrist.

b) Component b -controller:
This component must maintain a direct relationship with the data generated in the tracking device and its representation in virtual environments. For this purpose UNITY was selected (Fig. 3) c) Component c -movement classifier: In this work the Dynamic Time Warping (DTW) algorithm is used for sequence recognition [28] to evaluate the degree of similarity of the movements with other previously recorded, given its compatibility with Leap Motion SDK. d) Component d -virtual scenario: Finally, in Component D, a rehabilitation environment was designed through a 2D game. Which focuses on controlling the execution of movements in the hands. This design was based on the International Classification of Functioning, Disability, and Health (ICF) [29] of the WHO and focused on exercises that make it possible to enhance the component of mobilityoriented activities to improve motor dexterity.
The specific activities to be implemented, according to the ICF classification, refer to subclassification d4453: "Turn or twist hands or arms" and subclassification d4400: Pick up: "lift or take a small object with hands and fingers, as when picking up a pencil. These exercises were proposed by two physical therapy specialists and a pediatric neurologist. The implemented gestures were extension, flexion, supination, and pronation, and the combination of them to achieve displacement and jumps. The tracking device (Leap Motion or Haptic Glove) allows to control the game avatar.
The objective of the game is to mobilize an avatar through a road which must avoid a certain number of obstacles through jumps until reaching a destination. Every time it avoids an obstacle it will receive points and/or prizes depending on the difficulty, and every time it misses it loses one point.
The game has three difficulty levels which refer to the proximity of the obstacles and the reaction time of the patient to jump. Fig. 4 shows avatar control using Leap Motion and Fig. 5 shows avatar control with the haptic glove. Fig. 6 shows the running game environment. Since many types of patients can be trained in motor rehabilitation sessions, the system must be adapted to the different needs of each patient.

6) Documentation of architecture and validation of design decisions:
As a result of the application of the architecture, the specific implementation of the architecture is shown in Fig. 7. The validation of design decisions is very complex and generally depends on the context. For validation, there are qualitative techniques such as scenarios, questionnaires, or checklists and quantitative techniques with metrics, simulations, mathematical models, prototypes, or experiments [30].
It was determined to validate the design by a quantitative technique performing a simulation of rehabilitation, experimentation, and a specific analysis because of the changing nature of the system. This point is described in detail in step 7.

7)
Analysis and evaluation of software architecture: For the evaluation, a comparative analysis of the user experience (UX) was used, considering the implementation with the LeapMotion optical tracking device and the implementation with the haptic glove. The instrument was the validated User Experience Questionnaire (UEQ) [31]. Fig. 7.
Game in execution, shows the control of time to achieve the goal by avoiding the obstacles. points and reward system is managed UEQ comprehensively measures six dimensions: (a) Attractive: the product must look attractive, pleasant, and friendly; (b) Efficiency: the user must perform tasks with the product quickly, efficiently, and pragmatically; (c) Perspicuity: the product must be easy to understand, clear, simple and easy to use; (d) Reliability: the interaction with the product must be predictable, safe and meet the expectations; (e) Stimulation: the use of the product must be interesting, exciting and motivating; (f) Novelty: the product must be innovative, inventive and creatively designed [32].
UEQ consists of 26 questions and applies a seven-point Likert scale. The questionnaire is shown in Fig. 8.
The population size was university students from a public university. The sample was non-probabilistic for convenience. There were participants from schools of Medicine, Psychology, Engineering, and Natural Sciences of Education and Accounting. The age range was between 18 and 22 years old, there were 50 men and 56 women with a total of 106 participants. Fig. 8.
UEQ questionnarie www.ijacsa.thesai.org During the evaluation, each participant receives an explanation of the use of the system. Then each participant used the system with their dominant hand. Each participant had a 20-minute interaction with the system, 10 minutes with the Leap Motion device, and 10 minutes with the haptic glove.

IV. RESULTS AND DISCUSSION
A. Results Table IV shows the results for the use of the Leap Motion Controller device. Values between -0.8 and 0.8 represent a more or less neutral evaluation of the corresponding scale, values > 0.8 represent a positive evaluation, and values < -0.8 represent a negative evaluation. The range of the scales is between -3 (terribly bad) and +3 (extremely good) [33].
As shown in Table IV and Fig. 9, all the values are positive for the use of Leap Motion, with Perspicuity being the highest value, followed by the attractiveness value. For our study and the evaluation of the architecture, the most relevant values are related to the efficiency and reliability scales. These values are positive according to the scale but could be improved. Table V

B. Discussion
According to our User Experience results, the proposed software architecture gave the system through the nonfunctional requirements of efficiency and reliability enough dynamism so that users not only use different tracking devices for virtual rehabilitation but also in regarding the ease of use, the preliminary users did not feel a change in terms of performing the tasks with the device. Added to this is the fact of performance, since none of the participants reported discomfort and all described the system as a tool support for active participation during the rehabilitation process.
This work provides a contribution by focusing on the architectural aspect of this type of system, since unlike other works where solutions to mobility and rehabilitation problems are proposed, this area is not deepened, leaving said design proposals in isolated environments, traditional and poorly approaches documented.
In works such as [6][7][8], architectures such as session management and feedback modules are proposed to provide information to therapists or doctors and patients respectively. It is considered that the administrative aspect is not the focus of this proposal but it can be implemented through the integration of the UI and database controller subcomponents. In addition, it will be up to the developer to decide how to complement each exposed component according to its context and rehabilitation tools.
This work does not cover the communication complexities as it works [7] that are usually manifested in customized constructions of tracking devices, where serial or wireless bridge models are used, this prototype uses one of these devices, however, these problems are solved by moment of implementation with the use of external libraries with support for Unity. www.ijacsa.thesai.org It is emphasized that in all cases it is mentioned that the interfaces must be designed with the aim of guiding a high usability which is an aspect that is dealt with in this work.
The architecture prototype was validated with low-cost devices, which demonstrates its versatility so that it can be implemented for systems that have been shown and seek effectiveness [34] to function in any clinical or home environment. This aspect is also reinforced by showing that the devices can be selected from a broader universe that can provide a variety of alternatives regarding costs or patient comfort to treat much less invasive or intrusive devices [35] and adapt to their needs.
This work also proposes to make the rehabilitation environment or game dynamic, in the prototype it was implemented with a single option to make it similar to traditional systems and guide user tests in a single line, however it is recommended to expand the application in groups separated from users, of more varied ages and longer usage times, since such dynamism is easier to achieve once the tracking device is integrated. For future lines of research, it may also be advisable to increase the sample size and include a control group to check the effectiveness of the system with users with manual motor problems. Our results provide evidence of the application of the architecture in previous environments with healthy users.

V. CONCLUSION
This work showed the design of a dynamic software architecture for low-cost virtual rehabilitation systems for the improvement of manual motor dexterity. The development had the constant advice of medical specialists in physical therapy who identified the exercises to be performed: pronation/supination and flexion/extension for the application instance. The proposed architecture has two static components for the administrative control of the system and two dynamic components to integrate gaming environments and tracking devices. This type of architecture is proposed to delve into this type of system and adapt to the various diseases that cause problems in motor dexterity.
The proposed architecture shows the feasibility through its application instance of reusing and integrating the various tracking devices as well as the different game interfaces that have been proposed in the literature in this gap.
The development considered the required attributes of virtual rehabilitation systems for therapies. With respect to other immersive-type systems, Leap Motion has the advantage that it does not cause discomfort in terms of dizziness and/or nausea, in addition to its characteristics that there is no physical contact with the skin, which is an advantage when patients are children.
The limitations of the study are given by the time of use of each device. As future work, it is intended to implement the suggestions received by the participants, and to carry out the validation of the architecture with other data capture devices and games.