Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.

lepoco/genius

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 

Genius

Genius is a microservice-based tool for building expert systems.
Application created for the defense of the thesis in the field of computer systems engineering in technology and environment.
Kazimierz Wielki University in Bydgoszcz, Poland

image

Words of introduction

Expert systems are an important aspect of creating a computer application with verified knowledge. Genius is supposed to be an application that, after introducing advanced knowledge of experts, allows other to use it.

Technological foundations

The use of microservices architecture allows us to create a system independent of the client application. Although the project presented here contains a sample web application based on React and ASP.NET Core, thanks to the use of gRPC and Protocol Buffers, we are able to offer almost any way to a client application, with the logic contained in the Genius microservice. The stateless architecture has been chosen, which means that multiple people can use the system at the same time without affecting each other.

Data

Data in the application is stored using SQLite. It is a fast and easy-to-configure database engine that does not require an additional server. However, with a large number of relations and if fuzzy logic will be introduced, the number of queries can be very large, then it's worth considering implementing a cache.

The database is not used directly. The structure was mapped to classes and objects using the ORM (object-relational mapping) mechanism. In the case of Genius, the Entity Framework Core was used.

The 'language' in which microservices communicate with each other is described in the Genius.Protocol project, which includes .proto files with instructions on how to generate classes and objects for gRPC.

Client application

The sample client application found in the Genius.Client project uses React to present interface elements and perform queries. The queries from frontend are sent to the client server, which makes queries using gRPC to the main microservice, which contains the logic and the data of expert systems.

The lack of security on the side of the main microservice assumes that the client microservice verifies the permissions to perform queries with the use of some form of authorization.

The logic of expert systems

Conditional

Currently, a conditional mechanism for solving expert systems is implemented. It's looking for answers as long as there are no other questions to ask.

image

The method of asking questions is as follows:

  1. Display the question
  2. User replies: Yes, No, or Don't know
  3. The system displays the next question or result

We assume that there may be many answers. Except for the responses themselves, we display the percentage of how many responses are the same as the result requirements.

Editing

Ease of use was to be the basis of the client application. So we add our expert system and then its results. Each result has a number of conditions that belong to it.

image

image

Getting started

To properly run Genius you need to have Visual Studio 2022 installed on your computer along with the web development tools and .NET 6. Besides, you should have Node and npm. Once downloaded and built, choose multiple startup projects - Genius and Genius.Client.

Then go to the page generated by the application.

image

Compilation

Use Visual Studio 2022 and invoke the .sln.

Visual Studio
Genius is an Open Source project. You are entitled to download and use the freely available Visual Studio Community Edition to build, run or develop for Genius. As per the Visual Studio Community Edition license, this applies regardless of whether you are an individual or a corporate user.

Data flow

sequenceDiagram
    participant Genius.Client
    participant Genius.Client.Controller
    participant Genius.OAuth [Optional]
    participant Genius
    Genius.Client->>Genius.Client.Controller: Request token
    activate Genius.Client.Controller
    Genius.Client.Controller->>Genius.OAuth [Optional]: Request token
    activate Genius.OAuth [Optional]
    Genius.OAuth [Optional]-->>Genius.Client.Controller: Respond with token
    deactivate Genius.OAuth [Optional]
    Genius.Client.Controller-->>Genius.Client: Respond with token
    deactivate Genius.Client.Controller
    Genius.Client->>Genius.Client.Controller: Frontend API Request
    activate Genius.Client.Controller
    Genius.Client.Controller->>Genius.Client.Controller: Data validation
    Genius.Client.Controller->>Genius.OAuth [Optional]: Request token validation
    activate Genius.OAuth [Optional]
    Genius.OAuth [Optional]-->>Genius.Client.Controller: Respond with token validation
    deactivate Genius.OAuth [Optional]
    Genius.Client.Controller->>Genius: gRPC API Request
    activate Genius
    Genius->>Genius: Data validation
    loop Selecting products
        Genius->>Genius: Finding matching products
    end
    loop Selecting conditions
        Genius->>Genius: Finding matching conditions
    end
    Note left of Genius: Validation and sorting occurs after the data is found
    Genius-->>Genius.Client.Controller: gRPC API Response
    deactivate Genius
    Genius.Client.Controller-->>Genius.Client: JSON data
    deactivate Genius.Client.Controller

Code of Conduct

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.

License

Genius is free and open source software licensed under GNU General Public License v3.0.

Permissions of this strong copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights.