# pyomop package

## Submodules

## pyomop.cdm6_tables module

Copyright (C) 2020 Bell Eapen

This file is part of PyOMOP.

PyOMOP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

PyOMOP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with PyOMOP. If not, see <http://www.gnu.org/licenses/>.

class pyomop.cdm6_tables.AttributeDefinition(**kwargs)

  Bases: `Base`

  attribute_definition_id
  attribute_description
  attribute_name
  attribute_syntax
  attribute_type_concept_id

class pyomop.cdm6_tables.CareSite(**kwargs)

  Bases: `Base`

  care_site_id
  care_site_name
  care_site_source_value
  location_id
  place_of_service_concept_id
  place_of_service_source_value

class pyomop.cdm6_tables.CdmSource(**kwargs)

  Bases: `Base`

  cdm_etl_reference
  cdm_holder
  cdm_release_date
  cdm_source_abbreviation
  cdm_source_name
  cdm_version
  source_description
  source_documentation_reference
  source_release_date
  vocabulary_version

class pyomop.cdm6_tables.Cohort(**kwargs)

  Bases: `Base`

  cohort_definition_id
  cohort_end_date
  cohort_start_date
  subject_id

class pyomop.cdm6_tables.CohortAttribute(**kwargs)

  Bases: `Base`

  attribute_definition_id
  cohort_definition_id
  cohort_end_date
  cohort_start_date
  subject_id
  value_as_concept_id
  value_as_number

class pyomop.cdm6_tables.CohortDefinition(**kwargs)

  Bases: `Base`

  cohort_definition_description
  cohort_definition_id
  cohort_definition_name
  cohort_definition_syntax
  cohort_initiation_date
  definition_type_concept_id
  subject_concept_id

class pyomop.cdm6_tables.Concept(**kwargs)

  Bases: `Base`

  concept_class_id
  concept_code
  concept_id
  concept_name
  domain_id
  invalid_reason
  standard_concept
  valid_end_date
  valid_start_date
  vocabulary_id

class pyomop.cdm6_tables.ConceptAncestor(**kwargs)

  Bases: `Base`

  ancestor_concept_id
  descendant_concept_id
  max_levels_of_separation
  min_levels_of_separation

class pyomop.cdm6_tables.ConceptClass(**kwargs)

  Bases: `Base`

  concept_class_concept_id
  concept_class_id
  concept_class_name

class pyomop.cdm6_tables.ConceptRelationship(**kwargs)

  Bases: `Base`

  concept_id_1
  concept_id_2
  invalid_reason
  relationship_id
  valid_end_date
  valid_start_date

class pyomop.cdm6_tables.ConceptSynonym(**kwargs)

  Bases: `Base`

  concept_id
  concept_synonym_name
  language_concept_id

class pyomop.cdm6_tables.ConditionEra(**kwargs)

  Bases: `Base`

  condition_concept_id
  condition_era_end_date
  condition_era_id
  condition_era_start_date
  condition_occurrence_count
  person_id

class pyomop.cdm6_tables.ConditionOccurrence(**kwargs)

  Bases: `Base`

  condition_concept_id
  condition_end_date
  condition_occurrence_id
  condition_source_concept_id
  condition_source_value
  condition_start_date
  condition_type_concept_id
  person_id
  provider_id
  stop_reason
  visit_occurrence_id

class pyomop.cdm6_tables.Death(**kwargs)

  Bases: `Base`

  cause_concept_id
  cause_source_concept_id
  cause_source_value
  death_date
  death_type_concept_id
  person_id

class pyomop.cdm6_tables.DeviceCost(**kwargs)

  Bases: `Base`

  currency_concept_id
  device_cost_id
  device_exposure_id
  paid_by_coordination_benefits
  paid_by_payer
  paid_coinsurance
  paid_copay
  paid_toward_deductible
  payer_plan_period_id
  total_out_of_pocket
  total_paid

class pyomop.cdm6_tables.DeviceExposure(**kwargs)

  Bases: `Base`

  device_concept_id
  device_exposure_end_date
  device_exposure_id
  device_exposure_start_date
  device_source_concept_id
  device_source_value
  device_type_concept_id
  person_id
  provider_id
  quantity
  unique_device_id
  visit_occurrence_id

class pyomop.cdm6_tables.Domain(**kwargs)

  Bases: `Base`

  domain_concept_id
  domain_id
  domain_name

