Ejemplo n.º 1
0
    def __init__(
            self,
            run_date: datetime
    ):

        from collections import defaultdict
        from sortedcontainers import SortedList
        from db.mongo import connector

        self.run_date = run_date
        self.member: Member
        self.enrollments = SortedList([Enrollment])
        self.visits = SortedList([Visit])
        self.pharm = None
        self.mmdf: [MMDF] = []
        self.age_eligibility = False
        self.ce_eligibility = False
        self.enrolled_in_snp = False
        self.required_exclusion = False
        self.long_term_institution = False
        self.gaps_in_care = False
        self.frailty = False
        self.advanced_illness = False
        self.anchor_date_eligibility = False
        self.on_dementia_meds = False
        self.bilateral_mastectomy = False
        self.optional_exclusions = False
        self.overlapping_enrollments = defaultdict(list)
        self.db_conn = connector.Connector()
Ejemplo n.º 2
0
def load_sample_file(
        params: dict
):
    db_connection = connector.Connector()
    db_connection.collection_name = params['TableName']
    df = pd.read_csv(params['Filename'])

    for _, row in df.iterrows():
        member_id = row['MemID']
        measure = row['Meas']
        payer = row['Payer']
        eligible_population = row['Epop']
        exclusion = row['Excl']
        numerator = row['Num']
        required_exclusion = row['RExcl']
        indicator = row['Ind']

        sample_data = {
            'MemberId': member_id,
            'Measure': measure,
            'Payer': payer,
            'EligiblePopulation': eligible_population,
            'Exclusion': exclusion,
            'Numerator': numerator,
            'RequiredExclusion': required_exclusion,
            'Indicator': indicator
        }

        db_connection.insert(sample_data)
Ejemplo n.º 3
0
 def __init__(self):
     self.log = natus_logging.NATUSLogging(self.__class__.__name__,
                                           logging.INFO)
     self.config = natus_config.NATUSConfig('ncqa')
     self.db_con = connector.Connector()
     self.member_filter = {}
     #        self.load_filter()
     self.value_set_cache = {}
Ejemplo n.º 4
0
 def __init__(self):
     self.log = natus_logging.NATUSLogging(self.__class__.__name__,
                                           logging.INFO)
     self.config = natus_config.NATUSConfig('ncqa')
     self.db_connection = connector.Connector()
     self.bulk_size = self.config.read_value('load', 'bulk.size')
     self.input_file_name = self.config.read_value('load', 'input.filename')
     self.documents = []
Ejemplo n.º 5
0
 def __init__(self):
     self.log = natus_logging.NATUSLogging(self.__class__.__name__,
                                           logging.INFO)
     self.config = natus_config.NATUSConfig('ncqa')
     self.db_con = connector.Connector()
     self.db_con.collection_name = 'measure_to_oid'
     self.excel_sheetname = self.config.read_value(
         'valueset', 'excel.measures.valuesets.sheet.name')
     self.excel_filename = self.config.read_value('valueset',
                                                  'excel.filename')
Ejemplo n.º 6
0
 def __init__(self, run_date: datetime):
     config = natus_config.NATUSConfig('ncqa')
     config_section_name = self.__class__.__name__
     self.log = natus_logging.NATUSLogging(config_section_name,
                                           logging.INFO)
     self.run_date = run_date
     measures = json.loads(
         config.read_value(config_section_name, 'measures'))
     self.db_con = connector.Connector()
     self.measure_pipeline = self.init_measures(measures)
Ejemplo n.º 7
0
 def __init__(self):
     self.log = natus_logging.NATUSLogging(self.__class__.__name__,
                                           logging.INFO)
     self.config = natus_config.NATUSConfig('ncqa')
     self.db_con = connector.Connector()
     self.db_con.collection_name = 'code_to_description'
     self.excel_sheetname = self.config.read_value('valueset',
                                                   'excel.sheetname')
     self.excel_filename = self.config.read_value('valueset',
                                                  'excel.filename')
     self.cpt_input_file = self.config.read_value('cms', 'cpt_input_file')
Ejemplo n.º 8
0
def vs_to_codes():
    from util import natus_config
    import pandas as pd
    from model.code import Code
    from model.valueset import ValueSet
    from db.mongo import connector
    import json

    config = natus_config.NATUSConfig('ncqa')
    excel_filename = config.read_value('valueset', 'excel_filename')
    sheet_name = config.read_value('valueset', 'excel_sheet_name')

    print('Reading ' + excel_filename)
    df = pd.read_excel(
        excel_filename,
        sheet_name=sheet_name
    )

    print('Processing ' + sheet_name)
    value_set_info = None
    codes_processed = set()
    db_con = connector.Connector()

    for index, row in df.iterrows():
        vs_name = row['Value Set Name']
        code = row['Code']
        code_system = row['Code System']
        code_system_oid = row['Code System OID']
        code_info = Code(code, code_system, code_system_oid)
        if vs_name not in codes_processed:
            if len(codes_processed) > 0:
                db_con.insert(vars(value_set_info), 'vs_to_codes')
            codes_processed.add(vs_name)
            vs_oid = row['Value Set OID']
            value_set_info = ValueSet(vs_name, vs_oid, [vars(code_info)])
        else:
            value_set_info.codes.append(vars(code_info))
Ejemplo n.º 9
0
 def __init__(self):
     self.log = natus_logging.NATUSLogging(__class__.__name__, logging.INFO)
     self.config = natus_config.NATUSConfig('ncqa')
     self.db_con = connector.Connector()
     self.input_filename = self.config.read_value('ndc',
                                                  'input.csv.filename')