Пример #1
0
    def test_cdm_csv(self):
        cdm_data_rows = resources.cdm_csv()
        expected_keys = {
            'table_name', 'column_name', 'is_nullable', 'data_type',
            'description'
        }
        expected_table_names = {
            'person', 'visit_occurrence', 'condition_occurrence',
            'procedure_occurrence', 'drug_exposure', 'measurement'
        }
        actual_table_names = set()
        for row in cdm_data_rows:
            keys = set(row.keys())
            self.assertSetEqual(expected_keys, keys)
            actual_table_names.add(row['table_name'])

        for expected_table_name in expected_table_names:
            self.assertIn(expected_table_name, actual_table_names)
Пример #2
0
import resources
import os

CDM_TABLES = set([r['table_name'] for r in resources.cdm_csv()])
CDM_FILES = map(lambda t: t + '.csv', CDM_TABLES)
ACHILLES_INDEX_FILES = resources.achilles_index_files()
ALL_ACHILLES_INDEX_FILES = [
    name.split(resources.resource_path + os.sep)[1].strip()
    for name in ACHILLES_INDEX_FILES
]
DATASOURCES_JSON = os.path.join(resources.achilles_index_path,
                                'data/datasources.json')
RESULT_CSV = 'result.csv'
ERRORS_CSV = 'errors.csv'
WARNINGS_CSV = 'warnings.csv'
PROCESSED_TXT = 'processed.txt'
LOG_JSON = 'log.json'
ACHILLES_HEEL_REPORT = 'achillesheel'
PERSON_REPORT = 'person'
DATA_DENSITY_REPORT = 'datadensity'
ALL_REPORTS = [ACHILLES_HEEL_REPORT, PERSON_REPORT, DATA_DENSITY_REPORT]
ALL_REPORT_FILES = map(lambda s: s + '.json', ALL_REPORTS)
IGNORE_LIST = [RESULT_CSV, ERRORS_CSV, WARNINGS_CSV, PROCESSED_TXT
               ] + ALL_ACHILLES_INDEX_FILES
VOCABULARY_TABLES = [
    'concept', 'concept_ancestor', 'concept_class', 'concept_relationship',
    'concept_synonym', 'domain', 'drug_strength', 'relationship', 'vocabulary'
]
REQUIRED_TABLES = ['person']
REQUIRED_FILES = [table + '.csv' for table in REQUIRED_TABLES]
ACHILLES_EXPORT_PREFIX_STRING = "curation_report/data/"