def on_worker_init(**_):
    global bots
    global friendly_bots
    log.info("Loading the robots...")

    # pico span bot must be loaded first i have *no* idea why...
    print("LOADING ROBOTS")
    bots = {
        "pico_span_bot": PICOSpanRobot(),
        "bias_bot": BiasRobot(top_k=3),
        "pico_bot": PICORobot(),
        "pubmed_bot": PubmedRobot(),
        # "ictrp_bot": ICTRPRobot(),
        "rct_bot": RCTRobot(),
        #"pico_viz_bot": PICOVizRobot(),
        "punchline_bot": PunchlinesBot(),
        "sample_size_bot": SampleSizeBot(),
        "bias_ab_bot": BiasAbRobot()
    }

    friendly_bots = {
        "pico_span_bot": "Extracting PICO text from title/abstract",
        "bias_bot": "Assessing risks of bias",
        "pico_bot": "Extracting PICO information from full text",
        "rct_bot": "Assessing study design (is it an RCT?)",
        "sample_size_bot": "Extracting sample size",
        "punchline_bot": "Extracting main conclusions",
        "pubmed_bot": "Looking up meta-data in PubMed",
        "bias_ab_bot": "Assessing bias from abstract"
    }

    print("ROBOTS ALL LOADED")
    log.info("Robots loaded successfully! Ready...")
Пример #2
0
def on_worker_init(**_):
    global bots
    log.info("Loading the robots...")
    bots = {
        "bias_bot": BiasRobot(top_k=3),
        "pico_bot": PICORobot(),
        "pubmed_bot": PubmedRobot(),
        # "ictrp_bot": ICTRPRobot(),
        "rct_bot": RCTRobot(),
        #"pico_viz_bot": PICOVizRobot(),
        "sample_size_bot": SampleSizeBot()
    }

    log.info("Robots loaded successfully! Ready...")
Пример #3
0
class TestPubmedRobot(unittest.TestCase):

    pr = PubmedRobot()
    ex_file = ex_path + "pubmedtest.json"

    def test_annotate(self):
        ''' test for PubmedRobot.annotate(data) '''
        md = MultiDict()
        with open(self.ex_file) as testdata:
            data = json.load(testdata)
        test = data["annotate"]
        md.data["gold"]["title"] = data["title"]
        out = self.pr.annotate(md)
        self.assertEqual(out.data["pubmed"], test)

    def test_query_pubmed(self):
        ''' test for PubmedRobot.query_pubmed(pmid) '''
        with open(self.ex_file) as testdata:
            data = json.load(testdata)
        pmid = data["pmid"]
        q = self.pr.query_pubmed(pmid)
        with open(os.path.dirname(__file__) + "/ex/query.json") as f:
            query = json.load(f)
        self.assertEqual(q, query)

    def test_short_citation(self):
        ''' test for PubmedRobot.short_citation(data) '''
        data = {
            "authors": [{
                "lastname": "Bellman",
                "initials": "R"
            }, {
                "lastname": "Ford",
                "initials": "L"
            }],
            "year":
            1958
        }
        short_cite = self.pr.short_citation(data)
        self.assertEqual(short_cite, "Bellman R, 1958")
Пример #4
0
app.secret_key = os.environ.get("SECRET", "super secret key")
# setting max file upload size 100 mbs
app.config['MAX_CONTENT_LENGTH'] = 100 * 1024 * 1024

csrf = CsrfProtect()
csrf.init_app(app)

######
## default annotation pipeline defined here
######
log.info("Loading the robots...")
bots = {
    "bias_bot": BiasRobot(top_k=3),
    "pico_bot": PICORobot(),
    "pubmed_bot": PubmedRobot(),
    # "ictrp_bot": ICTRPRobot(),
    "rct_bot": RCTRobot(),
    "pico_viz_bot": PICOVizRobot()
}
# "mendeley_bot": MendeleyRobot()}

log.info("Robots loaded successfully! Ready...")

#####
## connect to and set up database
#####
rr_sql_conn = sqlite3.connect(
    robotreviewer.get_data('uploaded_pdfs/uploaded_pdfs.sqlite'),
    detect_types=sqlite3.PARSE_DECLTYPES)
c = rr_sql_conn.cursor()