Esempio n. 1
0
class ReferenceLocal(models.Model):
    class Meta:
        verbose_name = _("Bibliographic Record Local")
        verbose_name_plural = _("Bibliographic Records Local")

    source = models.ForeignKey(Reference,
                               verbose_name=_("Source"),
                               blank=False)
    # field tag 03
    call_number = JSONField(_('Call number'),
                            blank=True,
                            null=True,
                            dump_kwargs={'ensure_ascii': False})
    # field tag 04
    database = models.TextField(_('Database'), blank=True)
    # field tag 07
    inventory_number = models.TextField(_('Inventory number'), blank=True)
    # field tag 61
    internal_note = models.TextField(_('Internal note'), blank=True)
    # field tag 653
    local_descriptors = models.TextField(_('Local descriptors'), blank=True)
    # responsible cooperative center
    cooperative_center_code = models.CharField(_('Cooperative center'),
                                               max_length=55,
                                               blank=True)

    def __unicode__(self):
        return u"[%s] | %s" % (self.cooperative_center_code, self.source)
Esempio n. 2
0
class SociodemographicEvaluation(Form):
    class Meta:
        table_name = "forms_sociodemographic_evaluation"

    class CivilStatusTypes(enum.Enum):
        Single = "Solteiro(a)"
        Married = "Casado(a)"
        Divorced = "Divorciado(a)"
        Widowed = "Viúvo(a)"

    class LivesWithStatusTypes(enum.Enum):
        Alone = "Sozinho(a)"
        Relatives = "Familiares"
        Friends = "Amigos"
        Spouse = "Cônjuge"

    class EducationTypes(enum.Enum):
        Illiterate = "Analfabeto(a)"
        Primary = "Primeiro Grau"
        Secondary = "Segundo Grau"
        Tertiary = "Superior/Pós-graduado(a)"

    class OccupationalStatusTypes(enum.Enum):
        Student = "Estudante"
        Unemployed = "Desempregado(a)"
        Employed = "Empregado(a)"
        AwayForHealth = "Afastado(a) por problemas de saúde"
        Retired = "Aposentado(a)"

    civil_status = EnumField(CivilStatusTypes)
    lives_with_status = EnumField(LivesWithStatusTypes)

    education = EnumField(EducationTypes)
    occupational_status = EnumField(OccupationalStatusTypes)
    current_job = CharField(default=None, null=True)
    last_job = CharField(default=None, null=True)

    is_sick = BooleanField()
    diseases = JSONField(default=None, null=True)
    is_medicated = BooleanField()
    medicines = JSONField(default=None, null=True)
