def load_definitions(sess, force_tas_load, ruleList=None): """Load file definitions.""" validator_config_path = os.path.join(CONFIG_BROKER["path"], "dataactvalidator", "config") integration_test_data_path = os.path.join(CONFIG_BROKER["path"], "tests", "integration", "data") SchemaLoader.loadAllFromPath(validator_config_path) SQLLoader.loadSql("sqlRules.csv") if ruleList is not None: # If rule list provided, drop all other rules sess.query(RuleSql).filter(not_( RuleSql.rule_label.in_(ruleList))).delete( synchronize_session='fetch') sess.commit() # Load domain values tables loadDomainValues( validator_config_path, os.path.join(integration_test_data_path, "program_activity.csv")) if sess.query(TASLookup).count() == 0 or force_tas_load: # TAS table is empty, load it loadTas(tasFile=os.path.join(integration_test_data_path, "cars_tas.csv")) # Load test SF-133 load_all_sf133(integration_test_data_path)
def load_validator_schema(): """Load file-level .csv schemas into the broker database.""" logger.info('Loading validator schemas') SchemaLoader.loadAllFromPath(validator_config_path)
def loadValidator(): """Load validator fields and rules from config.""" basePath = CONFIG_BROKER["path"] validator_config_path = os.path.join(basePath, "dataactvalidator", "config") SchemaLoader.loadAllFromPath(validator_config_path)