jhu-bids / TermHub

Web app and CLI tools for working with biomedical terminologies. https://github.com/orgs/jhu-bids/projects/9/views/7
https://bit.ly/termhub
GNU General Public License v3.0
8 stars 10 forks source link

Code set expansion #513

Open Sigfried opened 11 months ago

Sigfried commented 11 months ago

Overview

We'd like to be able to expand cset drafts in TermHub, ahead of when they are expanded in the enclave (at finalization).

Sub-task list

Discussion

Given a set of definition rules (for now, following OMOP conventions, having a concept_id and definition flags (D = includeDescendants, M = includeMapped, X = isExcluded), perform expansion (i.e., process the rules) and return requested response, which could be:

  1. a of list concept_ids
  2. a subgraph
  3. tabular data illustrating the result of processing the rules

So, given a graph including a subgraph like:

     A       G
    / \     /
   B   C   /
    \ / \ /
     D   E
         |
         F

a code set defined as including A and its descendants and exluding G and it's descendants would be defined (in ATLAS style) as:

[
  {concept_id: 'A', inlcudeDescendants: true, includeMapped: false, isExcluded: false },
  {concept_id: 'G', inlcudeDescendants: true, includeMapped: false, isExcluded: true },
]

Or, in an abbreviated form I'm using:

[
  {A: 'D' },
  {G: 'DX' },
]
  1. Its expansion would be [A, B, C, D].
  2. Its expanded subgraph, as, e.g., an edge list, would be [ [A,B], [A,C], [B,D], [C,D] ].
  3. The tabular data for illustrating expansion might be something like:
[ 
    { concept_id: A, path: /A,        def: D },
    { concept_id: B, path: /A/B,                   included_by: A },
    { concept_id: D, path: /A/B/D,                 included_by: A },
    { concept_id: C, path: /A/C,                   included_by: A },
    { concept_id: D, path: /A/C/D,                 included_by: A },
    { concept_id: E, path: /A/C/E,                 included_by: A, excluded_by: G },
    { concept_id: F, path: /A/C/E/F,               included_by: A, excluded_by: G },
    { concept_id: G, path: /G,        def: DX },
    { concept_id: E, path: /G/E,                                   excluded_by: G },
    { concept_id: F, path: /G/E/F,                                 excluded_by: G },
]
joeflack4 commented 2 months ago

@Sigfried I've added this to the Vocab explorer & adding concepts to csets milestone