Esempio n. 1
0
from enum import Enum as BuitinEnum
from enum import auto

from sqlalchemy import Column, Enum
from sqlalchemy.orm import relationship

from provider.models.base import Base, make_join_table

provider_method_table = make_join_table("provider", "payment_method")


class PaymentMethodType(BuitinEnum):
    cash = auto()
    check = auto()
    wire = auto()
    ach = auto()

    hsa = auto()

    amex = auto()
    discover = auto()
    mastercard = auto()
    visa = auto()

    paypal = auto()
    venmo = auto()
    apple = auto()
    android = auto()


class PaymentMethod(Base):
from sqlalchemy import String, Column, Integer
from sqlalchemy.orm import relationship

from provider.models.base import Base, make_join_table

provider_directory_table = make_join_table("provider", "directory")


class Directory(Base):
    """

    """

    #
    name = Column(String(64), nullable=False)

    #
    short_name = Column(String(32), nullable=False)

    #
    record_limit = Column(Integer)

    providers = relationship("Provider",
                             secondary=provider_directory_table,
                             back_populates="directories")
Esempio n. 3
0
from sqlalchemy import String, Column, Integer, ForeignKey
from sqlalchemy.orm import relationship

from provider.models.base import Base, make_join_table
from provider.models.payors import Payor

provider_plan_table = make_join_table("provider", "plan")


class Plan(Base):
    """
        t.integer "payor_id", null: false
        t.string "name", null: false
        t.text "url", null: false
        t.integer "record_limit"
        t.datetime "created_at", null: false
        t.datetime "updated_at", null: false
        t.string "original_code"
    """

    payor_id = Column(Integer, ForeignKey("payor.id"), nullable=False)

    payor = relationship(Payor)

    #
    name = Column(String(128), nullable=False)

    #
    url = Column(String(2048), nullable=False)

    #
Esempio n. 4
0
from sqlalchemy import Column, String
from sqlalchemy.orm import relationship

from provider.models.base import Base, make_join_table

provider_modality_table = make_join_table("provider", "modality")


class Modality(Base):
    """
    What sort of patients (couples, individuals, families, etc.)
    """
    name = Column(String(64), unique=True, index=True)

    providers = relationship("Provider",
                             secondary=provider_modality_table,
                             back_populates="modalities")
Esempio n. 5
0
from sqlalchemy import Column, Text, Index
from sqlalchemy.dialects.postgresql import TSVECTOR
from sqlalchemy.orm import relationship

from provider.models.base import Base, make_join_table

provider_apc_table = make_join_table("provider", "acceptedpayorcomment")


class AcceptedPayorComment(Base):
    body = Column(Text(), nullable=False, unique=True, index=True)

    tsv = Column(TSVECTOR)

    providers = relationship("Provider",
                             secondary=provider_apc_table,
                             back_populates="accepted_payor_comments")


Index('ix_monday_acceptedpayorcomment_body_gin',
      AcceptedPayorComment.tsv,
      postgresql_using="gin")
Esempio n. 6
0
from sqlalchemy import Column, Text, Index
from sqlalchemy.dialects.postgresql import TSVECTOR
from sqlalchemy.orm import relationship

from provider.models.base import Base, make_join_table

provider_orientation_table = make_join_table("provider", "orientation")


class Orientation(Base):
    """
    The way a providers practice is "oriented," that is, do they offer CBT,
    psychotherapy, etc.
    """
    body = Column(Text(), nullable=False, unique=True, index=True)

    tsv = Column(TSVECTOR)

    providers = relationship("Provider",
                             secondary=provider_orientation_table,
                             back_populates="treatment_orientations")


Index('ix_monday_orientation_body_gin',
      Orientation.tsv,
      postgresql_using="gin")

Esempio n. 7
0
from sqlalchemy import Column, String, UniqueConstraint, Enum
from sqlalchemy.orm import relationship

from fixtures.academic_degrees import EducationLevel
from provider.models.base import Base, make_join_table

provider_degree_table = make_join_table("provider", "degree")


class Degree(Base):
    acronym = Column(String(16), unique=True, nullable=False)
    name = Column(String(), nullable=False)
    level = Column(Enum(EducationLevel), nullable=False)

    providers = relationship("Provider",
                             secondary=provider_degree_table,
                             back_populates="degrees")


