MCPcopy Create free account
hub / github.com/IBM/AssetOpsBench / workorder

Function workorder

src/couchdb/transforms.py:38–58  ·  view source on GitHub ↗

Type a work-order doc and stamp the Maximo ``type`` (used by the type indexes).

(doc)

Source from the content-addressed store, hash-verified

36
37
38def workorder(doc):
39 """Type a work-order doc and stamp the Maximo ``type`` (used by the type indexes)."""
40 doc.setdefault("type", "workorder")
41
42 for f in _WO_INT:
43 if isinstance(doc.get(f), str):
44 doc[f] = int(float(doc[f]))
45 for f in _WO_FLOAT:
46 if isinstance(doc.get(f), str):
47 doc[f] = float(doc[f])
48
49 if isinstance(doc.get("wplabor"), str): # JSON-string column → list
50 doc["wplabor"] = json.loads(doc["wplabor"])
51
52 evidence = doc.get("aob_source", {}).get("evidence")
53 if isinstance(evidence, dict):
54 for f in _WO_EVIDENCE_FLOAT:
55 if isinstance(evidence.get(f), str):
56 evidence[f] = float(evidence[f])
57
58 return doc

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected