Revision 59794
Added by Sandro La Bruzzo about 4 years ago
modules/dli-service-portal/branches/ES_7/eu/dnetlib/es_connector.py | ||
---|---|---|
36 | 36 |
"bioproject": "http://www.ncbi.nlm.nih.gov/nucest/%s?report=genbank", |
37 | 37 |
"embl": "http://www.ncbi.nlm.nih.gov/nucest/%s?report=genbank", |
38 | 38 |
"sra": "http://www.ncbi.nlm.nih.gov/nucest/%s?report=genbank", |
39 |
"url": "%s" |
|
39 | 40 |
} |
40 | 41 |
|
41 | 42 |
|
... | ... | |
204 | 205 |
hits = [] |
205 | 206 |
|
206 | 207 |
for index_result in response.hits: |
207 |
input_source = index_result.__dict__['_d_'] |
|
208 |
|
|
209 |
fixed_titles = [] |
|
210 |
|
|
208 |
input_source = index_result.__dict__['_d_'] |
|
209 |
fixed_titles = [] |
|
211 | 210 |
for ids in input_source.get('localIdentifier', []): |
212 | 211 |
ds = resolveIdentifier(ids['id'], ids['type']) |
213 | 212 |
ids['url'] = ds |
214 |
for t in input_source.get('title', []): |
|
215 |
if len(t) > 0 and t[0] == '"' and t[-1] == '"': |
|
216 |
fixed_titles.append(t[1:-1]) |
|
217 |
else: |
|
218 |
fixed_titles.append(t) |
|
213 |
|
|
214 |
if input_source.get('title', []) is not None: |
|
215 |
for t in input_source.get('title', []): |
|
216 |
if len(t) > 0 and t[0] == '"' and t[-1] == '"': |
|
217 |
fixed_titles.append(t[1:-1]) |
|
218 |
else: |
|
219 |
fixed_titles.append(t) |
|
220 |
else: |
|
221 |
fixed_titles.append("title not available") |
|
219 | 222 |
input_source['title'] = fixed_titles |
220 | 223 |
hits.append(input_source) |
221 |
|
|
224 |
|
|
222 | 225 |
pid_types = [] |
223 | 226 |
for tag in response.aggs.all_pids.all_types.buckets: |
224 | 227 |
pid_types.append(dict(key=tag.key, count=tag.doc_count)) |
... | ... | |
248 | 251 |
s = Search(using=self.client).index(self.index_name+"_scholix").query(query_for_id & query_type) |
249 | 252 |
if start: |
250 | 253 |
s = s[start:start + 10] |
251 |
|
|
254 |
|
|
252 | 255 |
response = s.execute() |
253 | 256 |
hits = [] |
254 |
|
|
255 | 257 |
for index_hit in response.hits: |
256 | 258 |
current_item = index_hit.__dict__['_d_'] |
257 | 259 |
if 'target' in current_item: |
... | ... | |
295 | 297 |
ids['url'] = ds |
296 | 298 |
related_publications = [] |
297 | 299 |
related_dataset = [] |
298 |
related_unknown = [] |
|
300 |
related_unknown = []
|
|
299 | 301 |
|
300 | 302 |
rel_source = None |
301 | 303 |
if input_source.get('relatedPublications') > 0: |
... | ... | |
307 | 309 |
rel_source = related_publications[0] |
308 | 310 |
else: |
309 | 311 |
rel_source = {} |
312 |
|
|
313 |
|
|
314 |
|
|
310 | 315 |
if input_source.get('relatedDatasets') > 0: |
311 | 316 |
if 'dataset' == type: |
312 | 317 |
related_dataset = self.related_type(id, 'dataset', start) |
... | ... | |
330 | 335 |
except Exception as e: |
331 | 336 |
log.error("Error on getting item ") |
332 | 337 |
log.error(e) |
333 |
#log.error("on line %i" % sys.exc_info)
|
|
338 |
log.error("on line %i" % sys.exc_info) |
|
334 | 339 |
return DLIESResponse() |
Also available in: Unified diff
fixed null title