mex.backend.rules package

Submodules

mex.backend.rules.helpers module

mex.backend.rules.helpers.create_and_get_rule_set(rule_set: AccessPlatformRuleSetRequest | ActivityRuleSetRequest | BibliographicResourceRuleSetRequest | ConsentRuleSetRequest | ContactPointRuleSetRequest | DistributionRuleSetRequest | OrganizationRuleSetRequest | OrganizationalUnitRuleSetRequest | PersonRuleSetRequest | PrimarySourceRuleSetRequest | ResourceRuleSetRequest | ResourceSeriesRuleSetRequest | VariableRuleSetRequest | VariableGroupRuleSetRequest, stable_target_id: Identifier | None = None) AccessPlatformRuleSetResponse | ActivityRuleSetResponse | BibliographicResourceRuleSetResponse | ConsentRuleSetResponse | ContactPointRuleSetResponse | DistributionRuleSetResponse | OrganizationRuleSetResponse | OrganizationalUnitRuleSetResponse | PersonRuleSetResponse | PrimarySourceRuleSetResponse | ResourceRuleSetResponse | ResourceSeriesRuleSetResponse | VariableRuleSetResponse | VariableGroupRuleSetResponse

Merge a rule set into the graph and read it back.

mex.backend.rules.helpers.delete_rule_set_from_graph(stable_target_id: Identifier) None

Delete a rule-set by stableTargetId from the graph.

mex.backend.rules.helpers.get_rule_set_from_graph(stable_target_id: Identifier) AccessPlatformRuleSetResponse | ActivityRuleSetResponse | BibliographicResourceRuleSetResponse | ConsentRuleSetResponse | ContactPointRuleSetResponse | DistributionRuleSetResponse | OrganizationRuleSetResponse | OrganizationalUnitRuleSetResponse | PersonRuleSetResponse | PrimarySourceRuleSetResponse | ResourceRuleSetResponse | ResourceSeriesRuleSetResponse | VariableRuleSetResponse | VariableGroupRuleSetResponse | None

Read a rule set from the graph.

mex.backend.rules.helpers.search_rule_items_in_graph(*, query_string: str | None = None, entity_type: Sequence[__annotationlib_name_1__] | None = None, reference_filters: Sequence[ReferenceFilter] | None = None, skip: int = 0, limit: int = 100) PaginatedItemsContainer[AdditiveAccessPlatform | AdditiveActivity | AdditiveBibliographicResource | AdditiveConsent | AdditiveContactPoint | AdditiveDistribution | AdditiveOrganization | AdditiveOrganizationalUnit | AdditivePerson | AdditivePrimarySource | AdditiveResource | AdditiveResourceSeries | AdditiveVariable | AdditiveVariableGroup | SubtractiveAccessPlatform | SubtractiveActivity | SubtractiveBibliographicResource | SubtractiveConsent | SubtractiveContactPoint | SubtractiveDistribution | SubtractiveOrganization | SubtractiveOrganizationalUnit | SubtractivePerson | SubtractivePrimarySource | SubtractiveResource | SubtractiveResourceSeries | SubtractiveVariable | SubtractiveVariableGroup | PreventiveAccessPlatform | PreventiveActivity | PreventiveBibliographicResource | PreventiveConsent | PreventiveContactPoint | PreventiveDistribution | PreventiveOrganization | PreventiveOrganizationalUnit | PreventivePerson | PreventivePrimarySource | PreventiveResource | PreventiveResourceSeries | PreventiveVariable | PreventiveVariableGroup | WorkflowAccessPlatform | WorkflowActivity | WorkflowBibliographicResource | WorkflowConsent | WorkflowContactPoint | WorkflowDistribution | WorkflowOrganization | WorkflowOrganizationalUnit | WorkflowPerson | WorkflowPrimarySource | WorkflowResource | WorkflowResourceSeries | WorkflowVariable | WorkflowVariableGroup]

Search for rule items in the graph.

Parameters:
  • query_string – Full text search query term

  • entity_type – Optional entity type filter

  • reference_filters – Optional reference field filters

  • skip – How many items to skip for pagination

  • limit – How many items to return at most

Raises:

InconsistentGraphError – When the graph response cannot be parsed

Returns:

Paginated list of rule items

mex.backend.rules.helpers.update_and_get_rule_set(rule_set: AccessPlatformRuleSetRequest | ActivityRuleSetRequest | BibliographicResourceRuleSetRequest | ConsentRuleSetRequest | ContactPointRuleSetRequest | DistributionRuleSetRequest | OrganizationRuleSetRequest | OrganizationalUnitRuleSetRequest | PersonRuleSetRequest | PrimarySourceRuleSetRequest | ResourceRuleSetRequest | ResourceSeriesRuleSetRequest | VariableRuleSetRequest | VariableGroupRuleSetRequest, stable_target_id: Identifier) AccessPlatformRuleSetResponse | ActivityRuleSetResponse | BibliographicResourceRuleSetResponse | ConsentRuleSetResponse | ContactPointRuleSetResponse | DistributionRuleSetResponse | OrganizationRuleSetResponse | OrganizationalUnitRuleSetResponse | PersonRuleSetResponse | PrimarySourceRuleSetResponse | ResourceRuleSetResponse | ResourceSeriesRuleSetResponse | VariableRuleSetResponse | VariableGroupRuleSetResponse

