Conversation
Added /variables and /concepts endpoints that use new indexes
…data-model-update
| element.add_concept(concept) | ||
| elements.append(element) | ||
| return elements | ||
| # TODO; This function will be deprecated once CDEs are implemented. |
There was a problem hiding this comment.
Remove this part i don't think we need it anymore.
| } | ||
|
|
||
|
|
||
| @APP.post('/concepts', tags=['v2.0'], response_model=ConceptsAPIResponse) |
There was a problem hiding this comment.
How come /concepts was not updated to use Search.search_elements like the other endpoints?
There was a problem hiding this comment.
Note: updated this endpoint to use search_elements on the filtering PR, so changes will come later.
| # Program names can be added to studies and sections as well? | ||
| if not isinstance(element, DugConcept) and self.program_name is not None: | ||
| element.add_program_name(self.program_name) ## Why? |
There was a problem hiding this comment.
comments are a bit puzzling to me here, what's the "why?" concerning?
| # dug_elements_from_graph += self.expand_to_dug_element( | ||
| # concept=concept, | ||
| # casting_config=casting_config, | ||
| # dug_element_type=dug_element_type, | ||
| # tranql_source=tranql_source | ||
| # ) | ||
|
|
||
| # add new elements to parsed elements | ||
| self.elements += dug_elements_from_graph |
There was a problem hiding this comment.
this whole dug_elements_from_graph part no longer does anything. probably should delete? seems like the associated method should also be deleted as per Yaphet's comment.
What replaces this functionality?
| action = identifier.purl, | ||
| description=identifier.description | ||
| ) | ||
| concept.concept_type = identifier.types |
There was a problem hiding this comment.
This line got me thinking, should concept_type shift towards being an array in the new model (e.g. concept_types), or has this been discussed already?
| if filepath.is_file(): | ||
| yield filepath | ||
| else: | ||
| print(filepath.glob("**/*")) |
There was a problem hiding this comment.
should be deleted/logged instead
| for result in elastic_results: | ||
| item = result["_source"] | ||
| item["score"] = result["_score"] | ||
| item["explanation"] = result.get("_explanation", {}) |
There was a problem hiding this comment.
At the moment, an explanation won't show up for variables. This field could be parametrized into the SearchElementQuery schema and added as a keyword arg to the search_elements method, though. I've done the kwarg part on my filtering branch, but not taken the extra step of parametrizing it across endpoints within the json payload.
This PR addresses the following changes