<commit_before># -*- encoding: utf-8 -*-

from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from django.db import models

from managers import SlotManager, AppointmentManager
from log.models import TraceableModel


class Vacation(TraceableModel):
    doctor = models.ForeignKey(User, related_name='vacation_doctor')
    date = models.DateField(null=False, blank=False)
    description = models.CharField(max_length=5000, blank=True, null=True)

    class Meta:
        unique_together = ('doctor', 'date')

    def __unicode__(self):
        return u'id: %s %s slot at %s' \
            % (self.id, self.doctor, self.date)


class Event(TraceableModel):
    doctor = models.ForeignKey(User, related_name='event_doctor')
    date = models.DateField(null=False, blank=False)
    start_time = models.TimeField(null=False, blank=False)
    end_time = models.TimeField(null=False, blank=False)
    description = models.CharField(max_length=5000, blank=True, null=True)

    class Meta:
        unique_together = ('doctor', 'date', 'start_time', 'end_time')

    def __unicode__(self):
        return u'id: %s %s slot at %s' \
            % (self.id, self.doctor, self.date)


class SlotType(TraceableModel):
    doctor = models.ForeignKey(User, related_name='entry_type_doctor')
    title = models.CharField(max_length=256)
    duration = models.IntegerField()
    description = models.CharField(max_length=5000, blank=True, null=True)

    def __unicode__(self):
        return self.title


class Slot(TraceableModel):
    WEEKDAYS = (
        (0, _('Monday')),
        (1, _('Tuesday')),
        (2, _('Wednesday')),
        (3, _('Thursday')),
        (4, _('Friday')),
        (5, _('Saturday')),
        (6, _('Sunday')),
    )

    creator = models.ForeignKey(User, related_name='slot_creator')
    slot_type = models.ForeignKey(SlotType, related_name='slot_event_type',
        on_delete=models.PROTECT)
    weekday = models.IntegerField(choices=WEEKDAYS)
    date = models.DateField(null=False, blank=False)
    start_time = models.TimeField(null=False, blank=False)
    end_time = models.TimeField(null=False, blank=False)
    duration = models.IntegerField(null=False, blank=False)
    description = models.CharField(max_length=5000, blank=True, null=True)

    #reserved = models.BooleanField(default=False)

    # manager
    objects = SlotManager()

    def __unicode__(self):
        return u'id: %s %s slot at %s' \
            % (self.id, self.slot_type, self.start_time)

    class Meta:
        ordering = ["weekday", "start_time"]


class Appointment(TraceableModel):
    doctor = models.ForeignKey(User, related_name='appointment_doctor')
    patient = models.ForeignKey(User, related_name='appointment_patient')
    app_type = models.ForeignKey(SlotType,
        related_name='appointment_slot_type', null=True)

    date = models.DateField(null=False, blank=False)
    start_time = models.TimeField(null=False, blank=False)
    end_time = models.TimeField(null=False, blank=False)
    duration = models.IntegerField(null=False, blank=False)
    description = models.CharField(max_length=5000, blank=True, null=True)

    objects = AppointmentManager()
<commit_msg>mofidied appointment, new fields.<commit_after># -*- encoding: utf-8 -*-

from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from managers import SlotManager, AppointmentManager
from log.models import TraceableModel

from consulting.models import Task, Recommendation, Medicine


class Vacation(TraceableModel):
    doctor = models.ForeignKey(User, related_name='vacation_doctor')
    date = models.DateField(null=False, blank=False)
    description = models.CharField(max_length=5000, blank=True, null=True)

    class Meta:
        unique_together = ('doctor', 'date')

    def __unicode__(self):
        return u'id: %s %s slot at %s' \
            % (self.id, self.doctor, self.date)


