def load_config(args): if args.config_file: cfg = import_config(fname_config_file=args.config_file) elif "PUBMED_INGESTER_CONFIG" in os.environ: fname_config_file = os.environ["PUBMED_INGESTER_CONFIG"] cfg = import_config(fname_config_file=fname_config_file) else: msg_fmt = "Configuration file path not defined." raise ValueError(msg_fmt) return cfg
def setUp(self): """Instantiates the DAL and creates the schema.""" # Load the configuration. self.cfg = import_config( fname_config_file="/etc/pubmed-ingester/pubmed-ingester-test.json", ) self.dal = DalPubmed(sql_username=self.cfg.sql_username, sql_password=self.cfg.sql_password, sql_host=self.cfg.sql_host, sql_port=self.cfg.sql_port, sql_db=self.cfg.sql_db) self.ingester = IngesterDocumentPubmedArticle(dal=self.dal) self.parser = ParserXmlPubmedArticle() # Drop any schema remnants and recreate it. Base.metadata.drop_all(self.dal.engine) Base.metadata.create_all(self.dal.engine)
postal_code_suffix=_get_address_component_name( components, ("postal_code_suffix", )), postal_town=_get_address_component_name( components, ("postal_town", )), premise=_get_address_component_name( components, ("premise", )), subpremise=_get_address_component_name( components, ("subpremise", )), route=_get_address_component_name(components, ("route", )), street_address=_get_address_component_name( components, ("street_address", )), street_number=_get_address_component_name( components, ("street_number", )), ) if __name__ == '__main__': cfg = import_config("/etc/pubmed-ingester/pubmed-ingester-dev.json") dal = DalPubmed( sql_username=cfg.sql_username, sql_password=cfg.sql_password, sql_host="192.168.0.12", sql_port=cfg.sql_port, sql_db=cfg.sql_db, ) retriever = RetrieverGoogleMaps(api_key=api_keys[1]) populate()