Exposed modeling functions
A useful subset of modeling functions have been exposed. To access them, import via
from valsys.modeling.service import tag_model
.
The exposed functions are listed out below.
If a number of imports are expected to be used, in order to not explode the number of imports, it may be useful to import and alias the entire modeling service via
Model operations
Model pulling
Pull a model by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
the ID of the required model. |
required |
Returns:
Type | Description |
---|---|
Model
|
The |
Source code in valsys/modeling/service.py
Model tagging
Tag the model with model_id
with the list of tags
.
Note that this removes any existing tags;
if you wanted to append tags, use the append_tags
function.
update: turns on dynamic updates
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
ID of the model to add tags to |
required |
tags |
List[str]
|
List of tags to add to the model |
required |
auth_token |
str
|
Optional authentication token |
None
|
Source code in valsys/modeling/service.py
Model sharing
Share model to another user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
ID of the model to share |
required |
email |
str
|
The email address of the user to share the model with |
required |
permission |
str
|
The permissions to give to the user |
required |
Source code in valsys/modeling/service.py
The model is shared to the user with specified permissions; the allowed values are
permission
=view
permission
=edit
permission
=fullAccess
Any other permission value will result in a NotImplementedError
exception being thrown.
The allowed permissions and the correct strings can be found via
Permissions.VIEW
could be provided to the share_model
function call.
If you attempt to share the model with a user that dosent exist, a ShareModelException
will be thrown.
Model deleting
Delete the specified models
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_ids |
List[str]
|
List of model IDs to be deleted. |
required |
Source code in valsys/modeling/service.py
Model searching/filtering
Search for a set of models, using the provided set of filters for the using user
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_on |
List[str]
|
List of strings of properties to filter on; allowed: |
None
|
filter_term |
str
|
Will match according the props in the |
''
|
model_type |
str
|
Options are |
'user'
|
max_date |
str
|
Maximum creation date of the model (required format: YYYY-MM-DDTHH:MM:DD.SSSZ) |
tomorrow()
|
min_date |
str
|
Minimum creation date of the model (required format: YYYY-MM-DDTHH:MM:DD.SSSZ) |
'2002-01-01T00:00:00.000Z'
|
geo_filters |
List[str]
|
The geographies to include in the search |
None
|
ind_filters |
List[str]
|
The industries to include in the search |
None
|
tags |
List[str]
|
List of tags to filter on |
None
|
tag_filter_type |
str
|
How to combine the tags to search over; options are |
''
|
pagination |
int
|
Page number of results |
1
|
fields |
List[str]
|
Fields to return per model |
None
|
Returns:
Type | Description |
---|---|
List[ModelDetailInformationWithFields]
|
List of matching model information objects. |
Source code in valsys/modeling/service.py
Get model information
Pulls the model information for the model_id
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
the ID of the required model. |
required |
Returns:
Type | Description |
---|---|
ModelInformation
|
The |
Source code in valsys/modeling/service.py
This function returns a ModelInformation
object, whose structure is
CaseInformation
object has the structure
Get model case
Retreive a Case
by its uid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
case_id |
str
|
the case's UID |
required |
Returns:
Type | Description |
---|---|
Case
|
The appropriate |
Source code in valsys/modeling/service.py
Recalculate model
Recalculates the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
The ID of the model to be recalculated. |
required |
Returns:
Type | Description |
---|---|
List[Fact]
|
List of Facts updated during the recalculation process. |
Source code in valsys/modeling/service.py
Dynamic updates
Module operations
Add child module
Add a new module to the parent module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent_module_id |
str
|
The moduleID of the parent |
required |
name |
str
|
The name of the new module |
required |
model_id |
str
|
The ID of the model into which the module is to be inserted |
required |
case_id |
str
|
The caseID of the module. |
required |
Returns:
Type | Description |
---|---|
Module
|
The newly constructed |
Source code in valsys/modeling/service.py
Delete module
Removes the specified module from the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
The ID of the model. |
required |
module_id |
str
|
The ID of the module to be removed. |
required |
Source code in valsys/modeling/service.py
Rename module
Rename the module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
the ID of the model |
required |
module_id |
str
|
the ID of the module to be renamed |
required |
new_module_name |
str
|
the new name of the module. |
required |
Returns:
Type | Description |
---|---|
Module
|
The new renamed module object. |
Source code in valsys/modeling/service.py
Line item operations
Add line item
Add a line item to an existing module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
case_id |
str
|
The caseID of the model |
required |
model_id |
str
|
The modelID |
required |
module_id |
str
|
The ID of the module for the new line item |
required |
name |
str
|
Name of the line item |
required |
order |
int
|
Order of the line item in the module |
required |
Returns:
Type | Description |
---|---|
LineItem
|
The newly created |
Source code in valsys/modeling/service.py
Delete line item
Delete a line item from an existing module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
The modelID |
required |
module_id |
str
|
The ID of the module containing the line item |
required |
line_item_id |
str
|
The ID of the line item to be deleted. |
required |
Returns:
Type | Description |
---|---|
Module
|
The |
Source code in valsys/modeling/service.py
Tag a line item
Tag a line item.
Note that this replaces any existing tags on the line item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
The ID of the model containing the line item |
required |
line_item_id |
str
|
The ID of the line item |
required |
tags |
List[str]
|
The tags to give to the line item |
required |
Returns:
Type | Description |
---|---|
LineItem
|
LineItem from the backend, containing updated tags. |
Source code in valsys/modeling/service.py
Edit line items
Edit line items
The passed in line items will be used to update the line items.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
the ID of the model containing the line items |
required |
line_items |
List[LineItem]
|
List of |
required |
Source code in valsys/modeling/service.py
Fact operations
Edit formula
Edit the formula on the supplied facts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
case_id |
str
|
The caseID for where the facts live. |
required |
model_id |
str
|
The modelID for where the facts live. |
required |
facts |
List[Fact]
|
The list of facts whose formulae are to be edited. |
required |
Returns:
Type | Description |
---|---|
List[Fact]
|
List of |
Source code in valsys/modeling/service.py
Model groups
Get model groups
Pulls model groups.
Returns a list of ModelGroup
objects under the groups
attribute.
Each ModelGroup
has a uid
, name
, user_id
, model_ids
Returns:
Type | Description |
---|---|
ModelGroups
|
ModelGroups |
Source code in valsys/modeling/service.py
Add new model group
Add a new model group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group_name |
str
|
The name of the new model group |
required |
model_ids |
List[str]
|
The IDs of the models to go into the group |
required |
Returns:
Type | Description |
---|---|
ModelGroups
|
ModelGroups |
Source code in valsys/modeling/service.py
Update model groups
Updates the models groups.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid |
str
|
The UID of the model |
required |
name |
str
|
The name of the model group |
required |
model_ids |
List[str]
|
The IDs |
required |
Returns:
Type | Description |
---|---|
ModelGroups
|
ModelGroups |