class Event(TraceableModel):
    doctor = models.ForeignKey(User, related_name='event_doctor')
    date = models.DateField(null=False, blank=False)
    start_time = models.TimeField(null=False, blank=False)
    end_time = models.TimeField(null=False, blank=False)
    description = models.CharField(max_length=5000, blank=True, null=True)

    class Meta:
        unique_together = ('doctor', 'date', 'start_time', 'end_time')

    def __unicode__(self):
        return u'id: %s %s slot at %s' \
            % (self.id, self.doctor, self.date)


class SlotType(TraceableModel):
    doctor = models.ForeignKey(User, related_name='entry_type_doctor')
    title = models.CharField(max_length=256)
    duration = models.IntegerField(null=False, blank=False)
    description = models.CharField(max_length=5000, blank=True, null=True)

    def __unicode__(self):
        return self.title


class Slot(TraceableModel):
    WEEKDAYS = (
        (0, _('Monday')),
        (1, _('Tuesday')),
        (2, _('Wednesday')),
        (3, _('Thursday')),
        (4, _('Friday')),
        (5, _('Saturday')),
        (6, _('Sunday')),
    )

    creator = models.ForeignKey(User, related_name='slot_creator')
    slot_type = models.ForeignKey(SlotType, related_name='slot_event_type',
        on_delete=models.PROTECT)
    weekday = models.IntegerField(choices=WEEKDAYS)
    date = models.DateField(null=False, blank=False)
    start_time = models.TimeField(null=False, blank=False)
    end_time = models.TimeField(null=False, blank=False)
    duration = models.IntegerField(null=False, blank=False)
    description = models.CharField(max_length=5000, blank=True, null=True)

    #reserved = models.BooleanField(default=False)

    # manager
    objects = SlotManager()

    def __unicode__(self):
        return u'id: %s %s slot at %s' \
            % (self.id, self.slot_type, self.start_time)

    class Meta:
        ordering = ["weekday", "start_time"]


class Appointment(TraceableModel):
    STATUS = (
        (settings.UNRESOLVED, _(u'Pendiente')),
        (settings.DONE, _(u'Realizada')),
        (settings.NOT_DONE, _(u'No Realizada')),
        (settings.MODIFIED, _(u'Modificada')),
        (settings.MODIFIED_DONE, _(u'Modificada/Realizada')),
        (settings.MODIFIED_NOT_DONE, _(u'No Realizada')),
        (settings.MODIFIED_DELETED, _(u'Modificada/Cancelada')),
        (settings.CANCELED, _(u'Cancelada'))
    )

    doctor = models.ForeignKey(User, related_name='appointment_doctor')

    patient = models.ForeignKey(User, related_name='appointment_patient')

    app_type = models.ForeignKey(SlotType,
        related_name='appointment_slot_type', null=True)

    task = models.ForeignKey(Task, related_name='task_appointments',
                                blank=True, null=True)

    recommendation = models.ForeignKey(Recommendation,
                                    related_name="recommendation_appointments")

    medicines = models.ManyToManyField(Medicine,
                                    related_name="medicines_appointments")

    status = models.IntegerField(_(u'Estado'), choices=STATUS, blank=True,
                                null=True)

    date = models.DateField(null=False, blank=False)

    start_time = models.TimeField(null=False, blank=False)

    end_time = models.TimeField(null=False, blank=False)

    date_modified = models.DateTimeField(
              _(u'Fecha y hora de modificación de la Cita'), blank=True,
                    null=True)

    date_cancel = models.DateTimeField(
                        _(u'Fecha y hora de cancelación de la Cita'),
                        blank=True, null=True)
    duration = models.IntegerField(null=False, blank=False)
    description = models.CharField(max_length=5000, blank=True, null=True)

    objects = AppointmentManager()

{'fraction_non_alphanumeric': 0.12319574575841985, 'fraction_numerical': 0.00785008863003292, 'mean_word_length': 3.5188787185354693, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1641829', 'n_tokens_mistral': 2561, 'n_tokens_neox': 2420, 'n_words': 482}