Skip to content

Commit

Permalink
fix view and struct
Browse files Browse the repository at this point in the history
  • Loading branch information
tianj7 committed Mar 21, 2024
1 parent 8d88b6b commit 05e0d0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions models/datadictionary.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ type DataDictionaryModel struct {
Data []*DataDictionaryEntry `json:"Data"`
}
type DataDictionaryEntry struct {
VocabularyID int64 `json:"vocabularyID"`
ConceptID int64 `json:"conceptID"`
ConceptCode string `json:"conceptCode"`
ConceptClassId string `json:"conceptClassId"`
NumberOfPeopleWithVariable int64 `json:"NumberOfPeopleWithVariable"`
NumberOfPeopleWithValue int64 `json:"NumberOfPeopleWithValue"`
NumberOfPeopleWithNullValue int64 `json:"NumberOfPeopleWithNullValue"`
ValueStoredAs string `json:"valueStoredAs"`
MinValue int64 `json:"minValue"`
MaxValue int64 `json:"maxValue"`
MeanValue int64 `json:"meanValue"`
StandardDeviation int64 `json:"standardDeviation"`
ValueSummary []byte `json:"valueSummary"`
VocabularyID string `json:"vocabularyID"`
ConceptID int64 `json:"conceptID"`
ConceptCode string `json:"conceptCode"`
ConceptClassId string `json:"conceptClassId"`
NumberOfPeopleWithVariable int64 `json:"numberOfPeopleWithVariable"`
NumberOfPeopleWhereValueIsFilled int64 `json:"numberOfPeopleWhereValueIsFilled"`
NumberOfPeopleWhereValueIsNull int64 `json:"numberOfPeopleWhereValueIsNull"`
ValueStoredAs string `json:"valueStoredAs"`
MinValue float64 `json:"minValue"`
MaxValue float64 `json:"maxValue"`
MeanValue float64 `json:"meanValue"`
StandardDeviation float64 `json:"standardDeviation"`
ValueSummary []byte `json:"valueSummary"`
}

// Generate Data Dictionary Json
Expand Down
2 changes: 1 addition & 1 deletion tests/setup_local_db/ddl_results_and_cdm.sql
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ WHERE concept.CONCEPT_CLASS_ID='MVP Continuous' or concept.CONCEPT_ID=2000007027
CREATE VIEW omop.DATA_DICTIONARY AS
SELECT c.vocabulary_id, c.concept_id, c.concept_code, c.concept_class_id, COUNT(DISTINCT oc.person_id) as number_of_people_with_variable,
(CASE WHEN c.concept_class_id = 'MVP Continuous' THEN (SELECT COUNT(DISTINCT person_id) FROM omop.OBSERVATION_CONTINUOUS oc1 WHERE oc1.observation_concept_id = c.concept_id AND oc1.value_as_number IS NOT NULL) ELSE (SELECT COUNT(DISTINCT person_id) FROM omop.OBSERVATION_CONTINUOUS oc3 WHERE oc3.observation_concept_id = c.concept_id AND (oc3.value_as_concept_id IS NOT NULL and oc3.value_as_concept_id > 0)) END) as number_of_people_where_value_is_filled,
(CASE WHEN c.concept_class_id = 'MVP Continuous' THEN (SELECT COUNT(DISTINCT person_id) FROM omop.OBSERVATION_CONTINUOUS oc2 WHERE oc2.observation_concept_id = c.concept_id AND oc2.value_as_number IS NULL) ELSE (SELECT COUNT(DISTINCT person_id) FROM omop.OBSERVATION_CONTINUOUS oc4 WHERE oc4.observation_concept_id = c.concept_id AND (oc4.value_as_concept_id IS NULL and oc4.value_as_concept_id = 0)) END) as number_of_people_where_value_is_null,
(CASE WHEN c.concept_class_id = 'MVP Continuous' THEN (SELECT COUNT(DISTINCT person_id) FROM omop.OBSERVATION_CONTINUOUS oc2 WHERE oc2.observation_concept_id = c.concept_id AND oc2.value_as_number IS NULL) ELSE (SELECT COUNT(DISTINCT person_id) FROM omop.OBSERVATION_CONTINUOUS oc4 WHERE oc4.observation_concept_id = c.concept_id AND (oc4.value_as_concept_id IS NULL or oc4.value_as_concept_id = 0)) END) as number_of_people_where_value_is_null,
(CASE WHEN c.concept_class_id = 'MVP Continuous' THEN 'Number' ELSE 'Concept Id' END) as value_stored_as,
(CASE WHEN c.concept_class_id = 'MVP Continuous' THEN MIN(value_as_number) ELSE NULL END) as min_value,
(CASE WHEN c.concept_class_id = 'MVP Continuous' THEN MAX(value_as_number) ELSE NULL END) as max_value,
Expand Down

0 comments on commit 05e0d0e

Please sign in to comment.