<commit_before>cd from datetime import date

from . import base
from . import mixins

class TransformedRecord(
    mixins.GenericCompensationMixin,
    mixins.GenericDepartmentMixin, mixins.GenericIdentifierMixin,
    mixins.GenericJobTitleMixin, mixins.GenericPersonMixin,
    mixins.MembershipMixin, mixins.OrganizationMixin, mixins.PostMixin,
    mixins.RaceMixin, mixins.LinkMixin, base.BaseTransformedRecord):

    MAP = {
        'last_name': 'Last',
        'first_name': 'First',
        'department': 'Department',
        'job_title': 'Title',
        'hire_date': 'Hire Date',
        'status': 'Status',
        'contract': 'Months of Contract',
        'gender': 'Gender',
        'given_race': 'Race',
        'compensation': 'Salary',
    }

    NAME_FIELDS = ('first_name', 'last_name', )

    ORGANIZATION_NAME = 'Tarrant County College'

    ORGANIZATION_CLASSIFICATION = 'Community College'

    DATE_PROVIDED = date(2015, 11, 13)

    URL = ('http://s3.amazonaws.com/raw.texastribune.org/tarrant_county_college/'
        'salaries/2015-11/tarrantcountycollege.xlsx')

    @property
    def compensation(self):
        salary = self.get_mapped_value('compensation')
        wage = self.get_mapped_value('rate')

        if salary == '0':
            return wage
        else:
            return salary

    @property
    def is_valid(self):
        # Adjust to return False on invalid fields.  For example:
        return self.last_name.strip() != ''

    @property
    def compensation_type(self):
        emptype = self.get_mapped_value('status')

        if 'Full' in emptype:
            return 'FT'
        else:
            return 'PT'

    @property
    def description(self):
        status = self.status
        employee_type = self.employee_type

        if 'Full' in status:
            return 'Annual salary'

        if 'Part' in status:
            return 'Part-time annual salary'

        if 'Hourly' in status:
            return 'Hourly rate'

        if 'Seasonal' in status:
            return 'Hourly rate'

        if 'Fee' in status:
            return 'Stipend'

    @property
    def person(self):
        name = self.get_name()
        r = {
            'family_name': name.last,
            'given_name': name.first,
            'name': unicode(name),
            'gender': self.gender_map[self.gender.strip()]
        }

        return r

    @property
    def race(self):
        race = self.given_race.strip()
        if race == '':
            race = 'Not given'
        return {'name': race}<commit_msg>initial changes to properties<commit_after>cd from datetime import date

from . import base
from . import mixins

class TransformedRecord(
    mixins.GenericCompensationMixin,
    mixins.GenericDepartmentMixin, mixins.GenericIdentifierMixin,
    mixins.GenericJobTitleMixin, mixins.GenericPersonMixin,
    mixins.MembershipMixin, mixins.OrganizationMixin, mixins.PostMixin,
    mixins.RaceMixin, mixins.LinkMixin, base.BaseTransformedRecord):

    MAP = {
        'last_name': 'Last',
        'first_name': 'First',
        'department': 'Department',
        'job_title': 'Title',
        'hire_date': 'Hire Date',
        'status': 'Status',
        'contract': 'Months of Contract',
        'gender': 'Gender',
        'given_race': 'Race',
        'compensation': 'Salary',
    }

    NAME_FIELDS = ('first_name', 'last_name', )

    ORGANIZATION_NAME = 'Tarrant County College'

    ORGANIZATION_CLASSIFICATION = 'Community College'

    DATE_PROVIDED = date(2015, 11, 13)

    URL = ('http://s3.amazonaws.com/raw.texastribune.org/tarrant_county_college/'
        'salaries/2015-11/tarrantcountycollege.xlsx')

    @property
    def is_valid(self):
        # Adjust to return False on invalid fields.  For example:
        return self.last_name.strip() != ''

    @property
    def compensation_type(self):
        emptype = self.get_mapped_value('status')

        if emptype == 'Full Time' or emptype == 'Temporary Full Time':
            return 'FT'
        else:
            return 'PT'

    @property
    def description(self):
        status = self.status
        contract = self.contract

        if status == 'Part Time':
            return 'Hourly rate'
        elif status == '60% Full Time':
            return 'Part time salary'
        else:
            return contract + '-month salary'

    @property
    def person(self):
        name = self.get_name()
        r = {
            'family_name': name.last,
            'given_name': name.first,
            'name': unicode(name),
            'gender': self.gender.strip()
        }

        return r

    @property
    def race(self):
        race = self.given_race.strip()
        if race == '':
            race = 'Not given'
        return {'name': race}
{'fraction_non_alphanumeric': 0.11234309623430962, 'fraction_numerical': 0.006903765690376569, 'mean_word_length': 2.2195286195286195, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2009999', 'n_tokens_mistral': 1525, 'n_tokens_neox': 1426, 'n_words': 336}