linkml / schema-automator

Automated assistance for the schema development lifecycle
https://linkml.io/schema-automator/
BSD 3-Clause "New" or "Revised" License
34 stars 12 forks source link

consider a more conventional approach to http requests in annotate-enums #20

Closed cmungall closed 1 year ago

cmungall commented 2 years ago
ols_string_search_res_j = response_param.json()
        ols_string_search_res_frame = pds.DataFrame(ols_string_search_res_j['response']['docs'])
        logger.info(f'FRAME={ols_string_search_res_frame}')
        ols_string_search_res_frame.insert(0, "query", tidied_enum)

        # did the string search get any result rows?
        r, c = ols_string_search_res_frame.shape
        if r == 0:
            no_search_res_dict = {'description': '', 'id': orig_enum, 'iri': '', 'is_defining_ontology': '',
                                  'label': '', 'obo_id': '', 'ontology_name': '', 'ontology_prefix': '',
                                  'short_form': '', 'type': ''}
            no_search_res_frame = pds.DataFrame([no_search_res_dict])
            ols_string_search_res_frame = ols_string_search_res_frame.append(no_search_res_frame)
            failures.append(orig_enum)

        ols_string_search_res_frame['query'] = orig_enum
        inner_cosine_obj = Cosine(1)

        annotations_frame = pds.DataFrame(columns=['name', 'obo_id', 'scope', 'type', 'xrefs'])

        for ols_string_search_res_row in ols_string_search_res_frame.itertuples(index=False):
            logger.info(f'ROW={ols_string_search_res_row}')
            once = urllib.parse.quote(ols_string_search_res_row.iri, safe='')
            logger.debug(f'ONCE={once}')
            twice = urllib.parse.quote(once, safe='')

I think the use of pandas dataframes obfuscates here. it's better to work with the return json object directly

non-urgent. we can walk through on our next call

sierra-moxon commented 1 year ago

closing as complete.