UniqueConstraint(Degree.acronym, Degree.name)
UniqueConstraint(Degree.acronym, Degree.level)
Esempio n. 8
0
from sqlalchemy import Column, Text, Index
from sqlalchemy.dialects.postgresql import TSVECTOR
from sqlalchemy.orm import relationship

from provider.models.base import Base, make_join_table

provider_group_table = make_join_table("provider", "group")


class Group(Base):
    """
    A cohort of people. E.g.: TBI sufferers, gay people, religious people, etc.
    """
    body = Column(Text(), nullable=False, unique=True, index=True)

    tsv = Column(TSVECTOR)

    providers = relationship("Provider",
                             secondary=provider_group_table,
                             back_populates="groups")


Index('ix_monday_group_body_gin', Group.tsv, postgresql_using="gin")
Esempio n. 9
0
from sqlalchemy import Column, Integer, Index, Boolean
from sqlalchemy.orm import relationship

from provider.models.address import phone_address_table
from provider.models.base import Base, make_join_table

provider_phone_table = make_join_table("provider", "phone")


class Phone(Base):
    """ A phone number that is strictly typed. """
    # Numbering plan area code
    npa = Column(Integer(), nullable=False)

    # Central office (exchange) code
    nxx = Column(Integer(), nullable=False)

    # Subscriber number or station code
    xxxx = Column(Integer(), nullable=False)

    # Extension
    extension = Column(Integer())

    directory = Column(Integer())

    providers = relationship("Provider",
                             secondary=provider_phone_table,
                             back_populates="phone_numbers")

    addresses = relationship("Address",
                             secondary=phone_address_table,
Esempio n. 10
0
from sqlalchemy import Column, String
from sqlalchemy.orm import relationship

from provider.models.base import Base, make_join_table

provider_language_table = make_join_table("provider", "language")


class Language(Base):
    iso = Column(String(3), nullable=False, index=True, unique=True)

    name = Column(String(64), nullable=False, index=True, unique=True)

    providers = relationship("Provider",
                             secondary=provider_language_table,
                             back_populates="languages")
Esempio n. 11
0
from sqlalchemy import String, Column
from sqlalchemy.orm import relationship

from provider.models.base import Base, make_join_table

provider_credential_table = make_join_table("provider", "credential")


class Credential(Base):
    """
    A non-state license, certification, or registration.
    """
    full_name = Column(String(128), unique=True, nullable=False)

    acronym = Column(String(16), index=True, unique=True)

    providers = relationship("Provider", secondary=provider_credential_table,
                             back_populates="credentials")
Esempio n. 12
0
from geoalchemy2 import Geometry
from sqlalchemy import Column, String, JSON, Index, Integer
from sqlalchemy.dialects.postgresql import TSVECTOR
from sqlalchemy.orm import relationship

from provider.models.base import Base, make_join_table

provider_address_table = make_join_table("provider", "address")

phone_address_table = make_join_table("phone", "address")


class Address(Base):
    """
    Store raw addresses as entered, and google geocoding api responses
    """
    raw = Column(String(), index=True, unique=True)

    formatted = Column(String(), index=True)

    formatted_tsv = Column(TSVECTOR)

    geocoding_api_response = Column(JSON())

    directory_id = Column(Integer(), index=True)

    point = Column(Geometry)

    zip_code = Column(Integer(), index=True)

    providers = relationship("Provider",
Esempio n. 13
0
from sqlalchemy import Column, String
from sqlalchemy.orm import relationship

from provider.models.base import make_join_table, Base

provider_speciality_table = make_join_table("provider", "specialty")


class Specialty(Base):
    """
      create_table "specialties", force: :cascade do |t|
        t.string "name", null: false
        t.datetime "created_at", null: false
        t.datetime "updated_at", null: false
        t.boolean "is_canonical", default: false, null: false
        t.integer "alias_id"
        t.index ["name"], name: "index_specialties_on_name", unique: true
      end
    """

    name = Column(String(64), nullable=False)

    providers = relationship("Provider",
                             secondary=provider_speciality_table,
                             back_populates="specialties")

    def __str__(self) -> str:
        return self.name

    def __repr__(self) -> str:
        return "{} ({})".format(self.name, self.id)