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

logger

JsonDict

Classes

MaximoCMMSAdapter

Live Maximo adapter — fetches CRs (Service Requests / Work Orders)

Module Contents

src.dackar.RCA.cmms_integration.maximo_cmms_adapter.logger[source]
src.dackar.RCA.cmms_integration.maximo_cmms_adapter.JsonDict[source]
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.

base_url[source]
api_key[source]
site_id = None[source]
cr_object_name = 'SR'[source]
wo_object_name = 'WOTRACK'[source]
floc_field = 'LOCATION'[source]
timeout = 30[source]
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

  1. GET /maximo/oslc/os/{cr_object_name}?oslc.where=…

  2. GET /maximo/oslc/os/{wo_object_name}?oslc.where=…

  3. 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)

  4. Set is_sister_equipment=True for records whose LOCATION matches a sister FLOC, False for the primary asset.

  5. Return {“cr_records”: […], “wo_records”: […]}

Parameters:
  • primary_asset_id (str)

  • sister_component_ids (List[str])

  • lookback_from (str)

  • lookback_to (str)

  • event (JsonDict)

Return type:

JsonDict

_headers()[source]
Return type:

Dict[str, str]

_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_field so 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

static _map_status(maximo_status)[source]

Map Maximo status codes to cmms_context schema values.

Delegates to the shared normalize_cmms_status() so Maximo, SAP, and generic codes normalize identically wherever a status enters.

Parameters:

maximo_status (str)

Return type:

str