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

Replace phenocode/phenostring with displayname, id, slug #54

Open
pjvandehaar opened this issue Mar 2, 2017 · 0 comments
Open

Replace phenocode/phenostring with displayname, id, slug #54

pjvandehaar opened this issue Mar 2, 2017 · 0 comments

Comments

@pjvandehaar
Copy link
Collaborator

pjvandehaar commented Mar 2, 2017

def all_unique(x):
  x=list(x)
  return len(set(x)) == len(x)
ids = [p.id for p in phenos]
us_ids = [urllib.parse.quote_plus(p.id) for p in phenos]
dns = [p.displayname for p in phenos]
assert all_unique(ids)
assert all_unique(us_ids)
assert all_unique(dns)
assert all(id == dn or id not in dns for id,dn in zip(ids,dns))
assert all(us_id == dn or us_id not in dns for us_id,dn in zip(us_ids,dns))

Replace --simple-phenocode with --simple-id.

When anything except phenolist.py loads pheno-list.json,

  • if 'displayname' not in p: p['displayname'] = p['id']
  • p['id'] = urllib.parse.quote_plus(p['id'])
    • It's unfortunate that id will mean slightly different things in different parts of PheWeb, but that shouldn't be a problem I hope.

In typeahead, use {value:p.displayname, display:p.displayname, url:'/pheno/'+p.id} and {value:p.id, display:p.id, url:'/pheno/'+p.id}.

In icd9-phewas, we'll have {id:'008.2', displayname:'infection diseases', icd9_phewas_id:'008.2'}. pheno/h1.html will recognize icd9_phewas_id and display it.

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

No branches or pull requests

1 participant