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

Feat/mds adapter #29

Merged
merged 65 commits into from
Aug 25, 2021
Merged

Feat/mds adapter #29

merged 65 commits into from
Aug 25, 2021

Conversation

williamhaley
Copy link
Contributor

Jira Ticket: HP-255

This PR is a companion to uc-cdis/cloud-automation#1649

New Features

  • Add aggregate metadata adapters to talk to third party metadata services

Breaking Changes

  • ES indices will not be namespaced per environment

Bug Fixes

  • Scope ES indices to a namespace so they don't conflict with other environments

Deployment changes

  • Must set the appropriate AGG_MDS_NAMESPACE value in metadata.env

Comment on lines 402 to 433
if adapter_name == "icpsr":
gather = ISCPSRDublin(mds_url)
json_data = gather.getRemoteDataAsJson(filters=filters)
results = gather.normalizeToGen3MDSFields(
json_data,
mappings=mappings,
perItemValues=perItemValues,
keepOriginalFields=keepOriginalFields,
)
return results
if adapter_name == "clinicaltrials":
gather = ClinicalTrials(mds_url)
json_data = gather.getRemoteDataAsJson(filters=filters)
results = gather.normalizeToGen3MDSFields(
json_data,
mappings=mappings,
perItemValues=perItemValues,
keepOriginalFields=keepOriginalFields,
)
return results
if adapter_name == "pdaps":
gather = PDAPS(mds_url)
json_data = gather.getRemoteDataAsJson(filters=filters)
results = gather.normalizeToGen3MDSFields(
json_data,
mappings=mappings,
perItemValues=perItemValues,
keepOriginalFields=keepOriginalFields,
)
return results
else:
raise Exception(f"unknown adapter for commons: {name}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if adapter_name == "icpsr":
gather = ISCPSRDublin(mds_url)
json_data = gather.getRemoteDataAsJson(filters=filters)
results = gather.normalizeToGen3MDSFields(
json_data,
mappings=mappings,
perItemValues=perItemValues,
keepOriginalFields=keepOriginalFields,
)
return results
if adapter_name == "clinicaltrials":
gather = ClinicalTrials(mds_url)
json_data = gather.getRemoteDataAsJson(filters=filters)
results = gather.normalizeToGen3MDSFields(
json_data,
mappings=mappings,
perItemValues=perItemValues,
keepOriginalFields=keepOriginalFields,
)
return results
if adapter_name == "pdaps":
gather = PDAPS(mds_url)
json_data = gather.getRemoteDataAsJson(filters=filters)
results = gather.normalizeToGen3MDSFields(
json_data,
mappings=mappings,
perItemValues=perItemValues,
keepOriginalFields=keepOriginalFields,
)
return results
else:
raise Exception(f"unknown adapter for commons: {name}")
adapters = {"icpsr": ISCPSRDublin, "clinicaltrials": ClinicalTrials, "pdaps": PDAPS}
if adapter_name in adapters:
adapter = adapters[adapter_name]
gather = adapter(mds_url)
json_data = gather.getRemoteDataAsJson(filters=filters)
results = gather.normalizeToGen3MDSFields(
json_data,
mappings=mappings,
perItemValues=perItemValues,
keepOriginalFields=keepOriginalFields,
)
return results
else:
raise Exception(f"unknown adapter for commons: {name}")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

John like your suggestion, as I refactored this section in my branch, I incorporated it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants