Skip to content

Commit

Permalink
feat: Add min_rnk option to get_study_fields (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzanadvornykh authored Jul 9, 2023
1 parent 51751de commit c0bffc7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pytrials/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get_full_studies(self, search_expr, max_studies=50):

return full_studies

def get_study_fields(self, search_expr, fields, max_studies=50, fmt="csv"):
def get_study_fields(self, search_expr, fields, max_studies=50, min_rnk=1,fmt="csv"):
"""Returns study content for specified fields
Retrieves information from the study fields endpoint, which acquires specified information
Expand Down Expand Up @@ -102,7 +102,7 @@ def get_study_fields(self, search_expr, fields, max_studies=50, fmt="csv"):
)
else:
concat_fields = ",".join(fields)
req = f"study_fields?expr={search_expr}&max_rnk={max_studies}&fields={concat_fields}"
req = f"study_fields?expr={search_expr}&min_rnk={min_rnk}&max_rnk={max_studies+min_rnk-1}&fields={concat_fields}"
if fmt == "csv":
url = f"{self._BASE_URL}{self._QUERY}{req}&{self._CSV}"
return csv_handler(url)
Expand Down

0 comments on commit c0bffc7

Please sign in to comment.