Open bwalsh opened 2 months ago
Consider this bundle (see fsh editor for shorthand.)
Alias: $sct = http://snomed.info/sct
Alias: $condition-category = http://terminology.hl7.org/CodeSystem/condition-category
Alias: $observation-category = http://terminology.hl7.org/CodeSystem/observation-category
Alias: $loinc = https://loinc.org
Alias: $mylab = http://mylab.org
Instance: undefined
InstanceOf: Bundle
Usage: #example
* type = #bundle
* entry[0].resource = example
* entry[+].resource = example-specimen
* entry[+].resource = example-cancer
* entry[+].resource = example-common-cold
* entry[+].resource = example-fever
* entry[+].resource = example-gleason-score
* entry[+].resource = example-favorite-color
Instance: example
InstanceOf: Patient
Usage: #inline
* birthSex.coding.system = "http://terminology.hl7.org/CodeSystem/v3-AdministrativeGender"
* birthSex.coding.code = "M"
Instance: example-specimen
InstanceOf: Specimen
Usage: #inline
* subject = Reference(example)
* type = $sct#122555 "Biopsy"
* collection.bodySite.coding.system = "http://snomed.info/sct"
* collection.bodySite.coding.code = "122456"
* collection.bodySite.coding.display = "Prostate"
* processing.method = $sct#" 787376009" "Preparation of formalin fixed paraffin embedded tissue specimen"
Instance: example-cancer
InstanceOf: Condition
Usage: #inline
* subject = Reference(example)
* category = $condition-category#encounter-diagnosis
* code = $sct#123456 "Cancer"
* onsetAge = 600 'm' "months"
* evidence.reference = "Observation/example-gleason-score"
Instance: example-common-cold
InstanceOf: Condition
Usage: #inline
* subject = Reference(example)
* category = $condition-category#encounter-diagnosis
* code = $sct#7890 "Common Cold"
* onsetAge = 601 'm' "months"
* evidence.reference = "Observation/example-fever"
Instance: example-fever
InstanceOf: Observation
Usage: #inline
* subject = Reference(example)
* focus = Reference(example)
* category = $observation-category#vital-signs
* code = $loinc#45701-0 "Fever"
* valueBoolean = true
* effectiveAge.value = 601
* effectiveAge.code = "m"
* effectiveAge.system = "http://unitsofmeasure.org"
* effectiveAge.unit = "months"
Instance: example-gleason-score
InstanceOf: Observation
Usage: #inline
* subject = Reference(example)
* focus = Reference(example-specimen)
* category = $observation-category#laboratory
* code = $loinc#94734-1 "Gleason score"
* valueCodeableConcept = $loinc#LA30796-9 "ISUP Grade (Grade Group) 3 (Gleason score 4+3=7)"
* effectiveAge.value = 600
* effectiveAge.code = "m"
* effectiveAge.system = "http://unitsofmeasure.org"
* effectiveAge.unit = "months"
Instance: example-favorite-color
InstanceOf: Observation
Usage: #inline
* subject = Reference(example)
* focus = Reference(example)
* category = $observation-category#survey
* code = $mylab#favorite-color "Favorite color"
* valueString = "Blue"
(Note that onsetAge, a temporal field was used prompt a new line)
patient | birthSex | favorite_color | condition_code | onsetAge | gleason_score | fever | specimen | specimen_type | specimen_collection_body_site | specimen_processing_method |
---|---|---|---|---|---|---|---|---|---|---|
example | M | Blue | Cancer | 600 | ISUP Grade (Grade Group) 3 (Gleason score 4+3=7) | example-specimen | Biopsy | Prostate | Preparation of formalin fixed paraffin embedded tissue specimen | |
example | M | Blue | Common Cold | 601 | TRUE |
(source resource included for completeness)
category | facet | resource |
---|---|---|
patient | patient | Patient |
patient | birthSex | Patient |
survey | favorite_color | Observation |
condition | condition_code | Condition |
condition | onsetAge | Condition |
laboratory | gleason_score | Observation |
vital-signs | fever | Observation |
specimen | specimen | Specimen |
specimen | specimen_type | Specimen |
specimen | specimen_collection_body_site | Specimen |
specimen | specimen_processing_method | Specimen |
Additional gen3 FEF documentation for explorer config. https://github.com/uc-cdis/gen3-frontend-framework/blob/develop/docs/Configuration/Explorer.md#selection-facet
Use Cases:
Example
References
Goals/Forces/Motivation :
See R's tidyverse
In context of FHIR, the Observation is the "tidy data" aka “indexed”, and has a defined, fixed schema. The dataframe is the "wide data" or "Cartesian" data see ggplot2 it's schema is not fixed as "variables" are defined by Observation.code.
Workflow
Data Frame Creation:
Create an initial pandas DataFrame with columns for each unique observation code extracted from the observations. Each row represents a set of observations with its associated attributes (subject, encounter, value, effectiveDateTime, etc.) for a given subject, specimen, focus at a given time. Use observation codes as columns to ensure each code has its dedicated column in the DataFrame.
De normalization by Observation.subject:
patient_*
,specimen_*
Facet Management Category and Coding Extraction:
While creating the "dataframe" we also need to discover and maintain a hierarchy of facets.
explorer_config
ES index to retrieve current explorer configuration.explorerConfig
needed by the front endNotes: Out of scope or
static
elements in explorerConfig.Example: from
Prostate_Microenvironments
Summary view of dataframe e.g. patient-centric
Changes to guppy config
End to End
Guppy PR link: https://github.com/uc-cdis/guppy/pull/273
FF issue: https://github.com/ACED-IDP/gen3-frontend-framework/issues/12
Existing work
E.G.
g3t meta dataframe --data_type Observation META/ --dtale
Discussion points
guppy/_restart
)facet category
delegated to Observation.category/.code. AKA -etl driven facet hierarchy
packages/sampleCommons/config/aced/explorer.json