Cyphon

Cyphon in Fixange

Cyphon is a search engine to search for the loan details using the user input queries. we can have search on the basis of loanID’s , workflowID’s and much more. currently the below functionality only uses one sources (i.e mongodb collection ) . Broader goal is to help you to get all insights in one place.\n\nmentioned below are the core component which are used to function cyphon properly .

Note - its not completed , we have to correct the code in the LoanSearch.ts to make it work. mostly it is not able to fetch loans specific to query from db . you can experiment with LoanSearch.ts file and see how it works.

LoanSearch.ts

dir - app/server/modules/fixange/src

LoanSearch.ts enables querying loan data asynchronously. It is designed to handle multiple queries in parallel using async generators, improving efficiency and scalability. The service consists of three main components

  1. LoanSearch.
  2. LoanService.
  3. LoanDatabase.

LoanSearch Class

The LoanSearch class extends BaseSearch to process loan search queries and yield results asynchronously.

  1. Methods

    1. getCapabilities() : Returns the capabilities of the loan search service.

      \

    2. search(request: SearchRequest): AsyncGenerator<SearchCard, void, unknown> : Processes loan search queries using async generators for efficiency.

      1. \
    3. processLoanQuery(query: any, owner: Owner, index: number): Promise<SearchCard | null> : Processes individual queries for loans and formats the results.

LoanService Class

The LoanService class interacts with the LoanDatabase to fetch loan data.

  1. Methods

    1. fetchLoans(options :{ ids:string[],owner:Owner}): AsyncGenrator<any[],void,unknown> : Fetches loan data asynchronously in chunks.

LoanDatabase Class

The LoanDatabase class extends Collection and provides methods to interact with the loan database.

  1. Methods

    1. Searches the database for loans matching the query.

      \

Cyphon.export.ts

dir - app/server/modules/fixange/cyphone.export.ts

The LoanRouter Class is designed to handle loan search requests by interacting with the LoanSearch Class. It uses the searchManager to process queries and fetch search results. This service supports asynchronous processing and integrates with MongoDB for data storage.

add cyphon service inside the package.json of respective module.

The LoanRouter class manages loan search operations and provides methods to initialize the system and handle pre-processing tasks.

  1. Methods

    1. async initialize() : Initializes the Loan Search service and connects to the default MongoDB database.

    2. async pre(method: string, message: Message) : Pre-processes requests before executing methods.

    3. async search(message: Message) : Contains the search request details.

      \

  2. Workflow

    Connects to the database and sets up dependencies. Processes search queries and generates a job ID. Fetches job results asynchronously and returns them.

    \

Cyphon.ts

dir - app/ui/modules/quick-ui/src/api/Cyphon.ts

Provides an API interface for Cyphon-related functionalities using the XUI-Core API Provider. using async search method , executes the search operations .

LoanSearchCard.vue

This component displays a card containing loan details

dir - app/ui/modules/quick-ui/src/cards/LoanSearchCard

it uses following props

  • title (Object,required) - title of the card
  • loanDetails (Object, required): The loan details object to be displayed.
  • excludes
  • formatters(Object)
  • query (String,required)

Cyphon.vue

The CyphonPage component serves as the main interface for the Cyphon application. It integrates a search bar and dynamically renders search results based on user input.

Dir - app/ui/modules/quick-ui/src/vue/cyphon/Cyphon.vue

Components

  1. SearchBar - Allows users to input queries for search.
  2. SearchResults-Displays search results for the provided keyword.

\

SearchBar.vue

The SearchBar component is a Vue.js-based search input bar designed for querying and filtering information across various categories. It supports dynamic placeholder text rotation, a help modal for quick assistance, and used with the UniForm, UniFormInput, UniButton, UniIcon, and UniModal components.

dir - app/ui/modules/quick-ui/src/vue/cyphon/SearchBar.vue

Main sections

  1. SearchBox : Input field for text search.
  2. Help Text : Clickable text to toggle the help modal.

Props

  1. searchExamples : Array of example search queries for help suggestions.
  2. PlaceHolderTickerInterval : Time interval (in milliseconds) for rotating placeholder text.
  3. PlaceHolderTexts : List of placeholder texts displayed in rotation.
  4. SearchText : Pre-filled text in the search box.
  5. searchInProgress : Controls the visibility of the loading spinner icon.

Methods

  1. Submit(): Trigger an input event with the search query.
  2. startPlaceholderTicker() : Starts a timer to cycle through the list of placeholder texts at specified intervals.
  3. toggleHelp() : Toggles the visibility of the help modal.

SearchResults.vue

The SearchResults component displays search results based on the provided keyword input. It dynamically fetches data, updates results at regular intervals, and provides loaders, empty states, and support for custom messages.

dir - app/ui/modules/quick-ui/src/vue/cyphon/SearchResults.vue

Props

  1. keywords : The search query input provided to fetch the results.
  2. resultRefreshInterval : Time interval (in milliseconds) for refreshing results until completion.
  3. noResultMessages : Messages to display when no results are found.
  4. resultCol : Number of columns for displaying results.
  5. showResultMessage : Toggles the display of the results summary message.
  6. showResults : controls the visibility of the result container.
  7. searchResponseClass :

Methods

  1. handleActions : Emits an event when an action is performed on a search result.
  2. startResultLoader : Initializes the result loader and periodically refreshes search results until completion.
  3. stopResultLoader : Stops the result loader by clearing the interval timer.
  4. loadResults : Fetches search results using the cyphonAPI.search() method and updates the state.