archivo del paquete→ .shtukbase/packages/quality/checks/q07_dataset.ts
checks/q07_dataset.ts
22 líneas, 1.5 KB.
El archivo tal como está en el paquete: el código y sus comentarios no se traducen.
- // QLT-R07. A dataset that was received (category working or done) says where it lies, how many records it has and
- // which version; a labeled or approved one says who labeled it; an approved one has an owner. A stale dataset
- // (category dropped) is not checked.
- import type { Project, Result } from '../../collections/checks/lib/speclib.ts';
- import { main } from '../../collections/checks/lib/runner.ts';
- import { checkFields, state } from './lib/qlib.ts';
- export const RULE = { id: 'qlt-r07', title: 'A received dataset is described', scope: 'datasets after "Requested", except stale ones' };
- export function check(p: Project, res: Result): void {
- const c = (r: Parameters<typeof p.category>[0]) => p.category(r, 'DS') ?? '';
- checkFields(p, res, 'DS', [
- { when: (r) => ['working', 'done'].includes(c(r)), fields: ['storage', 'size', 'version'], why: 'the dataset is received, not described',
- fix: 'write where it lies (storage), how many records (size) and the version (version)', code: 'not-described' },
- { when: (r) => ['labeled', 'approved'].includes(state(r)), fields: ['labeledBy'], why: 'the dataset is labeled, but by whom is not said',
- fix: 'write who labeled it (labeledBy)', code: 'no-labeler' },
- { when: (r) => state(r) === 'approved', fields: ['owner'], why: 'an approved dataset without a person responsible',
- fix: 'write who is responsible for the dataset (owner)', code: 'no-owner' },
- ]);
- }
- if (import.meta.main) main({ RULE, check });