Fill Out The Check Sheet
The Cleanliness Check has no automatic trigger, so you start it yourself. Each time a check sheet is started, Kanoa creates a check event: one filled-in copy of the form.
- Navigate to Quality → Schedule → Active Checks
- Clear any selected asset. This check isn't tied to an asset, and a selected asset will filter the list of checks.
- Click Add Check, choose
Cleanliness Check, and click Add. - Double-click the new check to open it.
- Answer all four areas. Choose
Over-ClutteredorDirtyfor at least one area so you can see how a failure behaves, and enter a comment when asked. - Click Submit.
- Close the Check Sheet Event Editor

Each answer is saved the moment you select it. Submit doesn't save the answers; it completes the check and changes its status.
The Active Checks view shows all active checks (Due, Coming Due, Overdue, In Progress, Submitted) and inactive checks (Approved, Canceled, Rejected, Disabled) for the last 24 hours. For more filtering options, use the Quality → Schedule → Check Table view.
- Navigate to Quality → Schedule → Check Table.
- Clear any selected asset, leave Manual selected and the date range on
This Month. The table loads on its own. - Find the Cleanliness Check you submitted. Its Status is
Approved: the sheet doesn't need a sign-off, so submitting it approves it. - Look at the Check OK column: it counts the failed check items, so your check shows at least
1. Taken On and Taken By show when and by whom it was done.
You'll come back to this check in the Receiving Inspection chapter and correct it from the Check Table.
Copy this script into the Ignition Designer Script Console (Tools → Script Console) and run it. It checks that a Cleanliness Check has been submitted with all four areas answered, and that one has a failed area and is Approved. Each check prints PASS or FAIL with what to fix. It doesn't change anything.
Show the check script
# Kanoa Quality Training - check "Fill Out The Check Sheet" (Cleanliness Check, lesson 2)
#
# Run in the Ignition Designer Script Console (Tools > Script Console), in the
# project that inherits KANOA_SCRIPTS. It only reads; it changes nothing.
# Every check prints PASS or FAIL with what to fix, then a summary.
SHEET = 'Cleanliness Check'
ITEMS = ['Machining Area', 'Coating Area', 'Mixing Area', 'Finishing Area']
FAIL_RESPONSES = ['Over-Cluttered', 'Dirty']
DONE = ['Approved', 'Submitted']
# Revise and Correct (Receiving Inspection) corrects the failed check, so after that
# lesson an approved check with no failures is expected instead
LATER_SHEET = 'Receiving Inspection'
results = []
def check(ok, what, fix=None):
results.append(bool(ok))
if ok:
print 'PASS %s' % what
else:
print 'FAIL %s' % what
if fix:
print ' -> %s' % fix
def note(what):
print 'NOTE %s' % what
def field(row, *names):
for n in names:
if n in row and row[n] is not None:
return row[n]
return None
def text(v):
return '' if v is None else unicode(v).strip()
def key(v):
return ' '.join(text(v).lower().split())
def num(v):
try:
return float(v)
except:
return None
def rows(data):
# Kanoa returns a dataset, a list of dictionaries, or None
if data is None:
return []
if hasattr(data, 'getRowCount'):
cols = list(data.getColumnNames())
return [dict((c, data.getValueAt(i, c)) for c in cols) for i in range(data.getRowCount())]
return [dict(r) for r in data]
def findSheet(name):
"""All versions of a check sheet, and the one to check: the Released version, or else the newest.
A revision renames the archived version '<name> - N' and the open one '<name> - In Revision',
so the other versions are found by their master sheet, not by name."""
sheets = rows(system.kanoa.quality.sheet.getSheets({}))
named = [s for s in sheets if text(field(s, 'chkShtName')) == name] or \
[s for s in sheets if key(field(s, 'chkShtName')) == key(name)]
if not named:
return None, []
masters = set(text(field(s, 'masterChkShtId', 'chkShtId')) for s in named)
versions = [s for s in sheets if text(field(s, 'masterChkShtId', 'chkShtId')) in masters]
versions.sort(key=lambda s: num(field(s, 'chkShtVersionNumber')) or 0)
released = [s for s in versions if text(field(s, 'chkShtVersionStateName')) == 'Released']
return (released or versions)[-1], versions
def millis(v):
return v.getTime() if hasattr(v, 'getTime') else 0
def sheetEvents(versions):
"""Every check event of any version of the sheet, newest first."""
out = []
for s in versions:
out += rows(system.kanoa.quality.event.getChkShtEvents({'chkShtId': field(s, 'chkShtId')}))
out.sort(key=lambda e: millis(field(e, 'scheduledDate', 'takenDate')), reverse=True)
return out
def eventItems(event):
"""The recorded values of a check event, by check item name."""
byName = {}
for r in rows(system.kanoa.quality.event.getChkShtEventItems({'chkShtEventId': field(event, 'chkShtEventId')})):
byName.setdefault(text(field(r, 'chkItemName')), []).append(r)
return byName
def values(itemRows):
return [text(field(r, 'chkItemValue')) for r in itemRows or [] if text(field(r, 'chkItemValue'))]
def failed(event, byName):
if (num(field(event, 'failedChecks')) or 0) > 0:
return True
return any(text(field(r, 'chkItemStateName')).upper() == 'FAIL' for rs in byName.values() for r in rs)
print '=' * 70
print 'Kanoa Quality Training - Complete a Cleanliness Check check'
print '=' * 70
sheet, versions = findSheet(SHEET)
if sheet is None:
check(False, 'Check sheet %s exists' % SHEET, 'Build it in the previous lesson first.')
else:
print '\n-- Completed checks'
events = sheetEvents(versions)
done = [e for e in events if text(field(e, 'chkShtStateName')) in DONE]
if not done:
states = ', '.join(sorted(set(text(field(e, 'chkShtStateName')) for e in events)))
check(False, 'A Cleanliness Check has been submitted',
'In Quality > Schedule > Active Checks, clear the asset, click Add Check, choose %s, answer all four areas and click Submit.%s'
% (SHEET, (' Checks so far: %s.' % states) if states else ''))
else:
check(True, 'A Cleanliness Check has been submitted (%d so far)' % len(done))
details = [(e, eventItems(e)) for e in done]
# Every area answered
complete = [(e, b) for e, b in details if all(values(b.get(n)) for n in ITEMS)]
check(complete, 'A submitted check has an answer for all four areas',
'Open a new check, answer Machining, Coating, Mixing and Finishing Area, then submit it.')
# A failed answer, with a comment
withFail = [(e, b) for e, b in complete if failed(e, b)]
laterSheet, laterVersions = findSheet(LATER_SHEET)
corrected = any((num(field(v, 'chkShtVersionNumber')) or 0) > 1 for v in laterVersions)
if withFail:
check(True, 'A submitted check has a failed area')
e, b = withFail[0]
failRows = [r for n in ITEMS for r in b.get(n, []) if text(field(r, 'chkItemValue')) in FAIL_RESPONSES]
if failRows and not any(text(field(r, 'comment')) for r in failRows):
note('The failed area has no comment. Kanoa asks for one when you choose a Fail response.')
state = text(field(e, 'chkShtStateName'))
check(state == 'Approved', 'The failed check is Approved (no sign-off is needed)',
"It's %s. The Cleanliness Check doesn't need a sign-off, so a submitted check should be Approved." % state)
elif corrected:
check(True, 'A submitted check has a failed area (corrected since, in Revise and Correct)')
else:
check(False, 'A submitted check has a failed area',
'Add another Cleanliness Check and choose Over-Cluttered or Dirty for at least one area. Revise and Correct needs a failed check to correct.')
passed = results.count(True)
print '\n' + '=' * 70
print 'Result: %d of %d checks passed' % (passed, len(results))
if passed == len(results):
print 'All good. Your Cleanliness Check is complete.'
else:
print 'Fix the FAIL items above, then run this again.'
print '=' * 70
You can import the check sheet here instead of building it by hand.
Downloadcheck-sheet-cleanliness-check.jsonImport it on the Check Sheet configuration screen (Configuration → Quality → Check Sheets) using the import/export button.




