@@ -98,7 +98,9 @@ class ComplianceOverview(BaseModel):
9898async def get_semantic_rules (
9999 framework : Optional [str ] = Query (None , description = "Filter by framework" ),
100100 business_impact : Optional [str ] = Query (None , description = "Filter by business impact" ),
101- remediation_available : Optional [bool ] = Query (None , description = "Filter by remediation availability" ),
101+ remediation_available : Optional [bool ] = Query (
102+ None , description = "Filter by remediation availability"
103+ ),
102104 db : Session = Depends (get_db ),
103105 current_user : Dict [str , Any ] = Depends (get_current_user ),
104106) -> Dict [str , Any ]:
@@ -149,7 +151,9 @@ async def get_semantic_rules(
149151 "remediation_complexity" : rule .remediation_complexity ,
150152 "estimated_fix_time" : rule .estimated_fix_time ,
151153 "remediation_available" : rule .remediation_available ,
152- "confidence_score" : (float (rule .confidence_score ) if rule .confidence_score else 1.0 ),
154+ "confidence_score" : (
155+ float (rule .confidence_score ) if rule .confidence_score else 1.0
156+ ),
153157 }
154158 )
155159
@@ -220,7 +224,9 @@ async def get_framework_intelligence(
220224
221225 remediation_coverage = 0
222226 if stats .rule_count > 0 :
223- remediation_coverage = round ((stats .remediation_available_count / stats .rule_count ) * 100 )
227+ remediation_coverage = round (
228+ (stats .remediation_available_count / stats .rule_count ) * 100
229+ )
224230
225231 frameworks .append (
226232 {
@@ -307,7 +313,9 @@ async def get_compliance_overview(
307313
308314 except Exception as e :
309315 logger .error (f"Error retrieving compliance overview: { e } " )
310- raise HTTPException (status_code = 500 , detail = f"Failed to retrieve compliance overview: { str (e )} " )
316+ raise HTTPException (
317+ status_code = 500 , detail = f"Failed to retrieve compliance overview: { str (e )} "
318+ )
311319
312320
313321@router .get ("/semantic-analysis/{scan_id}" )
@@ -337,9 +345,13 @@ async def get_semantic_analysis(
337345 "scan_id" : str (analysis .scan_id ),
338346 "host_id" : str (analysis .host_id ),
339347 "semantic_rules_count" : analysis .semantic_rules_count ,
340- "frameworks_analyzed" : (json .loads (analysis .frameworks_analyzed ) if analysis .frameworks_analyzed else []),
348+ "frameworks_analyzed" : (
349+ json .loads (analysis .frameworks_analyzed ) if analysis .frameworks_analyzed else []
350+ ),
341351 "remediation_available_count" : analysis .remediation_available_count ,
342- "processing_metadata" : (json .loads (analysis .processing_metadata ) if analysis .processing_metadata else {}),
352+ "processing_metadata" : (
353+ json .loads (analysis .processing_metadata ) if analysis .processing_metadata else {}
354+ ),
343355 "analysis_data" : (json .loads (analysis .analysis_data ) if analysis .analysis_data else {}),
344356 "created_at" : (analysis .created_at .isoformat () if analysis .created_at else None ),
345357 "updated_at" : (analysis .updated_at .isoformat () if analysis .updated_at else None ),
@@ -349,7 +361,9 @@ async def get_semantic_analysis(
349361 raise
350362 except Exception as e :
351363 logger .error (f"Error retrieving semantic analysis: { e } " )
352- raise HTTPException (status_code = 500 , detail = f"Failed to retrieve semantic analysis: { str (e )} " )
364+ raise HTTPException (
365+ status_code = 500 , detail = f"Failed to retrieve semantic analysis: { str (e )} "
366+ )
353367
354368
355369@router .get ("/compliance-matrix" )
@@ -386,16 +400,22 @@ async def get_compliance_matrix(
386400 {
387401 "host_id" : str (row .host_id ),
388402 "framework" : row .framework ,
389- "compliance_score" : (float (row .compliance_score ) if row .compliance_score else 0.0 ),
403+ "compliance_score" : (
404+ float (row .compliance_score ) if row .compliance_score else 0.0
405+ ),
390406 "total_rules" : row .total_rules ,
391407 "passed_rules" : row .passed_rules ,
392408 "failed_rules" : row .failed_rules ,
393409 "previous_score" : (float (row .previous_score ) if row .previous_score else None ),
394410 "trend" : row .trend ,
395411 "last_scan_id" : str (row .last_scan_id ) if row .last_scan_id else None ,
396412 "last_updated" : (row .last_updated .isoformat () if row .last_updated else None ),
397- "predicted_next_score" : (float (row .predicted_next_score ) if row .predicted_next_score else None ),
398- "prediction_confidence" : (float (row .prediction_confidence ) if row .prediction_confidence else None ),
413+ "predicted_next_score" : (
414+ float (row .predicted_next_score ) if row .predicted_next_score else None
415+ ),
416+ "prediction_confidence" : (
417+ float (row .prediction_confidence ) if row .prediction_confidence else None
418+ ),
399419 }
400420 )
401421
@@ -407,7 +427,9 @@ async def get_compliance_matrix(
407427
408428 except Exception as e :
409429 logger .error (f"Error retrieving compliance matrix: { e } " )
410- raise HTTPException (status_code = 500 , detail = f"Failed to retrieve compliance matrix: { str (e )} " )
430+ raise HTTPException (
431+ status_code = 500 , detail = f"Failed to retrieve compliance matrix: { str (e )} "
432+ )
411433
412434
413435@router .post ("/remediation/strategy" )
@@ -468,7 +490,9 @@ async def create_remediation_strategy(
468490 raise
469491 except Exception as e :
470492 logger .error (f"Error creating remediation strategy: { e } " )
471- raise HTTPException (status_code = 500 , detail = f"Failed to create remediation strategy: { str (e )} " )
493+ raise HTTPException (
494+ status_code = 500 , detail = f"Failed to create remediation strategy: { str (e )} "
495+ )
472496
473497
474498@router .get ("/health" )
0 commit comments