src.dackar.RCA.cap_integration.cap_config

cap_config — CAPExportConfig dataclass.

Holds all field-mapping and target-system configuration for the CAP export serializer. The bundled field_maps/{target_system}_default.json file is the authoritative source for every mapping key (action_type_map, priority_map, record_endpoint, floc_property, short_description_max_chars, long_text_field); the module-level Python constants are used only as a fallback when a key (or the whole file) is missing. Individual keys can still be overridden per plant via constructor keyword arguments.

Attributes

_FIELD_MAPS_DIR

_SUPPORTED_TARGETS

_DEFAULT_ACTION_TYPE_MAP_MAXIMO

_DEFAULT_ACTION_TYPE_MAP_SAP

_DEFAULT_ACTION_TYPE_MAP_GENERIC

_DEFAULT_PRIORITY_MAP

_SHORT_DESC_LIMITS

Classes

CAPExportConfig

Configuration for CAPExportSerializer.

Module Contents

src.dackar.RCA.cap_integration.cap_config._FIELD_MAPS_DIR[source]
src.dackar.RCA.cap_integration.cap_config._SUPPORTED_TARGETS = ('maximo', 'sap_pm', 'generic')[source]
src.dackar.RCA.cap_integration.cap_config._DEFAULT_ACTION_TYPE_MAP_MAXIMO: Dict[str, str][source]
src.dackar.RCA.cap_integration.cap_config._DEFAULT_ACTION_TYPE_MAP_SAP: Dict[str, str][source]
src.dackar.RCA.cap_integration.cap_config._DEFAULT_ACTION_TYPE_MAP_GENERIC: Dict[str, str][source]
src.dackar.RCA.cap_integration.cap_config._DEFAULT_PRIORITY_MAP: Dict[str, str][source]
src.dackar.RCA.cap_integration.cap_config._SHORT_DESC_LIMITS: Dict[str, int][source]
class src.dackar.RCA.cap_integration.cap_config.CAPExportConfig[source]

Configuration for CAPExportSerializer.

On construction the bundled field_maps/{target_system}_default.json (or field_map_path when given) is parsed as the authoritative source for the mapping keys; any key absent from the JSON falls back to the module-level Python constant, and any value passed explicitly to the constructor overrides both.

Parameters:
  • target_system – "maximo" | "sap_pm" | "generic". Controls which field-map defaults are loaded and which system-specific extension block (maximo_ext / sap_ext) is populated. Any other value raises ValueError.

  • action_type_map – Overrides merged over the JSON/default map for target_system. Example: {"monitoring": "PM"} to treat monitoring actions as PM work orders in a plant with that convention.

  • priority_map – Overrides merged over the JSON/default {"critical": "1", ...} map.

  • default_work_group – Maximo: stamped on every CRRecord as maximo_ext.work_group.

  • default_plant_section – SAP PM: stamped on every CRRecord as sap_ext.plant_section.

  • default_planner_group – SAP PM: stamped on every CRRecord as sap_ext.planner_group.

  • long_text_header – Custom prefix prepended to the standard DACKAR long-text header. If None, only the standard header is emitted.

  • include_rca_run_id_in_description – If True (default), prepends "[RCA:{run_id}]" to the short description, creating a searchable token in the CMMS.

  • field_map_path – Path to a custom field-map JSON file. If None (default) the bundled field_maps/{target_system}_default.json is used.

  • record_endpoint

  • floc_property

  • short_description_max_chars

:param : :param long_text_field: Parsed from the field-map JSON when not passed explicitly. Exposed

for adapters (record_endpoint, long_text_field) and the serializer (floc_property, short_description_max_chars).

field_map_source[source]

Provenance string identifying the field-map source and a content hash, e.g. "field_maps/maximo_default.json#sha256:ab12cd34ef56".

target_system: str = 'maximo'[source]
action_type_map: Dict[str, str][source]
priority_map: Dict[str, str][source]
default_work_group: str | None = None[source]
default_plant_section: str | None = None[source]
default_planner_group: str | None = None[source]
long_text_header: str | None = None[source]
include_rca_run_id_in_description: bool = True[source]
field_map_path: pathlib.Path | None = None[source]
record_endpoint: str | None = None[source]
floc_property: str | None = None[source]
short_description_max_chars: int | None = None[source]
long_text_field: str | None = None[source]
field_map_source: str | None = None[source]
__post_init__()[source]
Return type:

None

_load_field_map()[source]

Return (field_map_data, field_map_source).

field_map_data is the parsed JSON dict (empty when no file is found for generic); field_map_source is a provenance string with a content hash. An explicitly supplied field_map_path that does not exist raises FileNotFoundError.

Return type:

tuple

_constant_action_type_map()[source]
Return type:

Dict[str, str]

resolved_action_type_map()[source]

Return the effective action_type map (constants < JSON < overrides).

Return type:

Dict[str, str]

resolved_priority_map()[source]

Return the effective priority map (constants < JSON < overrides).

Return type:

Dict[str, str]

short_description_limit()[source]

Return the character limit for the CMMS short description field.

Return type:

int

floc_kg_property()[source]

KG property name to read for location resolution.

Return type:

str

classmethod from_field_map_file(target_system, field_map_path=None, **overrides)[source]

Construct a config whose field-map source is a JSON file.

Parameters:
  • target_system (str) – "maximo" | "sap_pm" | "generic"

  • field_map_path (Optional[pathlib.Path]) – Path to a custom JSON file. If None, the bundled field_maps/{target_system}_default.json is used.

  • **overrides – Additional keyword arguments passed to CAPExportConfig(). May include action_type_map / priority_map (merged over the JSON) and any scalar field without collision, because the JSON is loaded in __post_init__ rather than through the constructor signature.

Return type:

CAPExportConfig