def test_isa_custom(spark_session, bundles): observations = extract_entry(spark_session, bundles, 'observation') observations.registerTempTable('observations') blood_pressure = {'blood_pressure': [('http://loinc.org', '8462-4')]} push_valuesets(spark_session, blood_pressure) results = spark_session.sql("SELECT subject.reference, " + "effectiveDateTime, " + "valueQuantity.value " + "FROM observations " + "WHERE in_valueset(code, 'blood_pressure')") assert get_current_valuesets(spark_session) == blood_pressure assert results.count() == 14
def test_isa_snomed(spark_session): spark_session.sql('create database isa_snomed_ontologies') with_relationships( spark_session, create_hierarchies(spark_session), 'tests/resources/SNOMED_RELATIONSHIP_SAMPLE.TXT', '20160901') \ .write_to_database('isa_snomed_ontologies') create_value_sets(spark_session).write_to_database('isa_snomed_ontologies') push_valuesets(spark_session, {'diabetes' : isa_snomed('73211009')}, database = 'isa_snomed_ontologies') expected = {'diabetes' : [('http://snomed.info/sct', '73211009'), ('http://snomed.info/sct', '44054006')]} assert get_current_valuesets(spark_session) == expected
def test_isa_loinc(spark_session): spark_session.sql('create database isa_loinc_ontologies') with_loinc_hierarchy( spark_session, create_hierarchies(spark_session), 'tests/resources/LOINC_HIERARCHY_SAMPLE.CSV', '2.56') \ .write_to_database('isa_loinc_ontologies') create_value_sets(spark_session).write_to_database('isa_loinc_ontologies') push_valuesets(spark_session, {'leukocytes' : isa_loinc('LP14738-6')}, database='isa_loinc_ontologies') expected = {'leukocytes' : [('http://loinc.org', '5821-4'), ('http://loinc.org', 'LP14738-6'), ('http://loinc.org', 'LP14419-3')]} assert get_current_valuesets(spark_session) == expected