<commit_before>import { Field } from './field';
import { File } from './file';

export class Object{
  id: number;
  base_path: string;
  input_file: string;
  path: string;
  title: string;
  headers: string[];
  metadata: Field[];
  files: File[];
  metadataHash: string;
  productionNotes: string;

  getField(name: string): Field {
    return this.metadata.find(field => name === field.name);
  }

  getFieldValue(name: string): string {
    let field: Field = this.getField(name);
    if (!field) { return null; }
    field.joinValues();
    return field.value;
  }

  isGood(): boolean {
    let requiredMetadata: Field[] = this.metadata.filter((metadata) => {
      return (
        metadata.map &&
        metadata.map.obligation === 'required' &&
        metadata.value === '' &&
        !metadata.map.hidden);
    });

    return requiredMetadata.length === 0;
  }

}<commit_msg>Fix error in validation check<commit_after>import { Field } from './field';
import { File } from './file';

export class Object{
  id: number;
  base_path: string;
  input_file: string;
  path: string;
  title: string;
  headers: string[];
  metadata: Field[];
  files: File[];
  metadataHash: string;
  productionNotes: string;

  getField(name: string): Field {
    return this.metadata.find(field => name === field.name);
  }

  getFieldValue(name: string): string {
    let field: Field = this.getField(name);
    if (!field) { return null; }
    field.joinValues();
    return field.value;
  }

  isGood(): boolean {
    let requiredMetadata: Field[] = this.metadata.filter((metadata) => {
      return (
        metadata.map &&
        metadata.map.obligation === 'required' &&
        metadata.value === '' &&
        metadata.map.visible);
    });

    return requiredMetadata.length === 0;
  }

}
{'fraction_non_alphanumeric': 0.15217391304347827, 'fraction_numerical': 0.0011148272017837235, 'mean_word_length': 3.0156599552572705, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1507188', 'n_tokens_mistral': 552, 'n_tokens_neox': 544, 'n_words': 138}