ShtukbaseStandard
package file→ .shtukbase/packages/quality/checks/q07_dataset.ts

checks/q07_dataset.ts

22 lines, 1.5 KB.

  1. // QLT-R07. A dataset that was received (category working or done) says where it lies, how many records it has and
  2. // which version; a labeled or approved one says who labeled it; an approved one has an owner. A stale dataset
  3. // (category dropped) is not checked.
  4. import type { Project, Result } from '../../collections/checks/lib/speclib.ts';
  5. import { main } from '../../collections/checks/lib/runner.ts';
  6. import { checkFields, state } from './lib/qlib.ts';
  7. export const RULE = { id: 'qlt-r07', title: 'A received dataset is described', scope: 'datasets after "Requested", except stale ones' };
  8. export function check(p: Project, res: Result): void {
  9. const c = (r: Parameters<typeof p.category>[0]) => p.category(r, 'DS') ?? '';
  10. checkFields(p, res, 'DS', [
  11. { when: (r) => ['working', 'done'].includes(c(r)), fields: ['storage', 'size', 'version'], why: 'the dataset is received, not described',
  12. fix: 'write where it lies (storage), how many records (size) and the version (version)', code: 'not-described' },
  13. { when: (r) => ['labeled', 'approved'].includes(state(r)), fields: ['labeledBy'], why: 'the dataset is labeled, but by whom is not said',
  14. fix: 'write who labeled it (labeledBy)', code: 'no-labeler' },
  15. { when: (r) => state(r) === 'approved', fields: ['owner'], why: 'an approved dataset without a person responsible',
  16. fix: 'write who is responsible for the dataset (owner)', code: 'no-owner' },
  17. ]);
  18. }
  19. if (import.meta.main) main({ RULE, check });