Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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:
getPathAsync
- Finds the shortest path between two molecules.getHealthAsync
- Retrieves the health status of the Neo4j database.getReactionAsync
- Fetches details of a reaction by its identifier.getMechanismAsync
- Retrieves details of a mechanism by its identifier.postReactionAsync
- Creates a new reaction in the database.deleteReactionAsync
- Deletes a reaction from the database.
Synopsis
- getPathAsync :: MoleculeID -> MoleculeID -> IO PathMask
- getHealthAsync :: IO HealthCheck
- getReactionAsync :: ReactionID -> IO (ReactionDetails, Maybe MechanismID)
- getMechanismAsync :: MechanismID -> IO MechanismDetails
- postReactionAsync :: ReactionDetails -> IO Reaction
- deleteReactionAsync :: ReactionID -> IO ReactionID
Documentation
getPathAsync :: MoleculeID -> MoleculeID -> IO PathMask #
Asynchronously finds the shortest path between two molecules based on their MoleculeID
s.
Fetches the path from the database and converts it to a PathMask
.
Parameters:
MoleculeID
- the starting molecule's ID.MoleculeID
- the ending molecule's ID.
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:
- A tuple of
ReactionDetails
and an optionalMechanismID
, if a mechanism is associated.
getMechanismAsync :: MechanismID -> IO MechanismDetails #
Asynchronously fetches the details of a mechanism based on its MechanismID
.
Converts the raw mechanism data into MechanismDetails
.
Parameters:
MechanismID
- the unique identifier of the mechanism.
Returns:
MechanismDetails
representing the mechanism and its stages.
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:
ReactionDetails
- the details of the reaction to be created.
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:
ReactionID
of the deleted reaction.