chemist-preprocessor-0.1.0.0: Chemist Raw Data Preprocessor
Safe HaskellSafe-Inferred
LanguageHaskell2010

Domain.Service

Description

Module providing asynchronous service functions for interacting with the Neo4j database. This module contains functions to retrieve, create, and delete reactions, as well as fetch health status and find paths between molecules.

The services use the withNeo4j wrapper to manage database connections and operations asynchronously, ensuring efficient execution of database queries without blocking the main thread. The functions also handle necessary conversions between raw database representations and application-specific data types.

Functions included:

Synopsis

Documentation

getPathAsync :: MoleculeID -> MoleculeID -> IO PathMask #

Asynchronously finds the shortest path between two molecules based on their MoleculeIDs. Fetches the path from the database and converts it to a PathMask.

Parameters:

Returns:

  • PathMask representing the shortest path between the two molecules.

getHealthAsync :: IO HealthCheck #

Asynchronously fetch the health status of the Neo4j database. Uses the withNeo4j wrapper to establish a connection and execute the health check query.

Returns:

  • HealthCheck containing the status information of the database.

getReactionAsync :: ReactionID -> IO (ReactionDetails, Maybe MechanismID) #

Asynchronously fetches the details of a reaction based on its unique ReactionID. Converts the raw reaction data retrieved from the database into ReactionDetails format.

Parameters:

  • ReactionID - the unique identifier of the reaction.

Returns:

getMechanismAsync :: MechanismID -> IO MechanismDetails #

Asynchronously fetches the details of a mechanism based on its MechanismID. Converts the raw mechanism data into MechanismDetails.

Parameters:

Returns:

postReactionAsync :: ReactionDetails -> IO Reaction #

Asynchronously creates a new reaction in the database. Converts the given ReactionDetails to raw details before calling the database function to store the reaction.

Parameters:

Returns:

  • Reaction - the created reaction with its unique ID.

deleteReactionAsync :: ReactionID -> IO ReactionID #

Asynchronously deletes a reaction from the database based on its ReactionID. Uses withNeo4j to execute the delete operation.

Parameters:

  • ReactionID - the unique identifier of the reaction to be deleted.

Returns: