Class: BayesianNetworksService
Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/bayesian-networks.service.ts:15
Service for Bayesian Network nested models. Supports listing, single retrieval, creation and label updates.
Constructors
Constructor
new BayesianNetworksService(
bayesianNetworkModel,nestedModelService,nestedModelHelperService):BayesianNetworksService
Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/bayesian-networks.service.ts:22
Construct the service with persistence and helper dependencies.
Parameters
bayesianNetworkModel
Model<BayesianNetworkDocument>
Mongoose model for BayesianNetwork collection
nestedModelService
Service to allocate IDs and shared nested model ops
nestedModelHelperService
Helper to link/unlink nested models to typed models
Returns
BayesianNetworksService
Methods
createBayesianNetwork()
createBayesianNetwork(
body,typedModel):Promise<NestedModel>
Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/bayesian-networks.service.ts:72
creates the type of nested model defined in the function name
Parameters
body
Partial<NestedModel>
a nested model, that needs to contain its parent id (easier to grab on frontend with getCurrentModel) and a label object with a name string and optional description string
typedModel
is the typed model to be updated
Returns
Promise<NestedModel>
a promise with a nested model in it, which contains the basic data all the nested models have
deleteBayesianNetwork()
deleteBayesianNetwork(
modelId,typedModel):Promise<void>
Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/bayesian-networks.service.ts:104
finds and deletes the nested model in this collection with the give model id
Parameters
modelId
string
the id of the model we want to delete
typedModel
is the typed model that this nested model belongs to
Returns
Promise<void>
a promise with the deleted model
getBayesianNetwork()
getBayesianNetwork(
parentId):Promise<BayesianNetwork[]>
Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/bayesian-networks.service.ts:34
gets the collection of the nested model as defined by the function name (bayesian estimations, etc.)
Parameters
parentId
number
id of the parent model the nested model is number
Returns
Promise<BayesianNetwork[]>
a promise with an array of the nested model of the type in the function name
getBayesianNetworkString()
getBayesianNetworkString(
parentId):Promise<BayesianNetwork[]>
Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/bayesian-networks.service.ts:43
Retrieves Bayesian Networks by parent id (string form).
Parameters
parentId
string
Parent identifier as a string (ObjectId)
Returns
Promise<BayesianNetwork[]>
Array of Bayesian Network documents for the given parent
getSingleBayesianNetwork()
getSingleBayesianNetwork(
modelId):Promise<BayesianNetwork>
Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/bayesian-networks.service.ts:52
gets a single model from the collection based on the id
Parameters
modelId
number
the id of the model to be retrieved
Returns
Promise<BayesianNetwork>
the model which has the associated id
getSingleBayesianNetworkString()
getSingleBayesianNetworkString(
modelId):Promise<BayesianNetwork>
Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/bayesian-networks.service.ts:61
Retrieves a single Bayesian Network by string id.
Parameters
modelId
string
Document _id as a string (ObjectId)
Returns
Promise<BayesianNetwork>
The matching Bayesian Network document
updateBayesianNetworkLabel()
updateBayesianNetworkLabel(
id,body):Promise<NestedModel>
Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/bayesian-networks.service.ts:94
updates the label in the nested model
Parameters
id
string
the id of the nested model to be updated
body
a label with a name and description
Returns
Promise<NestedModel>
a promise with the updated model with an updated label