Esempio n. 3
0
class ReferenceAnalytic(Reference):

    class Meta:
        verbose_name = _("Bibliographic Record Analytic")
        verbose_name_plural = _("Bibliographic Records Analytic")

    source = models.ForeignKey(ReferenceSource, verbose_name=_("Source"), blank=False)
    # field tags 10
    individual_author = JSONField(_('Individual author'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tag 11
    corporate_author = JSONField(_('Corporate author'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tag 12
    title = JSONField(_('Title'), blank=True, null=True, dump_kwargs={'ensure_ascii': False}, help_text=_("Field mandatory"))
    # field tag 13
    english_translated_title = models.CharField(_('English translated title'), max_length=400, blank=True)
    # field tag 14
    pages = JSONField(_('Pages'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tag 49
    thesis_dissertation_analytic_leader = JSONField(_('Leader'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tag 700
    clinical_trial_registry_name = JSONField(_('Clinical trial registry name'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tag 724
    doi_number = models.CharField(_('DOI number'), max_length=150, blank=True)

    def __unicode__(self):
        if 'a' in self.treatment_level:
            if self.literature_type[0] == 'S':
                ref_title = u"{0}; {1} ({2}), {3} | {4}".format(self.source.title_serial,
                                                                self.source.volume_serial,
                                                                self.source.issue_number,
                                                                self.source.publication_date_normalized[:4],
                                                                self.title[0]['text'])
            else:
                ref_title = u"{0} | {1}".format(self.source.title_monographic[0]['text'],
                                                self.title[0]['text'])
        else:
            ref_title = self.title[0]['text']

        return ref_title
Esempio n. 4
0
class OER(Generic, AuditLog):
    class Meta:
        verbose_name = _("Open Educational Resource")
        verbose_name_plural = _("Open Educational Resources")

    status = models.SmallIntegerField(_("Status"),
                                      choices=STATUS_CHOICES,
                                      null=True,
                                      default=-1)
    # indica que é um registro CVSP
    CVSP_resource = models.BooleanField(_('CVSP resource'), default=True)
    # título do recurso educacional
    title = models.CharField(_("Title"), max_length=255, blank=False)
    # objetivos
    learning_objectives = models.TextField(_("Learning objectives"),
                                           blank=True)
    # descrição
    description = models.TextField(_("Description"), blank=True)
    # responsável pela criação do recurso
    creator = JSONField(_('Creator'),
                        blank=True,
                        null=True,
                        dump_kwargs={'ensure_ascii': False})
    # contribuidores
    contributor = JSONField(_('Contributor'),
                            blank=True,
                            null=True,
                            dump_kwargs={'ensure_ascii': False})
    # tipo do recurso
    type = models.ForeignKey(Type,
                             verbose_name=_("Type"),
                             blank=True,
                             null=True)
    # idioma do recurso
    language = models.ForeignKey(SourceLanguage,
                                 verbose_name=_("Language"),
                                 blank=True,
                                 null=True)
    # tipo do curso
    course_type = models.ManyToManyField(CourseType,
                                         verbose_name=_("Course type"),
                                         blank=True)
    # estrutura
    structure = models.ForeignKey(Structure,
                                  verbose_name=_("Structure"),
                                  blank=True,
                                  null=True)
    # tipo de recurso técnico
    tec_resource_type = models.ManyToManyField(
        TecResourceType, verbose_name=_("Technical resource type"), blank=True)
    # formato
    format = models.ManyToManyField(Format,
                                    verbose_name=_("Format"),
                                    blank=True)
    # tipo de interatividade
    interactivity_type = models.ForeignKey(
        InteractivityType,
        verbose_name=_("Interactivity type"),
        blank=True,
        null=True)
    # tipo de recurso de aprendizagem
    learning_resource_type = models.ForeignKey(
        LearningResourceType,
        verbose_name=_("Learning resource type"),
        blank=True,
        null=True)
    # nivel de interatividade
    interactivity_level = models.ForeignKey(
        InteractivityLevel,
        verbose_name=_("Interactivity level"),
        blank=True,
        null=True)
    # contexto de aprendizagem
    learning_context = models.ForeignKey(LearningContext,
                                         verbose_name=_("Learning context"),
                                         blank=True,
                                         null=True)
    # dificuldade
    difficulty = models.ForeignKey(Difficulty,
                                   verbose_name=_("Difficulty"),
                                   blank=True,
                                   null=True)
    # nível de agregação
    aggregation_level = models.CharField(_("Aggregation Level"),
                                         max_length=55,
                                         choices=STATUS_AGGREGATION,
                                         blank=True)
    # audiência
    audience = models.ManyToManyField(Audience,
                                      verbose_name=_("Audience"),
                                      blank=True)
    # licença de uso
    license = models.ForeignKey(License,
                                verbose_name=_("Rights license"),
                                blank=True,
                                null=True)
    # publicador
    publisher = models.CharField(_("Publisher"), max_length=155, blank=True)
    # palavras-chave livres
    free_keywords = models.TextField(_('Free keywords'), blank=True)
    # duração do vídeo/audio
    duration = models.CharField(_("Duration"), max_length=155, blank=True)
    # tamanho
    size = models.CharField(_("Size"), max_length=55, blank=True)
    # requisitos técnicos
    technical_requirements = models.CharField(_("Technical requirements"),
                                              max_length=155,
                                              blank=True)
    # tempo tipico de aprendizagem
    typical_learning_time = models.CharField(_("Typical learning time"),
                                             max_length=115,
                                             blank=True)
    # responsible cooperative center
    cooperative_center_code = models.CharField(_('Cooperative center'),
                                               max_length=55,
                                               blank=True)
    # identificação do nó CVSP
    cvsp_node = models.CharField(_('CVSP node'), max_length=55, blank=True)

    def __unicode__(self):
        return self.title
Esempio n. 5
0
class Order(models.Model):
    billing_address = models.ForeignKey('customers.CustomerAddress', related_name='order_billing_address_set')
    browser_ip = StringField(_('browser ip'))
    buyer_accepts_marketing = models.BooleanField(_('buyer accepts marketing'), default=False)
    cancel_reason = ChoiceField(_('cancel reason'), choices=CANCEL_CHOICES)
    cancelled_at = models.DateTimeField(_('cancelled at'), blank=True, null=True)
    cart_token = StringField(_('cart token'), required=True)
    client_details = models.ForeignKey('orders.ClientDetail', verbose_name=_('client details'))
    closed_at = models.DateTimeField(_('closed at'), blank=True, null=True)
    created_at = models.DateTimeField(_('created at'), auto_now_add=True)
    currency = ChoiceField(_('currency'), choices=CURRENCY_CHOICES)
    customer = models.ForeignKey('customers.Customer', blank=True, null=True, related_name='order_billing_addresss_set')
    discounts_m2m = models.ManyToManyField('discounts.Discount', blank=True)
    email = models.EmailField(_('email'), blank=True, null=True)
    financial_status = ChoiceField(_('financial status'), choices=FINANCIAL_STATUS_CHOICES)
    fulfillment_status = ChoiceField(_('fulfilment status'), choices=FULFILLMENT_STATUS_CHOICES)
    tags = ArrayField(StringField(_('tag'), required=True), verbose_name=_('tags'), default=[])
    landing_site = models.URLField(_('landing site'), blank=True, null=True)
    # line items
    location = models.ForeignKey('locations.Location', blank=True, null=True)
    order_number = models.PositiveIntegerField(_('order'), editable=False)  # its nice to be searchable
    note = TextField(_('note'))
    note_attributes = JSONField(_('note attributes'))
    processed_at = models.DateTimeField(_('processed at'), blank=True)
    processing_method = ChoiceField(_('processing method'), choices=PROCESSING_CHOICES)
    referring_site = models.URLField(_('referring site'), blank=True, null=True)
    # Do we need to lock this value somehow, infact all related models should be 'locked' on finalization
    shipping_address = models.ForeignKey('customers.CustomerAddress', blank=True, null=True, related_name='order_shipping_address_set')
    source_name = StringField(_('source name'), default='api')
    subtotal_price = models.FloatField(_('subtotal price'))
    taxes_included = models.BooleanField(_('taxes included'))
    token = models.CharField(_('token'), max_length=32, default=get_token, editable=False)
    # All of these total fields are probably better of being calculated values, let's keep
    # normalizing at a minimum since it requires more thinking power
    total_discounts = models.FloatField(_('total discounts'), default=0)
    total_line_items_price = models.FloatField(_('total line items price'))
    total_price = models.FloatField(_('total price'))
    total_tax = models.FloatField(_('total tax'))
    total_weight = models.FloatField(_('total weight'))
    updated_at = models.DateTimeField(_('updated at'), auto_now=True)
    user = models.ForeignKey('users.User', blank=True, null=True)
    order_status_url = models.URLField(_('order status url'), blank=True, null=True)

    @cached_property
    def cancel_reason_label(self):
        return self.get_cancel_reason_label()

    @cached_property
    def cancelled(self):
        return self.cancelled_at is not None

    @cached_property
    def customer_url(self):
        """
        Returns the URL of the customer's account page.
        https://help.shopify.com/themes/liquid/objects/order#order-customer_url
        """
        raise NotImplemented

    @cached_property
    def discounts(self):
        return List(self.discounts_m2m.all())

    @cached_property
    def discount_codes(self):
        codes = []
        for d in self.discouns:
            codes.append({
                'amount': d.amount(),
                'code': d.code,
                'type': d.discount_type,
            })
        return codes

    @cached_property
    def financial_status_label(self):
        return self.get_financial_status_label()

    @cached_property
    def fulfillment_status_label(self):
        return self.get_fulfillment_status_label()

    @cached_property
    def fulfillments(self):
        return List(self.fulfillment_set.all())

    @property
    def gateway(self):
        """
        Deprecated as of July 14, 2014. This information is instead available
        on transactions The payment gateway used.
        """
        return ''

    @cached_property
    def name(self):
        """
        The customer's order name as represented by a number.
        """
        return '#{}'.format(self.number)

    @cached_property
    def number(self):
        """
        Numerical identifier unique to the shop. A number is sequential and
        starts at 1000.

        The example shows number 1, it is a little unclear what this is for.
        """
        return self.pk

    @cached_property
    def payment_details(self):
        """
        Deprecated.
        This information is instead available on transactions An object
        containing information about the payment.
        """
        return {
            "avs_result_code": None,
            "credit_card_bin": None,
            "cvv_result_code": None,
            "credit_card_number": None,
            "credit_card_company": None,
        }

    @cached_property
    def payment_gateway_names(self):
        """
        This should fetch information from the related transaction
        """
        raise NotImplemented

    @cached_property
    def refunds(self):
        """
        The list of refunds applied to the order.
        """
        #return List(self.refund_set.all())
        raise NotImplemented

    def save(self, **kwargs):
        self.order_number = self.pk + 999
        if not self.processed_at:
            self.processed_at = datetime.datetime.now()
        super().save(**kwargs)

    @cached_property
    def shipping_lines(self):
        """
        An array of shipping_line objects, each of which details the shipping
        methods used.

        """
        raise NotImplemented

    @cached_property
    def tax_lines(self):
        """
        An array of tax_line objects, each of which details the total taxes
        applicable to the order.

        https://help.shopify.com/api/reference/order#tax-lines-property
        """
        raise NotImplemented

    @cached_property
    def tax_price(self):
        return self.total_tax
Esempio n. 6
0
class Reference(Generic, AuditLog):
    class Meta:
        verbose_name = _("Bibliographic Record")
        verbose_name_plural = _("Bibliographic Records")

    status = models.SmallIntegerField(_('Status'), choices=STATUS_CHOICES, null=True, default=-1)
    LILACS_indexed = models.BooleanField(_('Validate using LILACS methodology'), default=True)
    BIREME_reviewed = models.BooleanField(_('Reviewed by BIREME?'), default=False)

    # title used for display and search of Reference objects
    reference_title = models.TextField(_('Title'), blank=True)
    # field tag 01
    cooperative_center_code = models.CharField(_('Cooperative center'), max_length=55, blank=True)
    # field tag 04 (normalized by BIREME - regional indexes)
    indexed_database = models.ManyToManyField(Database, verbose_name=_("Indexed in"), blank=True)
    # field tag 05
    literature_type = models.CharField(_('Literature type'), max_length=10, blank=True)
    # field tag 06
    treatment_level = models.CharField(_('Treatment level'), max_length=10, blank=True)
    # field tag 08
    electronic_address = JSONField(_('Electronic address'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tag 09
    record_type = AuxiliaryChoiceField(_('Record type'), max_length=10, blank=True)

    # field tag 38
    descriptive_information = JSONField(_('Descriptive information'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tag 40
    text_language = MultipleAuxiliaryChoiceField(_('Text language'), blank=True)
    # field tag 61
    internal_note = models.TextField(_('Internal note'), blank=True)
    # field tag 64
    publication_date = models.CharField(_('Publication date'), max_length=250, blank=True)
    # field tag 65
    publication_date_normalized = models.CharField(_('Publication normalized date'), max_length=25, blank=True, help_text=_("Format: YYYYMMDD"))
    # field tag 71
    publication_type = MultipleAuxiliaryChoiceField(_('Publication type'), max_length=100, blank=True)
    # field tag 72
    total_number_of_references = models.CharField(_('Total number of references'), max_length=100, blank=True)
    # field tag 74
    time_limits_from = models.CharField(_('Time limits (from)'), max_length=50, blank=True)
    # field tag 75
    time_limits_to = models.CharField(_('Time limits (to)'), max_length=50, blank=True)
    # field tag 76
    check_tags = MultipleAuxiliaryChoiceField(_('Check tags'), max_length=100, blank=True)
    # field tag 78
    person_as_subject = models.TextField(_('Person as subject'), blank=True)
    # field tag 82
    non_decs_region = models.TextField(_('Non-DeCS Region'), blank=True)
    # field tag 83
    abstract = JSONField(_('Abstract'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tag 84
    transfer_date_to_database = models.CharField(_('Transfer date do database'), max_length=20, blank=True, editable=False)
    # field tag 85
    author_keyword = JSONField(_('Author keyword'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tag 110
    item_form = AuxiliaryChoiceField(_('Item form'), max_length=10, blank=True)
    # field tag 111
    type_of_computer_file = AuxiliaryChoiceField(_('Type of computer file'), max_length=10, blank=True)
    # field tag 112
    type_of_cartographic_material = AuxiliaryChoiceField(_('Type of cartographic material'), max_length=10, blank=True)
    # field tag 113
    type_of_journal = AuxiliaryChoiceField(_('Type of journal'), max_length=10, blank=True)
    # field tag 114
    type_of_visual_material = AuxiliaryChoiceField(_('Type of visual material'), max_length=10, blank=True)
    # field tag 115
    specific_designation_of_the_material = AuxiliaryChoiceField(_('Specific designation of the material'), max_length=10, blank=True)
    # field tag 500
    general_note = models.TextField(_('General note'), blank=True)
    # field tag 505
    formatted_contents_note = models.TextField(_('Formatted contents note'), blank=True)
    # field tag 530
    additional_physical_form_available_note = models.TextField(_('Additional physical form available note'), blank=True)
    # field tag 533
    reproduction_note = models.TextField(_('Reproduction note'), blank=True)
    # field tag 534
    original_version_note = models.TextField(_('Original version note'), blank=True)
    # field tag 610
    institution_as_subject = models.TextField(_('Institution as subject'), blank=True)
    # field tag 653
    local_descriptors = models.TextField(_('Local descriptors'), blank=True)
    # field tag 899
    software_version = models.CharField(_('Software version'), max_length=50, blank=True, editable=False)
    # control fields
    LILACS_original_id = models.CharField(_('LILACS id'), max_length=8, blank=True, editable=False)
    interoperability_source = models.CharField(_('Interoperability source'), max_length=100, blank=True, editable=False)
    # code of first CC that indexed the record
    indexer_cc_code = models.CharField(_('Indexed by'), max_length=55, blank=True)

    # relations
    logs = GenericRelation(LogEntry)
    collection = GenericRelation(Relationship)

    def __init__(self, *args, **kwargs):
        super(Reference, self).__init__(*args, **kwargs)
        self.__track_fields = ['status']
        for field in self.__track_fields:
            setattr(self, '__original_%s' % field, getattr(self, field))

    def previous_value(self, field):
        orig = '__original_%s' % field
        return getattr(self, orig)

    def __unicode__(self):
        if 'a' in self.treatment_level:
            try:
                ref_child = ReferenceAnalytic.objects.get(id=self.pk)
                if self.literature_type[0] == 'S':
                    ref_title = u"{0}; {1} ({2}), {3} | {4}".format(ref_child.source.title_serial,
                                                                    ref_child.source.volume_serial,
                                                                    ref_child.source.issue_number,
                                                                    ref_child.source.publication_date_normalized[:4],
                                                                    ref_child.title[0]['text'])
                else:
                    ref_title = u"{0} | {1}".format(ref_child.source.title_monographic[0]['text'],
                                                    ref_child.title[0]['text'])
            except:
                # if errors in format dynamic title use raw reference_title field
                ref_title = self.reference_title
        else:
            ref_child = ReferenceSource.objects.get(id=self.pk)
            ref_title = ref_child.__unicode__()

        return ref_title

    def child_class(self):
        """
        Return the child class of the current instance (ex. for use in Content Type)
        """
        if 'a' in self.treatment_level:
            return ReferenceAnalytic
        else:
            return ReferenceSource

    def document_type(self):
        return "%s%s" % (self.literature_type, self.treatment_level)

    def has_duplicates(self):
        has_duplicates = ReferenceDuplicate.objects.filter(reference=self.pk).exists()

        return has_duplicates

    def get_content_type_id(self):
        if 'a' in self.treatment_level:
            ref_class = ReferenceAnalytic
        else:
            ref_class = ReferenceSource

        content_type=ContentType.objects.get_for_model(ref_class).pk

        return content_type
Esempio n. 7
0
class ReferenceSource(Reference):

    class Meta:
        verbose_name = _("Bibliographic Record Source")
        verbose_name_plural = _("Bibliographic Records Source")

    # field tags 16
    individual_author_monographic = JSONField(_('Individual author'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tag 17
    corporate_author_monographic = JSONField(_('Corporate author'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tags 18
    title_monographic = JSONField(_('Title'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tags 19
    english_title_monographic = models.CharField(_('English translated title'), max_length=400, blank=True)
    # field tag 20
    pages_monographic = models.CharField(_('Pages'), max_length=80, blank=True)
    # field tags 21
    volume_monographic = models.CharField(_('Volume'), max_length=100, blank=True)
    # field tags 23
    individual_author_collection = JSONField(_('Individual author'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tag 24
    corporate_author_collection = JSONField(_('Corporate author'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tags 25
    title_collection = JSONField(_('Title'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tags 26
    english_title_collection = models.CharField(_('English translated title'), max_length=250, blank=True)
    # field tags 27
    total_number_of_volumes = models.CharField(_('Total number of volumes'), max_length=10, blank=True)
    # field tags 30
    title_serial = models.TextField(_('Title'), blank=True)
    # field tags 31
    volume_serial = models.CharField(_('Volume'), max_length=100, blank=True)
    # field tags 32
    issue_number = models.CharField(_('Issue number'), max_length=80, blank=True)
    # field tags 35
    issn = models.CharField(_('ISSN'), max_length=40, blank=True)
    # field tag 49
    thesis_dissertation_leader = JSONField(_('Leader'), blank=True, null=True, dump_kwargs={'ensure_ascii': False})
    # field tag 50
    thesis_dissertation_institution = models.CharField(_('Institution to which it is submitted'), max_length=300, blank=True)
    # field tag 51
    thesis_dissertation_academic_title = models.CharField(_('Academic title'), max_length=250, blank=True)
    # field tag 62
    publisher = models.TextField(_('Publisher'), blank=True)
    # field tag 63
    edition = models.CharField(_('Edition'), max_length=150, blank=True)
    # field tag 66
    publication_city = models.CharField(_('City of publication'), max_length=100, blank=True)
    # field tag 67
    publication_country = models.ForeignKey(Country, verbose_name=_('Publication country'), blank=True, null=True)
    # field tag 68
    symbol = models.TextField(_('Symbol'), blank=True)
    # field tag 69
    isbn = models.CharField(_('ISBN'), max_length=60, blank=True)

    def __unicode__(self):
        source_title = ''
        if self.literature_type[0] == 'S':
            source_title = u"{0}; {1} ({2}), {3}".format(self.title_serial,
                                                         self.volume_serial,
                                                         self.issue_number,
                                                         self.publication_date_normalized[:4])
        else:
            if self.title_monographic:
                source_title = u"{0}".format(self.title_monographic[0]['text'])
            elif self.title_collection:
                source_title = u"{0}".format(self.title_collection[0]['text'])

        return source_title

    def has_analytic(self):
        exist_analytic = ReferenceAnalytic.objects.filter(source=self.pk).exists()

        return exist_analytic

    def count_analytic(self):
        count_analytic = ReferenceAnalytic.objects.filter(source=self.pk).count()

        return count_analytic
Esempio n. 8
0
class KineticFunctionalEvaluation(Form):
    class Meta:
        table_name = "forms_kinetic_functional_evaluation"

    class StructureAndFunctionTypes(enum.Flag):
        Goniometry = 1
        AshworthScale = 2
        SensoryEvaluation = 4
        RespiratoryMuscleStrength = 8
        Spirometry = 16
        PeakFlow = 32
        Ventilometry = 64
        PainEvaluation = 128
        MuscleStrength = 256
        Baropodometry = 512
        Electromyography = 1024
        Biophotogrammetry = 2048
        Dynamometry = 4096

        @classmethod
        def valid_string_values(cls):
            return {
                "Goniometria",
                "Escala de Ashworth",
                "Avaliação Sensorial",
                "Força Muscular Respiratória",
                "Espirometria",
                "Peak-Flow",
                "Ventilometria",
                "Avaliação da Dor",
                "Força Muscular",
                "Baropodometria",
                "Eletromiografia",
                "Biofotogrametria",
                "Dinamometria",
            }

        @classmethod
        def from_string(cls, string):
            convert_table = {
                "Goniometria": cls.Goniometry,
                "Escala de Ashworth": cls.AshworthScale,
                "Avaliação Sensorial": cls.SensoryEvaluation,
                "Força Muscular Respiratória": cls.RespiratoryMuscleStrength,
                "Espirometria": cls.Spirometry,
                "Peak-Flow": cls.PeakFlow,
                "Ventilometria": cls.Ventilometry,
                "Avaliação da Dor": cls.PainEvaluation,
                "Força Muscular": cls.MuscleStrength,
                "Baropodometria": cls.Baropodometry,
                "Eletromiografia": cls.Electromyography,
                "Biofotogrametria": cls.Biophotogrammetry,
                "Dinamometria": cls.Dynamometry,
            }
            return convert_table[string]

        @classmethod
        def to_string(cls, enum_item):
            convert_table = {
                cls.Goniometry: "Goniometria",
                cls.AshworthScale: "Escala de Ashworth",
                cls.SensoryEvaluation: "Avaliação Sensorial",
                cls.RespiratoryMuscleStrength: "Força Muscular Respiratória",
                cls.Spirometry: "Espirometria",
                cls.PeakFlow: "Peak-Flow",
                cls.Ventilometry: "Ventilometria",
                cls.PainEvaluation: "Avaliação da Dor",
                cls.MuscleStrength: "Força Muscular",
                cls.Baropodometry: "Baropodometria",
                cls.Electromyography: "Eletromiografia",
                cls.Biophotogrammetry: "Biofotogrametria",
                cls.Dynamometry: "Dinamometria",
            }
            return convert_table[enum_item]

    class ActivityAndParticipationTypes(enum.Flag):
        MarchEvaluation = 1
        SixMWalkTest = 2
        BergsBalanceScale = 4
        FunctionalScopeTest = 8
        TimeUpGo = 16
        ComfortableAndFastRunningSpeed = 32
        StepTest = 64
        QVCysticFibrosis = 128
        SF36 = 256
        WHODAS2 = 512
        MIF = 1024
        WOMAC = 2048
        DASH = 4096
        LondonScale = 8192
        EORCTQLQC30 = 16384
        SaintGeorge = 32768
        BarthelsScale = 65536

        @classmethod
        def valid_string_values(cls):
            return {
                "Avaliação de Marcha",
                "Teste de Caminhada 6M",
                "Escala de Equilíbrio de Berg",
                "Teste do Alcane Funcional",
                "Time Up Go (TUG)",
                "Velocidade de marcha confortável e rápida (10m)",
                "Teste do Degrau",
                "QV Fibrose Cística",
                "SF-36",
                "WHODAS 2.0",
                "MIF",
                "WOMAC",
                "DASH",
                "Escala London",
                "EORCT QLQ C-30",
                "Saint George",
                "Escala de Barthel",
            }

        @classmethod
        def from_string(cls, string):
            convert_table = {
                "Avaliação de Marcha": cls.MarchEvaluation,
                "Teste de Caminhada 6M": cls.SixMWalkTest,
                "Escala de Equilíbrio de Berg": cls.BergsBalanceScale,
                "Teste do Alcane Funcional": cls.FunctionalScopeTest,
                "Time Up Go (TUG)": cls.TimeUpGo,
                "Velocidade de marcha confortável e rápida (10m)":
                cls.ComfortableAndFastRunningSpeed,
                "Teste do Degrau": cls.StepTest,
                "QV Fibrose Cística": cls.QVCysticFibrosis,
                "SF-36": cls.SF36,
                "WHODAS 2.0": cls.WHODAS2,
                "MIF": cls.MIF,
                "WOMAC": cls.WOMAC,
                "DASH": cls.DASH,
                "Escala London": cls.LondonScale,
                "EORCT QLQ C-30": cls.EORCTQLQC30,
                "Saint George": cls.SaintGeorge,
                "Escala de Barthel": cls.BarthelsScale,
            }
            return convert_table[string]

        @classmethod
        def to_string(cls, enum_item):
            convert_table = {
                cls.MarchEvaluation: "Avaliação de Marcha",
                cls.SixMWalkTest: "Teste de Caminhada 6M",
                cls.BergsBalanceScale: "Escala de Equilíbrio de Berg",
                cls.FunctionalScopeTest: "Teste do Alcane Funcional",
                cls.TimeUpGo: "Time Up Go (TUG)",
                cls.ComfortableAndFastRunningSpeed:
                "Velocidade de marcha confortável e rápida (10m)",
                cls.StepTest: "Teste do Degrau",
                cls.QVCysticFibrosis: "QV Fibrose Cística",
                cls.SF36: "SF-36",
                cls.WHODAS2: "WHODAS 2.0",
                cls.MIF: "MIF",
                cls.WOMAC: "WOMAC",
                cls.DASH: "DASH",
                cls.LondonScale: "Escala London",
                cls.EORCTQLQC30: "EORCT QLQ C-30",
                cls.SaintGeorge: "Saint George",
                cls.BarthelsScale: "Escala de Barthel",
            }
            return convert_table[enum_item]

    #: Main and Functional Complaints.
    clinic_diagnostic = TextField()
    main_complaint = TextField()
    functional_complaint = TextField()

    #: Patient Clinical and Functional History.
    clinical_history = TextField()
    functional_history = TextField()

    #: Physical-Functional Tests Planning.
    structure_and_function = EnumField(StructureAndFunctionTypes,
                                       default=StructureAndFunctionTypes(0))
    activity_and_participation = EnumField(
        ActivityAndParticipationTypes,
        default=ActivityAndParticipationTypes(0))

    #: Physical-Functional Tests Results.
    physical_functional_tests_results = TextField(default=None, null=True)
    #: Complementary Exams Result.
    complementary_exams_results = TextField(default=None, null=True)

    #: Functional Kinetic Diagnosis.
    deficiency_diagnosis = TextField(default=None, null=True)
    activity_limitation_diagnosis = TextField(default=None, null=True)
    participation_restriction_diagnosis = TextField(default=None, null=True)
    environment_factors_diagnosis = TextField(default=None, null=True)
    functional_objectives_diagnosis = JSONField(default=None, null=True)
    therapeutic_plan_diagnosis = JSONField(default=None, null=True)

    reevaluation_dates = JSONField(default=None, null=True)

    #: Assessors.
    academic_assessor = CharField(default=None, null=True)
    preceptor_assessor = CharField(default=None, null=True)