class pyomop.cdm6_tables.DoseEra(**kwargs)

  Bases: `Base`

  dose_era_end_date
  dose_era_id
  dose_era_start_date
  dose_value
  drug_concept_id
  person_id
  unit_concept_id

class pyomop.cdm6_tables.DrugCost(**kwargs)

  Bases: `Base`

  average_wholesale_price
  currency_concept_id
  dispensing_fee
  drug_cost_id
  drug_exposure_id
  ingredient_cost
  paid_by_coordination_benefits
  paid_by_payer
  paid_coinsurance
  paid_copay
  paid_toward_deductible
  payer_plan_period_id
  total_out_of_pocket
  total_paid

class pyomop.cdm6_tables.DrugEra(**kwargs)

  Bases: `Base`

  drug_concept_id
  drug_era_end_date
  drug_era_id
  drug_era_start_date
  drug_exposure_count
  gap_days
  person_id

class pyomop.cdm6_tables.DrugExposure(**kwargs)

  Bases: `Base`

  days_supply
  dose_unit_concept_id
  dose_unit_source_value
  drug_concept_id
  drug_exposure_end_date
  drug_exposure_id
  drug_exposure_start_date
  drug_source_concept_id
  drug_source_value
  drug_type_concept_id
  effective_drug_dose
  lot_number
  person_id
  provider_id
  quantity
  refills
  route_concept_id
  route_source_value
  sig
  stop_reason
  visit_occurrence_id

class pyomop.cdm6_tables.DrugStrength(**kwargs)

  Bases: `Base`

  amount_unit_concept_id
  amount_value
  box_size
  denominator_unit_concept_id
  denominator_value
  drug_concept_id
  ingredient_concept_id
  invalid_reason
  numerator_unit_concept_id
  numerator_value
  valid_end_date
  valid_start_date

class pyomop.cdm6_tables.FactRelationship(**kwargs)

  Bases: `Base`

  domain_concept_id_1
  domain_concept_id_2
  fact_id_1
  fact_id_2
  relationship_concept_id

class pyomop.cdm6_tables.Location(**kwargs)

  Bases: `Base`

  address_1
  address_2
  city
  county
  location_id
  location_source_value
  state
  zip

class pyomop.cdm6_tables.Measurement(**kwargs)

  Bases: `Base`

  measurement_concept_id
  measurement_date
  measurement_id
  measurement_source_concept_id
  measurement_source_value
  measurement_time
  measurement_type_concept_id
  operator_concept_id
  person_id
  provider_id
  range_high
  range_low
  unit_concept_id
  unit_source_value
  value_as_concept_id
  value_as_number
  value_source_value
  visit_occurrence_id

class pyomop.cdm6_tables.Note(**kwargs)

  Bases: `Base`

  note_date
  note_id
  note_source_value
  note_text
  note_time
  note_type_concept_id
  person_id
  provider_id
  visit_occurrence_id

class pyomop.cdm6_tables.Observation(**kwargs)

  Bases: `Base`

  observation_concept_id
  observation_date
  observation_id
  observation_source_concept_id
  observation_source_value
  observation_time
  observation_type_concept_id
  person_id
  provider_id
  qualifier_concept_id
  qualifier_source_value
  unit_concept_id
  unit_source_value
  value_as_concept_id
  value_as_number
  value_as_string
  visit_occurrence_id

class pyomop.cdm6_tables.ObservationPeriod(**kwargs)

  Bases: `Base`

  observation_period_end_date
  observation_period_id
  observation_period_start_date
  period_type_concept_id
  person_id

class pyomop.cdm6_tables.PayerPlanPeriod(**kwargs)

  Bases: `Base`

  family_source_value
  payer_plan_period_end_date
  payer_plan_period_id
  payer_plan_period_start_date
  payer_source_value
  person_id
  plan_source_value

class pyomop.cdm6_tables.Person(**kwargs)

  Bases: `Base`

  birth_datetime
  care_site_id
  day_of_birth
  death_datetime
  ethnicity_concept_id
  ethnicity_source_concept_id
  ethnicity_source_value
  gender_concept_id
  gender_source_concept_id
  gender_source_value
  location_id
  month_of_birth
  person_id
  person_source_value
  provider_id
  race_concept_id
  race_source_concept_id
  race_source_value
  year_of_birth

