<commit_before># MIT License
# Copyright (c) 2019 MassChallenge, Inc.

from accelerator.models import MentorProgramOfficeHour
from impact.v1.helpers.model_helper import (
    ModelHelper,
    BOOLEAN_FIELD,
    OPTIONAL_INTEGER_FIELD,
    OPTIONAL_STRING_FIELD,
    PK_FIELD,
)

OFFFICE_HOUR_FIELDS = {
    "id": PK_FIELD,
    "title": OPTIONAL_STRING_FIELD,
    "location": OPTIONAL_STRING_FIELD,
    "timezone": OPTIONAL_STRING_FIELD,
    "start_date_time": OPTIONAL_STRING_FIELD,
    "end_date_time": OPTIONAL_STRING_FIELD,
    "mentor_id": OPTIONAL_INTEGER_FIELD,
    "mentor_name": OPTIONAL_STRING_FIELD,
    "mentor_email": OPTIONAL_STRING_FIELD,
    "finalist_id": OPTIONAL_INTEGER_FIELD,
    "finalist_name": OPTIONAL_STRING_FIELD,
    "finalist_email": OPTIONAL_STRING_FIELD,
    "is_open": BOOLEAN_FIELD,
    "topics": OPTIONAL_STRING_FIELD,
    "description": OPTIONAL_STRING_FIELD,
    "street_address": OPTIONAL_STRING_FIELD,
    "city": OPTIONAL_STRING_FIELD,
    "state": OPTIONAL_STRING_FIELD,

}


class MentorProgramOfficeHourHelper(ModelHelper):
    model = MentorProgramOfficeHour

    @classmethod
    def fields(cls):
        return OFFFICE_HOUR_FIELDS

    @property
    def title(self):
        return str(self.subject)

    @property
    def location(self):
        return self.field_element("location", "name")

    @property
    def street_address(self):
        return self.field_element("location", "street_address")

    @property
    def city(self):
        return self.field_element("location", "city")

    @property
    def state(self):
        return self.field_element("location", "state")

    @property
    def timezone(self):
        return self.field_element("location", "timezone")
<commit_msg>[AC-7259] return officehour output to include programs<commit_after># MIT License
# Copyright (c) 2019 MassChallenge, Inc.

from accelerator.models import MentorProgramOfficeHour
from impact.v1.helpers.model_helper import (
    ModelHelper,
    BOOLEAN_FIELD,
    OPTIONAL_INTEGER_FIELD,
    OPTIONAL_STRING_FIELD,
    PK_FIELD,
)

OFFFICE_HOUR_FIELDS = {
    "id": PK_FIELD,
    "title": OPTIONAL_STRING_FIELD,
    "location": OPTIONAL_STRING_FIELD,
    "timezone": OPTIONAL_STRING_FIELD,
    "start_date_time": OPTIONAL_STRING_FIELD,
    "end_date_time": OPTIONAL_STRING_FIELD,
    "mentor_id": OPTIONAL_INTEGER_FIELD,
    "mentor_name": OPTIONAL_STRING_FIELD,
    "mentor_email": OPTIONAL_STRING_FIELD,
    "finalist_id": OPTIONAL_INTEGER_FIELD,
    "finalist_name": OPTIONAL_STRING_FIELD,
    "finalist_email": OPTIONAL_STRING_FIELD,
    "is_open": BOOLEAN_FIELD,
    "topics": OPTIONAL_STRING_FIELD,
    "description": OPTIONAL_STRING_FIELD,
    "street_address": OPTIONAL_STRING_FIELD,
    "city": OPTIONAL_STRING_FIELD,
    "state": OPTIONAL_STRING_FIELD,
    "program": OPTIONAL_STRING_FIELD,

}


class MentorProgramOfficeHourHelper(ModelHelper):
    model = MentorProgramOfficeHour

    @classmethod
    def fields(cls):
        return OFFFICE_HOUR_FIELDS

    @property
    def title(self):
        return str(self.subject)

    @property
    def program(self):
        return self.field_element("program", "name")

    @property
    def location(self):
        return self.field_element("location", "name")

    @property
    def street_address(self):
        return self.field_element("location", "street_address")

    @property
    def city(self):
        return self.field_element("location", "city")

    @property
    def state(self):
        return self.field_element("location", "state")

    @property
    def timezone(self):
        return self.field_element("location", "timezone")

{'fraction_non_alphanumeric': 0.09862637362637362, 'fraction_numerical': 0.0038461538461538464, 'mean_word_length': 4.085195530726257, 'pattern_counts': {'":': 37, '<': 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': '678545', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1201, 'n_words': 216}