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/dbgap options #702

Merged
merged 21 commits into from
Oct 22, 2019
Merged

Feat/dbgap options #702

merged 21 commits into from
Oct 22, 2019

Conversation

Avantol13
Copy link
Contributor

@Avantol13 Avantol13 commented Oct 4, 2019

New Features

  • dbGaP sync supports handling "Common Exchange Area" user access via the c999 consent group now
  • new configuration to turn on "granting Common Exchange Area user access via the c999 consent group" feature

Breaking Changes

  • c999 is no longer converted to just phsid when parsing consent codes (which causes issues when switching the configuration on/off in terms of data access). Now, when consent code parsing is on, usersync handles c999 by providing access to all consents explicitly (including itself, .c999, to represent the study-specific exchange area)

Bug Fixes

Improvements

Dependency updates

Deployment changes

  • Fence does NOT handle c999 the same as before. If using dbgap sync w/ consent code parsing and indexd records have acls with just phsid to represent objects someone w/ c999 should be able to see, you will need to ensure that the records also have the phsid.consent_code as well or users will lose access
  • Fence has a new configuration to support more dbGaP syncing options: if you require "Common Exchange Area" data access, review the new configuration and supply necessary values

@coveralls
Copy link

coveralls commented Oct 4, 2019

Pull Request Test Coverage Report for Build 7944

  • 50 of 51 (98.04%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 69.436%

Changes Missing Coverage Covered Lines Changed/Added Lines %
fence/sync/sync_users.py 50 51 98.04%
Totals Coverage Status
Change from base Build 7942: 0.1%
Covered Lines: 5073
Relevant Lines: 7306

💛 - Coveralls

@github-actions
Copy link

github-actions bot commented Oct 4, 2019

The style in this PR agrees with black. ✔️

This formatting comment was generated automatically by a script in uc-cdis/wool.

@@ -370,12 +370,26 @@ dbGaP:
proxy_user: ''
protocol: 'sftp'
decrypt_key: ''
# parse out the consent from the dbgap accession number such that something
# like "phs000123.v1.p1.c2" becomes "phs000123.c2".
Copy link
Contributor

Choose a reason for hiding this comment

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

what does .v1.p1 mean? :D

Choose a reason for hiding this comment

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

tests/dbgap_sync/test_user_sync.py Outdated Show resolved Hide resolved
tests/dbgap_sync/test_user_sync.py Show resolved Hide resolved
]

assert "phs000179" in resource_to_parent_paths
assert resource_to_parent_paths["phs000179"] == ["/orgA/programs/"]
Copy link
Contributor

Choose a reason for hiding this comment

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

phs000179 is not in study_to_resource_namespaces so where does the mapping come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gets put in the _default namespace

docs/dbgap_info.md Outdated Show resolved Hide resolved
docs/dbgap_info.md Show resolved Hide resolved
docs/dbgap_info.md Outdated Show resolved Hide resolved
docs/dbgap_info.md Outdated Show resolved Hide resolved
# Will NOT MATCH forms like: phs000123
#
# WARNING: Do not change this without consulting the code that uses it
DBGAP_ACCESSION_WITH_CONSENT_REGEX: '(?P<phsid>phs[0-9]+)(.(?P<version>v[0-9]+)){0,1}(.(?P<participant_set>p[0-9]+)){0,1}.(?P<consent>c[0-9]+)'
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you choose to make this configurable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in case dbgap projects we receive change format, we don't have to edit code. there are possibilities where the first 3 chars are not phs. I'd rather be able to change it in configuration in the future than edit code 🤷‍♂️ idk, I could be convinced otherwise, but since this is an external format we are expected, figured it'd feel more at home in configuration

Copy link
Contributor

Choose a reason for hiding this comment

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

but instead of editing code in 1 place, we would have to edit the default config + edit the value in the config of all the Commons that use it 😬

Copy link
Contributor Author

@Avantol13 Avantol13 Oct 21, 2019

Choose a reason for hiding this comment

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

not necessarily, just edit the default and don't supply it in the configurations in the commons so they use the default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and then if a specific commons expects something different they can override it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

like if for some commons we need phs123 but others we start getting phg123, better to have that in config. I see your point though, it's not of immediate use now, I just feel like this is something that should be configurable

Copy link
Contributor

Choose a reason for hiding this comment

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

true!! assuming we remember to leave it out of the commons' configs 😅

fence/sync/sync_users.py Outdated Show resolved Hide resolved
fence/sync/sync_users.py Outdated Show resolved Hide resolved
# go through existing access and find any c999's and make sure to give access to
# all accessions with consent for that phsid
for username, user_project_info in copy.deepcopy(user_projects).items():
for project, permissions in copy.deepcopy(user_project_info).items():
Copy link
Contributor

@paulineribeyre paulineribeyre Oct 21, 2019

Choose a reason for hiding this comment

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

permissions is not used - either use for project in copy.deepcopy(user_project_info) here, or use permissions instead of read-storage later

tests/dbgap_sync/test_user_sync.py Show resolved Hide resolved
tests/dbgap_sync/test_user_sync.py Outdated Show resolved Hide resolved
assert "phs000178.c999" in resource_to_parent_paths
assert resource_to_parent_paths["phs000178.c999"] == ["/orgA/programs/"]

assert "test_common_exchange_area" in resource_to_parent_paths
assert resource_to_parent_paths["test_common_exchange_area"] == [
"/dbgap/programs/"
]
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

did you forget to paste this somewhere? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, this logic was confusing, this is already checked below, no need to do it twice

Copy link
Contributor

@paulineribeyre paulineribeyre left a comment

Choose a reason for hiding this comment

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

✨ c999 ✨

@Avantol13 Avantol13 merged commit eccddc1 into master Oct 22, 2019
@Avantol13 Avantol13 deleted the feat/dbgap-options branch October 22, 2019 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants