Skip to content

Commit

Permalink
cleaned the code
Browse files Browse the repository at this point in the history
  • Loading branch information
yskale committed Apr 26, 2024
1 parent 4254567 commit c0d6098
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/dug/core/async_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ async def search_program(self, program_name=None, offset=0, size=None):
"""
Search for studies by unique_id (ID or name) and/or study_name.
"""

# Initialize the query_body with the outer structure
query_body = {
"query": {
Expand Down Expand Up @@ -504,10 +503,7 @@ async def search_program(self, program_name=None, offset=0, size=None):

# Prepare the query body for execution
body = query_body
print(body)

# Execute the search query


# Execute the search query
search_results = await self.es.search(
index="variables_index",
Expand All @@ -527,10 +523,6 @@ async def search_program(self, program_name=None, offset=0, size=None):
# Append the details to the list in the desired format
collection_details_list.append(collection_details)

# Print the list of collection details in JSON format
import json
#print(json.dumps(collection_details_list, indent=4))

return collection_details_list


Expand Down Expand Up @@ -559,15 +551,12 @@ async def search_program_list(self):
index="variables_index",
body=query_body
)

# The unique data_types and their counts of unique collection_ids will be in the 'aggregations' field of the response
unique_data_types = search_results['aggregations']['unique_program_names']['buckets']

# Testing the output so print the unique data_types and their counts of unique collection_ids
#for bucket in unique_data_types:
# print(f"data_type: {bucket['key']}, count of unique collection_ids: {bucket['No_of_studies']['value']}")

return unique_data_types


def _get_var_query(self, concept, fuzziness, prefix_length, query):
"""Returns ES query for variable search"""
es_query = {
Expand Down

0 comments on commit c0d6098

Please sign in to comment.