import pyodbc

config = dict(server=   'tcp:eyetoaidevelopment.database.windows.net', # change this to your SQL Server hostname or IP address
              port=      1433,                    # change this to your SQL Server port number [1433 is the default]
              database= 'test',
              username= 'michael',
              password= 'GradioAI7000')


conn_str = ('SERVER={server},{port};'   +
            'DATABASE={database};'      +
            'UID={username};'           +
            'PWD={password}')

conn = pyodbc.connect(
    r'DRIVER={ODBC Driver 13 for SQL Server};' +
    conn_str.format(**config)
    )


cursor = conn.cursor()

cursor.execute('SELECT * FROM reports')

for entry in cursor:
    print(entry)
@@ -28,19 +28,18 @@
 t(server
-= 
  
+=
  'tcp:ey
@@ -81,181 +81,35 @@
 et',
- # change this to your SQL Server hostname or IP address%0A              port=      1433,                    # change this to your SQL Server port number %5B1433 is the default%5D
+%0A              port = 1433,
 %0A   
@@ -127,16 +127,17 @@
 database
+ 
 = 'test'
@@ -160,16 +160,17 @@
 username
+ 
 = 'micha
@@ -196,16 +196,17 @@
 password
+ 
 = 'Gradi
@@ -508,16 +508,36 @@
 rsor()%0A%0A
+def get_c_i(c):%0A    
 cursor.e
@@ -547,67 +547,710 @@
 ute(
-'
+%22
 SELECT 
-* FROM reports')%0A%0Afor entry in cursor:%0A    print(entry)
+Max(ReportId) FROM ReportConditionFindingOptions%22)%0A    total = cursor.fetchval()%0A    cursor.execute(%22SELECT COUNT (Conditions.Name) from Conditions INNER JOIN ReportConditionFindingOptions ON Conditions.Id = ReportConditionFindingOptions.ConditionId WHERE Name = ?%22, c)%0A    freq = cursor.fetchval()%0A    print(%22%7B0%7D / %7B1%7D = %7B2%7D%22.format(freq, total, freq / total))%0A%0Adef get_f_j(f):%0A    cursor.execute(%22SELECT COUNT(*) FROM Findings%22)%0A    total = cursor.fetchval()%0A    cursor.execute(%22SELECT COUNT(*) FROM Findings WHERE Name=?%22, f)%0A    freq = cursor.fetchval()%0A    print(%22%7B0%7D / %7B1%7D = %7B2%7D%22.format(freq, total, freq / total))%0A%0Aif __name__ == '__main__':%0A    get_c_i('Fibroadenoma')%0A    get_f_j('Mass')%0A%0A

can count C_i