@@ -43,7 +43,9 @@ function analyze_concept_distribution(
4343)
4444 isempty (concept_set) && throw (ArgumentError (" concept_set cannot be empty" ))
4545
46- concepts_by_domain = _get_concepts_by_domain (concept_set, conn; schema= schema, dialect= dialect)
46+ concepts_by_domain = _get_concepts_by_domain (
47+ concept_set, conn; schema= schema, dialect= dialect
48+ )
4749
4850 if isempty (concepts_by_domain)
4951 return DataFrame (;
@@ -57,18 +59,26 @@ function analyze_concept_distribution(
5759 try
5860 table_symbol = _domain_id_to_table (domain_id)
5961
60- setup = _setup_domain_query (conn; domain= table_symbol, schema= schema, dialect= dialect)
62+ setup = _setup_domain_query (
63+ conn; domain= table_symbol, schema= schema, dialect= dialect
64+ )
6165
62- base = Where (Fun. in (Get (setup. concept_col), domain_concepts... ))(Join (
63- :main_concept => setup. concept_table,
64- Get (setup. concept_col) .== Get. main_concept. concept_id,
65- )(From (setup. tbl)))
66+ base = Where (Fun. in (Get (setup. concept_col), domain_concepts... ))(
67+ Join (
68+ :main_concept => setup. concept_table,
69+ Get (setup. concept_col) .== Get. main_concept. concept_id,
70+ )(
71+ From (setup. tbl)
72+ ),
73+ )
6674
6775 q = Select (
6876 Get (:person_id ),
6977 :concept_id => Get (setup. concept_col),
7078 :concept_name => Get. main_concept. concept_name,
71- )(base)
79+ )(
80+ base
81+ )
7282 base_df = DataFrame (DBInterface. execute (setup. fconn, q))
7383
7484 if ! isempty (base_df)
@@ -144,11 +154,13 @@ function generate_summary(
144154 covariate_funcs:: AbstractVector{<:Function} = Function[],
145155 schema:: String = " main" ,
146156 dialect:: Symbol = :postgresql ,
147- raw_values:: Bool = false
157+ raw_values:: Bool = false ,
148158)
149159 isempty (concept_set) && throw (ArgumentError (" concept_set cannot be empty" ))
150160
151- concepts_by_domain = _get_concepts_by_domain (concept_set, conn; schema= schema, dialect= dialect)
161+ concepts_by_domain = _get_concepts_by_domain (
162+ concept_set, conn; schema= schema, dialect= dialect
163+ )
152164
153165 if isempty (concepts_by_domain)
154166 return DataFrame (;
@@ -170,16 +182,22 @@ function generate_summary(
170182 for (domain_id, domain_concepts) in concepts_by_domain
171183 try
172184 table_symbol = _domain_id_to_table (domain_id)
173- setup = _setup_domain_query (conn; domain= table_symbol, schema= schema, dialect= dialect)
185+ setup = _setup_domain_query (
186+ conn; domain= table_symbol, schema= schema, dialect= dialect
187+ )
174188
175- concept_records_q = Select (:total_concept_records => Agg. count ())(Group ()(Where (
176- Fun. in (Get (setup. concept_col), domain_concepts... )
177- )(From (setup. tbl))))
189+ concept_records_q = Select (:total_concept_records => Agg. count ())(
190+ Group ()(
191+ Where (Fun. in (Get (setup. concept_col), domain_concepts... ))(
192+ From (setup. tbl)
193+ ),
194+ ),
195+ )
178196 domain_records = DataFrame (DBInterface. execute (setup. fconn, concept_records_q)). total_concept_records[1 ]
179197
180- unique_patients_q = Select (Get (:person_id ))(Where (
181- Fun. in (Get (setup. concept_col), domain_concepts... )
182- )( From (setup . tbl)))
198+ unique_patients_q = Select (Get (:person_id ))(
199+ Where ( Fun. in (Get (setup. concept_col), domain_concepts... ))( From (setup . tbl) )
200+ )
183201 domain_patients_df = DataFrame (
184202 DBInterface. execute (setup. fconn, unique_patients_q)
185203 )
@@ -307,18 +325,17 @@ function generate_domain_breakdown(
307325 covariate_funcs:: AbstractVector{<:Function} = Function[],
308326 schema:: String = " main" ,
309327 dialect:: Symbol = :postgresql ,
310- raw_values:: Bool = false
328+ raw_values:: Bool = false ,
311329)
312330 isempty (concept_set) && throw (ArgumentError (" concept_set cannot be empty" ))
313331
314- concepts_by_domain = _get_concepts_by_domain (concept_set, conn; schema= schema, dialect= dialect)
332+ concepts_by_domain = _get_concepts_by_domain (
333+ concept_set, conn; schema= schema, dialect= dialect
334+ )
315335
316336 if isempty (concepts_by_domain)
317337 return DataFrame (;
318- metric= String[],
319- value= String[],
320- interpretation= String[],
321- domain= String[],
338+ metric= String[], value= String[], interpretation= String[], domain= String[]
322339 )
323340 end
324341
@@ -332,16 +349,22 @@ function generate_domain_breakdown(
332349 for (domain_id, domain_concepts) in concepts_by_domain
333350 try
334351 table_symbol = _domain_id_to_table (domain_id)
335- setup = _setup_domain_query (conn; domain= table_symbol, schema= schema, dialect= dialect)
352+ setup = _setup_domain_query (
353+ conn; domain= table_symbol, schema= schema, dialect= dialect
354+ )
336355
337- concept_records_q = Select (:total_concept_records => Agg. count ())(Group ()(Where (
338- Fun. in (Get (setup. concept_col), domain_concepts... )
339- )(From (setup. tbl))))
356+ concept_records_q = Select (:total_concept_records => Agg. count ())(
357+ Group ()(
358+ Where (Fun. in (Get (setup. concept_col), domain_concepts... ))(
359+ From (setup. tbl)
360+ ),
361+ ),
362+ )
340363 domain_records = DataFrame (DBInterface. execute (setup. fconn, concept_records_q)). total_concept_records[1 ]
341364
342- unique_patients_q = Select (Get (:person_id ))(Where (
343- Fun. in (Get (setup. concept_col), domain_concepts... )
344- )( From (setup . tbl)))
365+ unique_patients_q = Select (Get (:person_id ))(
366+ Where ( Fun. in (Get (setup. concept_col), domain_concepts... ))( From (setup . tbl) )
367+ )
345368 domain_patients_df = DataFrame (
346369 DBInterface. execute (setup. fconn, unique_patients_q)
347370 )
@@ -367,7 +390,7 @@ function generate_domain_breakdown(
367390 domain_breakdown = DataFrame ()
368391 for row in eachrow (domain_details)
369392 domain_coverage = round ((row. patients / total_patients) * 100 ; digits= 3 )
370-
393+
371394 if raw_values
372395 domain_metrics = DataFrame (;
373396 metric= [
@@ -376,12 +399,7 @@ function generate_domain_breakdown(
376399 " $(row. domain) - Records" ,
377400 " $(row. domain) - Coverage (%)" ,
378401 ],
379- value= [
380- row. concepts,
381- row. patients,
382- row. records,
383- domain_coverage,
384- ],
402+ value= [row. concepts, row. patients, row. records, domain_coverage],
385403 interpretation= [
386404 " Number of concepts analyzed in $(row. domain) domain" ,
387405 " Patients with $(row. domain) concepts" ,
0 commit comments