Merge a rule set into the graph and read it back.

mex.backend.rules.main module

mex.backend.rules.main.create_rule_set(rule_set: Annotated[AccessPlatformRuleSetRequest | ActivityRuleSetRequest | BibliographicResourceRuleSetRequest | ConsentRuleSetRequest | ContactPointRuleSetRequest | DistributionRuleSetRequest | OrganizationRuleSetRequest | OrganizationalUnitRuleSetRequest | PersonRuleSetRequest | PrimarySourceRuleSetRequest | ResourceRuleSetRequest | ResourceSeriesRuleSetRequest | VariableRuleSetRequest | VariableGroupRuleSetRequest, Body(PydanticUndefined)]) AccessPlatformRuleSetResponse | ActivityRuleSetResponse | BibliographicResourceRuleSetResponse | ConsentRuleSetResponse | ContactPointRuleSetResponse | DistributionRuleSetResponse | OrganizationRuleSetResponse | OrganizationalUnitRuleSetResponse | PersonRuleSetResponse | PrimarySourceRuleSetResponse | ResourceRuleSetResponse | ResourceSeriesRuleSetResponse | VariableRuleSetResponse | VariableGroupRuleSetResponse

Create a new rule set.

mex.backend.rules.main.delete_rule_set(stableTargetId: Annotated[Identifier, Path(PydanticUndefined)]) None

Delete a rule set by stableTargetId.

mex.backend.rules.main.get_rule_set(stableTargetId: Annotated[Identifier, Path(PydanticUndefined)]) AccessPlatformRuleSetResponse | ActivityRuleSetResponse | BibliographicResourceRuleSetResponse | ConsentRuleSetResponse | ContactPointRuleSetResponse | DistributionRuleSetResponse | OrganizationRuleSetResponse | OrganizationalUnitRuleSetResponse | PersonRuleSetResponse | PrimarySourceRuleSetResponse | ResourceRuleSetResponse | ResourceSeriesRuleSetResponse | VariableRuleSetResponse | VariableGroupRuleSetResponse

Get a rule set.

mex.backend.rules.main.search_rule_items(q: Annotated[str, Query(PydanticUndefined)] = '', entityType: Annotated[Sequence[RuleType], Query(PydanticUndefined)] = [], skip: Annotated[int, Query(PydanticUndefined)] = 0, limit: Annotated[int, Query(PydanticUndefined)] = 10) PaginatedItemsContainer[AdditiveAccessPlatform | AdditiveActivity | AdditiveBibliographicResource | AdditiveConsent | AdditiveContactPoint | AdditiveDistribution | AdditiveOrganization | AdditiveOrganizationalUnit | AdditivePerson | AdditivePrimarySource | AdditiveResource | AdditiveResourceSeries | AdditiveVariable | AdditiveVariableGroup | SubtractiveAccessPlatform | SubtractiveActivity | SubtractiveBibliographicResource | SubtractiveConsent | SubtractiveContactPoint | SubtractiveDistribution | SubtractiveOrganization | SubtractiveOrganizationalUnit | SubtractivePerson | SubtractivePrimarySource | SubtractiveResource | SubtractiveResourceSeries | SubtractiveVariable | SubtractiveVariableGroup | PreventiveAccessPlatform | PreventiveActivity | PreventiveBibliographicResource | PreventiveConsent | PreventiveContactPoint | PreventiveDistribution | PreventiveOrganization | PreventiveOrganizationalUnit | PreventivePerson | PreventivePrimarySource | PreventiveResource | PreventiveResourceSeries | PreventiveVariable | PreventiveVariableGroup | WorkflowAccessPlatform | WorkflowActivity | WorkflowBibliographicResource | WorkflowConsent | WorkflowContactPoint | WorkflowDistribution | WorkflowOrganization | WorkflowOrganizationalUnit | WorkflowPerson | WorkflowPrimarySource | WorkflowResource | WorkflowResourceSeries | WorkflowVariable | WorkflowVariableGroup]

Search for rule items using simple filters.

For complex queries combining multiple reference filters, use POST /rule-item/_search

