-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.py
50 lines (42 loc) · 1.6 KB
/
upload.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import biothings.hub.dataload.uploader
import os
import requests
import biothings
import config
biothings.config_for_app(config)
MAP_URL = "https://raw.githubusercontent.com/SuLab/outbreak.info-resources/master/outbreak_resources_es_mapping.json"
MAP_VARS = ["@type", "author", "isBasedOn", "curatedBy", "citedBy", "identifier", "keywords", "evaluations"]
# when code is exported, import becomes relative
try:
from covid19_LST_parser.parser import load_annotations as parser_func
except ImportError:
from .parser import load_annotations as parser_func
class LSTUploader(biothings.hub.dataload.uploader.BaseSourceUploader):
main_source="litcovid"
name = "covid19_LST_annotations"
__metadata__ = {
"src_meta": {
"author":{
"name": "Ginger Tsueng",
"url": "https://github.com/gtsueng"
},
"code":{
"branch": "master",
"repo": "https://github.com/gtsueng/covid19_LST_annotations.git"
},
"url": "https://www.covid19lst.org/",
"license": "https://creativecommons.org/licenses/by-nc-sa/4.0/"
}
}
idconverter = None
storage_class = biothings.hub.dataload.storage.BasicStorage
def load_data(self, data_folder):
self.logger.info("No data to load from file for COVID19-LST")
return parser_func()
@classmethod
def get_mapping(klass):
r = requests.get(MAP_URL)
if(r.status_code == 200):
mapping = r.json()
mapping_dict = { key: mapping[key] for key in MAP_VARS }
return mapping_dict