src.dackar.RCA.cmms_integration.maximo_cmms_adapter¶
maximo_cmms_adapter — MaximoCMMSAdapter skeleton.
Implements CMMSContextAdapter for IBM Maximo using the Maximo REST API (OSLC / JSON API). Plant teams fill in the connection details and any site-specific field mappings. See CMMS_INTEGRATION_GUIDE.md §4 for the full implementation guide.
- Dependencies (not installed by default — add to your environment):
pip install requests
Attributes¶
Classes¶
Live Maximo adapter — fetches CRs (Service Requests / Work Orders) |
Module Contents¶
- class src.dackar.RCA.cmms_integration.maximo_cmms_adapter.MaximoCMMSAdapter(base_url, api_key, site_id=None, cr_object_name='SR', wo_object_name='WOTRACK', floc_field='LOCATION', timeout=30)[source]¶
Live Maximo adapter — fetches CRs (Service Requests / Work Orders) via the Maximo REST API.
- Parameters:
base_url (str) – Maximo base URL, e.g.
"https://maximo.plant.corp/maximo".api_key (str) – Maximo API key or session token.
site_id (Optional[str]) – Maximo site identifier (e.g.
"PLANT1").cr_object_name (str) – Maximo object name for corrective actions (default
"SR").wo_object_name (str) – Maximo object name for work orders (default
"WOTRACK").floc_field (str) – Maximo field containing the Functional Location (default
"LOCATION"— override per plant convention, e.g."SITEID").timeout (int) – HTTP request timeout in seconds.
- abstractmethod fetch(primary_asset_id, sister_component_ids, lookback_from, lookback_to, event)[source]¶
Fetch CR and WO records from Maximo for the given asset and window.
TODO — plant teams implement: 1. Build OSLC WHERE clause: LOCATION in {primary_floc, sister_flocs}
AND REPORTDATE >= lookback_from AND REPORTDATE <= lookback_to
GET /maximo/oslc/os/{cr_object_name}?oslc.where=…
GET /maximo/oslc/os/{wo_object_name}?oslc.where=…
- Map Maximo field names to the cmms_context schema:
TICKETID → cr_id CLASS → cr_type STATUS → status (see _map_status) PRIORITY → priority DESCRIPTION → short_description LDTEXT → long_text LOCATION → functional_location REPORTDATE → created_date SITEID → (use to filter if multi-site)
Set is_sister_equipment=True for records whose LOCATION matches a sister FLOC, False for the primary asset.
Return {“cr_records”: […], “wo_records”: […]}
- _build_oslc_where(flocs, lookback_from, lookback_to)[source]¶
Build an OSLC WHERE clause string for Maximo. The functional-location field name is taken from
self.floc_fieldso overriding it (e.g. to"SITEID") actually changes the query.- Example output (with the default
floc_field="LOCATION"): LOCATION in [“PLANT/SYS/BEARING-01”,”PLANT/SYS/PUMP-02”] and REPORTDATE>=”2025-10-01T00:00:00+00:00” and REPORTDATE<=”2026-01-01T12:00:00+00:00”
- Parameters:
flocs (List[str])
lookback_from (str)
lookback_to (str)
- Return type:
str
- Example output (with the default