mex.backend.rules.main.search_rule_items_advanced(q: Annotated[str, Body(PydanticUndefined)] = '', entityType: Annotated[Sequence[RuleType], Body(PydanticUndefined)] = [], referenceFilters: Annotated[Sequence[ReferenceFilter], Body(PydanticUndefined)] | None = None, skip: Annotated[int, Body(PydanticUndefined)] = 0, limit: Annotated[int, Body(PydanticUndefined)] = 10) PaginatedItemsContainer[AdditiveAccessPlatform | AdditiveActivity | AdditiveBibliographicResource | AdditiveConsent | AdditiveContactPoint | AdditiveDistribution | AdditiveOrganization | AdditiveOrganizationalUnit | AdditivePerson | AdditivePrimarySource | AdditiveResource | AdditiveResourceSeries | AdditiveVariable | AdditiveVariableGroup | SubtractiveAccessPlatform | SubtractiveActivity | SubtractiveBibliographicResource | SubtractiveConsent | SubtractiveContactPoint | SubtractiveDistribution | SubtractiveOrganization | SubtractiveOrganizationalUnit | SubtractivePerson | SubtractivePrimarySource | SubtractiveResource | SubtractiveResourceSeries | SubtractiveVariable | SubtractiveVariableGroup | PreventiveAccessPlatform | PreventiveActivity | PreventiveBibliographicResource | PreventiveConsent | PreventiveContactPoint | PreventiveDistribution | PreventiveOrganization | PreventiveOrganizationalUnit | PreventivePerson | PreventivePrimarySource | PreventiveResource | PreventiveResourceSeries | PreventiveVariable | PreventiveVariableGroup | WorkflowAccessPlatform | WorkflowActivity | WorkflowBibliographicResource | WorkflowConsent | WorkflowContactPoint | WorkflowDistribution | WorkflowOrganization | WorkflowOrganizationalUnit | WorkflowPerson | WorkflowPrimarySource | WorkflowResource | WorkflowResourceSeries | WorkflowVariable | WorkflowVariableGroup]

Search for rule items with advanced filter combinations.

Use this endpoint for: - Multiple reference filters combined with AND logic, e.g. hadPrimarySource AND

unitOf

mex.backend.rules.main.update_rule_set(stableTargetId: Annotated[Identifier, Path(PydanticUndefined)], rule_set: Annotated[AccessPlatformRuleSetRequest | ActivityRuleSetRequest | BibliographicResourceRuleSetRequest | ConsentRuleSetRequest | ContactPointRuleSetRequest | DistributionRuleSetRequest | OrganizationRuleSetRequest | OrganizationalUnitRuleSetRequest | PersonRuleSetRequest | PrimarySourceRuleSetRequest | ResourceRuleSetRequest | ResourceSeriesRuleSetRequest | VariableRuleSetRequest | VariableGroupRuleSetRequest, Body(PydanticUndefined)]) AccessPlatformRuleSetResponse | ActivityRuleSetResponse | BibliographicResourceRuleSetResponse | ConsentRuleSetResponse | ContactPointRuleSetResponse | DistributionRuleSetResponse | OrganizationRuleSetResponse | OrganizationalUnitRuleSetResponse | PersonRuleSetResponse | PrimarySourceRuleSetResponse | ResourceRuleSetResponse | ResourceSeriesRuleSetResponse | VariableRuleSetResponse | VariableGroupRuleSetResponse

Update an existing rule set.

mex.backend.rules.transform module

mex.backend.rules.transform.transform_raw_rule_set_to_rule_set_response(raw: dict[str, Any]) AccessPlatformRuleSetResponse | ActivityRuleSetResponse | BibliographicResourceRuleSetResponse | ConsentRuleSetResponse | ContactPointRuleSetResponse | DistributionRuleSetResponse | OrganizationRuleSetResponse | OrganizationalUnitRuleSetResponse | PersonRuleSetResponse | PrimarySourceRuleSetResponse | ResourceRuleSetResponse | ResourceSeriesRuleSetResponse | VariableRuleSetResponse | VariableGroupRuleSetResponse

Transform a rule-set-response shaped graph result into a rule set response.

Parameters:

raw – Mapping with one rule item per rule_set_field (or None when absent), as produced by the get_rule_set_response query

Returns:

Validated rule set response

mex.backend.rules.transform.transform_raw_rules_to_rule_set_response(raw_rules: Sequence[__annotationlib_name_1__]) AccessPlatformRuleSetResponse | ActivityRuleSetResponse | BibliographicResourceRuleSetResponse | ConsentRuleSetResponse | ContactPointRuleSetResponse | DistributionRuleSetResponse | OrganizationRuleSetResponse | OrganizationalUnitRuleSetResponse | PersonRuleSetResponse | PrimarySourceRuleSetResponse | ResourceRuleSetResponse | ResourceSeriesRuleSetResponse | VariableRuleSetResponse | VariableGroupRuleSetResponse

Transform a set of plain rules into a rule set response.

Module contents