class pyomop.cdm6_tables.ProcedureCost(**kwargs)

  Bases: `Base`

  currency_concept_id
  paid_by_coordination_benefits
  paid_by_payer
  paid_coinsurance
  paid_copay
  paid_toward_deductible
  payer_plan_period_id
  procedure_cost_id
  procedure_occurrence_id
  revenue_code_concept_id
  revenue_code_source_value
  total_out_of_pocket
  total_paid

class pyomop.cdm6_tables.ProcedureOccurrence(**kwargs)

  Bases: `Base`

  modifier_concept_id
  person_id
  procedure_concept_id
  procedure_date
  procedure_occurrence_id
  procedure_source_concept_id
  procedure_source_value
  procedure_type_concept_id
  provider_id
  qualifier_source_value
  quantity
  visit_occurrence_id

class pyomop.cdm6_tables.Provider(**kwargs)

  Bases: `Base`

  care_site_id
  dea
  gender_concept_id
  gender_source_concept_id
  gender_source_value
  npi
  provider_id
  provider_name
  provider_source_value
  specialty_concept_id
  specialty_source_concept_id
  specialty_source_value
  year_of_birth

class pyomop.cdm6_tables.Relationship(**kwargs)

  Bases: `Base`

  defines_ancestry
  is_hierarchical
  relationship_concept_id
  relationship_id
  relationship_name
  reverse_relationship_id

class pyomop.cdm6_tables.SourceToConceptMap(**kwargs)

  Bases: `Base`

  invalid_reason
  source_code
  source_code_description
  source_concept_id
  source_vocabulary_id
  target_concept_id
  target_vocabulary_id
  valid_end_date
  valid_start_date

class pyomop.cdm6_tables.Speciman(**kwargs)

  Bases: `Base`

  anatomic_site_concept_id
  anatomic_site_source_value
  disease_status_concept_id
  disease_status_source_value
  person_id
  quantity
  specimen_concept_id
  specimen_date
  specimen_id
  specimen_source_id
  specimen_source_value
  specimen_time
  specimen_type_concept_id
  unit_concept_id
  unit_source_value

class pyomop.cdm6_tables.VisitCost(**kwargs)

  Bases: `Base`

  currency_concept_id
  paid_by_coordination_benefits
  paid_by_payer
  paid_coinsurance
  paid_copay
  paid_toward_deductible
  payer_plan_period_id
  total_out_of_pocket
  total_paid
  visit_cost_id
  visit_occurrence_id

class pyomop.cdm6_tables.VisitOccurrence(**kwargs)

  Bases: `Base`

  care_site_id
  person_id
  provider_id
  visit_concept_id
  visit_end_date
  visit_end_time
  visit_occurrence_id
  visit_source_concept_id
  visit_source_value
  visit_start_date
  visit_start_time
  visit_type_concept_id

class pyomop.cdm6_tables.Vocabulary(**kwargs)

  Bases: `Base`

  vocabulary_concept_id
  vocabulary_id
  vocabulary_name
  vocabulary_reference
  vocabulary_version

## pyomop.engine_factory module

class pyomop.engine_factory.CdmEngineFactory(db='sqlite', host='localhost', port=5432, user='root', pw='pass', name='cdm6.sqlite', schema='public')

  Bases: `object`

  property async_session
  property base
  property db
  property engine
  property host
  async init_models(metadata)
  property name
  property port
  property pw
  property schema
  property session
  property user

## pyomop.main module

pyomop.main.main_routine()

## pyomop.sqldict module

## pyomop.vector module

class pyomop.vector.CdmVector(result=None)

  Bases: `object`

  create_df(_names=None)
  property df
  query_to_list()

    List of result Return: columns name, list of result

  property result
  async sql_df(cdm, sqldict=None, query=None, chunksize=1000)

## pyomop.vocabulary module

class pyomop.vocabulary.CdmVocabulary(cdm)

  Bases: `object`

  property concept_code
  property concept_id
  property concept_name
  create_vocab(folder, sample=None)
  property domain_id
  async get_concept(concept_id)
  async get_concept_by_code(concept_code, vocabulary_id)
  get_session() → AsyncGenerator[AsyncSession, None]
  set_concept(concept_code, vocabulary_id=None)
  property vocabulary_id
  async write_vocab(df, table, if_exists='replace', chunk_size=1000)

## Module contents