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¶
Classes¶
Configuration for CAPExportSerializer. |
Module Contents¶
- src.dackar.RCA.cap_integration.cap_config._SUPPORTED_TARGETS = ('maximo', 'sap_pm', 'generic')[source]¶
- class src.dackar.RCA.cap_integration.cap_config.CAPExportConfig[source]¶
Configuration for CAPExportSerializer.
On construction the bundled
field_maps/{target_system}_default.json(orfield_map_pathwhen 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 raisesValueError.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 bundledfield_maps/{target_system}_default.jsonis 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".
- _load_field_map()[source]¶
Return
(field_map_data, field_map_source).field_map_datais the parsed JSON dict (empty when no file is found forgeneric);field_map_sourceis a provenance string with a content hash. An explicitly suppliedfield_map_paththat does not exist raisesFileNotFoundError.- Return type:
tuple
- 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
- 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 bundledfield_maps/{target_system}_default.jsonis used.**overrides – Additional keyword arguments passed to
CAPExportConfig(). May includeaction_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: