Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Remove study_id filter from gf target ID query #682

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 44 additions & 17 deletions kf_lib_data_ingest/target_api_plugins/kids_first_dataservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def get_key_components(cls, record, get_target_id_from_record):

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -123,9 +125,9 @@ def query_target_ids(cls, host, key_components):
if kfid:
return [kfid]
else:
return list(
yield_kfids(host, cls.api_path, drop_none(key_components))
)
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -168,7 +170,9 @@ def get_key_components(cls, record, get_target_id_from_record):

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -264,7 +268,9 @@ def get_key_components(cls, record, get_target_id_from_record):

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -325,7 +331,9 @@ def get_key_components(cls, record, get_target_id_from_record):

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -392,6 +400,7 @@ def query_target_ids(cls, host, key_components):
# We no longer want multiple participant outcome entries.
# Patch whatever is latest for compatibility with existing dataservice
# entries.
key_components["limit"] = 2
pes = sorted(
yield_entities(host, cls.api_path, key_components),
key=lambda e: e.get("age_at_event_days", 0),
Expand Down Expand Up @@ -444,7 +453,9 @@ def get_key_components(cls, record, get_target_id_from_record):

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -529,13 +540,15 @@ class GenomicFile:
def get_key_components(cls, record, get_target_id_from_record):
# FIXME: Temporary until KFDRC file hashes are reliably stable
return {
"study_id": get_target_id_from_record(Study, record),
# "study_id": get_target_id_from_record(Study, record),
"external_id": not_none(record[CONCEPT.GENOMIC_FILE.ID]),
}

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -615,7 +628,9 @@ def get_key_components(cls, record, get_target_id_from_record):

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -658,7 +673,9 @@ def get_key_components(cls, record, get_target_id_from_record):

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -760,7 +777,9 @@ def get_key_components(cls, record, get_target_id_from_record):

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -806,7 +825,9 @@ def get_key_components(cls, record, get_target_id_from_record):

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -852,7 +873,9 @@ def get_key_components(cls, record, get_target_id_from_record):

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -898,7 +921,9 @@ def get_key_components(cls, record, get_target_id_from_record):

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down Expand Up @@ -944,7 +969,9 @@ def get_key_components(cls, record, get_target_id_from_record):

@classmethod
def query_target_ids(cls, host, key_components):
return list(yield_kfids(host, cls.api_path, drop_none(key_components)))
filters = drop_none(key_components)
filters["limit"] = 2
return list(yield_kfids(host, cls.api_path, filters))

@classmethod
def build_entity(cls, record, get_target_id_from_record):
Expand Down
Loading