File size: 2,844 Bytes
4350907
 
 
07a0433
 
 
 
4350907
 
 
cd2ce8e
07a0433
41752df
eb39f38
4350907
7552c7b
 
07a0433
234299f
7552c7b
 
4350907
 
07a0433
234299f
 
4350907
 
ec2224d
 
 
234299f
 
ec2224d
 
4350907
 
 
4cbe9fa
07a0433
234299f
 
 
 
 
a6870be
234299f
 
 
7552c7b
4350907
 
7552c7b
07a0433
 
 
 
ec2224d
 
 
 
07a0433
7552c7b
4350907
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
import pandas as pd
import gradio as gr
# SNOMEDCT Download https://www.nlm.nih.gov/healthit/snomedct/us_edition.html
# LOINC Download https://loinc.org/downloads/
# ECQM for Value Set Measures and Quality Reporting: https://vsac.nlm.nih.gov/download/ecqm?rel=20220505&res=eh_only.unique_vs.20220505.txt
# SNOMED Nurse Subset https://www.nlm.nih.gov/healthit/snomedct/index.html?_gl=1*36x5pi*_ga*MTI0ODMyNjkxOS4xNjY1NTY3Mjcz*_ga_P1FPTH9PL4*MTY2Nzk4OTI1My41LjEuMTY2Nzk4OTY5Ni4wLjAuMA..

def MatchLOINC(name):
    basedir = os.path.dirname(__file__)
    pd.set_option("display.max_rows", None)
    data = pd.read_csv(f'LoincTableCore.csv')    
    swith=data.loc[data['COMPONENT'].str.contains(name, case=False, na=False)]
    return swith
    
def MatchLOINCPanelsandForms(name):
    basedir = os.path.dirname(__file__)
    data = pd.read_csv(f'PanelsAndForms.csv')     
    swith=data.loc[data['ParentName'].str.contains(name, case=False, na=False)]
    return swith
    
def MatchSNOMED(name):
    basedir = os.path.dirname(__file__)
    data = pd.read_csv(f'sct2_TextDefinition_Full-en_US1000124_20220901.txt',sep='\t')   
    swith=data.loc[data['term'].str.contains(name, case=False, na=False)]
    #swith = data[data['term'].str.match(name)]
    return swith

def MatchOMS(name):
    basedir = os.path.dirname(__file__)
    data = pd.read_csv(f'SnomedOMS.csv')   
    swith=data.loc[data['SNOMED CT'].str.contains(name, case=False, na=False)]
    #swith = data[data['SNOMED CT'].str.match(name)]
    return swith



with gr.Blocks() as demo:
    name = gr.Textbox(label="Enter a term or word to match and find LOINC, SNOMED and OMS clinical terminologies.")
    
    output1 = gr.DataFrame(label="LOINC Terminology")
    output2 = gr.DataFrame(label="LOINC Assessment Panels")
    output3 = gr.DataFrame(label="SNOMED Terminology")
    output4 = gr.DataFrame(label="SNOMED and OMS Terminology")
    
    #output1 = gr.TextArea(label="Output Match LOINC", max_lines=10, interactive=True, )
    #output2 = gr.TextArea(label="Output Match LOINC Panels and Forms", max_lines=10, interactive=True,)
    #output3 = gr.TextArea(label="Output Match SNOMED", max_lines=10, interactive=True,)
    #output4 = gr.TextArea(label="Output Match SNOMED", max_lines=10, interactive=True,)

    button1 = gr.Button("Match LOINC Clinical Terminology")
    button1.click(fn=MatchLOINC, inputs=name, outputs=output1)
    
    button2 = gr.Button("Match LOINC Panels and Forms")
    button2.click(fn=MatchLOINCPanelsandForms, inputs=name, outputs=output2)
        
    button3 = gr.Button("Match SNOMED Clinical Terminology")
    button3.click(fn=MatchSNOMED, inputs=name, outputs=output3)

    button3 = gr.Button("Match SNOMED and OMS Clinical Terminology")
    button3.click(fn=MatchOMS, inputs=name, outputs=output4)

    

demo.launch(debug=True)