@@ -2086,6 +2086,23 @@ def uyap_status_cmd(store_dir: Optional[str] = typer.Option(None)) -> None:
20862086 typer .echo (f" inceleme blokerleri: { s ['review_blockers' ]} · admissible: { s ['admissible' ]} · admitte: { s ['admitted' ]} · dışlanan: { s ['excluded_non_terminal' ]} " )
20872087
20882088
2089+ @uyap_app .command ("inspection" )
2090+ def uyap_inspection_cmd (
2091+ date_from : Optional [str ] = typer .Option (None , "--date-from" ),
2092+ date_to : Optional [str ] = typer .Option (None , "--date-to" ),
2093+ store_dir : Optional [str ] = typer .Option (None ),
2094+ ) -> None :
2095+ """Audit ve fail-closed manuel sonuçları ayrı tutan aday inceleme defterini günceller."""
2096+ from .ingestion .uyap .bulk import finalize_inspection_statuses
2097+
2098+ result = finalize_inspection_statuses (
2099+ store_dir , date_from = date_from , date_to = date_to
2100+ )
2101+ typer .secho (f"UYAP aday inceleme sonucu: { result } " , fg = typer .colors .CYAN , bold = True )
2102+ if not result ["all_inspected" ]:
2103+ raise typer .Exit (code = 2 )
2104+
2105+
20892106@uyap_app .command ("show" )
20902107def uyap_show_cmd (
20912108 file_id : Optional [str ] = typer .Option (None , "--file-id" , help = "Dosya/Esas No ile eşleştir (ör. 2026/23)" ),
@@ -2392,6 +2409,10 @@ def uyap_campaign_cmd(
23922409 max_records : Optional [int ] = typer .Option (None , "--max-records" , min = 1 , help = "Acquire fazında toplam işlenecek en fazla kart" ),
23932410 fast_discovery : bool = typer .Option (True , "--fast/--ui" , help = "Keşifte same-origin endpoint havuzu veya seri UI" ),
23942411 concurrency : int = typer .Option (8 , "--concurrency" , min = 1 , max = 16 , help = "Hızlı keşifte eşzamanlı istek sınırı" ),
2412+ rescreen : bool = typer .Option (False , "--rescreen" , help = "Keşif metadatasını COMPLETE pencerelerde de yeniden sınıflandır" ),
2413+ residential_only : bool = typer .Option (False , "--residential-only" , help = "Acquire kuyruğuna yalnız açık konut işaretli adayları al" ),
2414+ manifest_only : bool = typer .Option (False , "--manifest-only" , help = "Acquire adaylarının belge manifestini hızlı endpoint ile tara; belge indirmez" ),
2415+ direct_acquisition : bool = typer .Option (False , "--direct" , help = "Manifest-uygun adayların iki native UDF belgesini hızlı ve KAYIT-bound edin" ),
23952416 dry_run : bool = typer .Option (False , "--dry-run" , help = "Planı göster; tarayıcıya bağlanma" ),
23962417 store_dir : Optional [str ] = typer .Option (None , help = "Çalışma deposu / checkpoint dizini" ),
23972418 genuine_path : Optional [str ] = typer .Option (None , help = "Genuine uyap.json yolu (yalnız duplicate denetimi)" ),
@@ -2427,6 +2448,24 @@ def uyap_campaign_cmd(
24272448 typer .secho ("--phase discover veya acquire olmalı" , fg = typer .colors .RED )
24282449 raise typer .Exit (code = 1 )
24292450 campaign_phase = aliases [normalized_phase ]
2451+ if rescreen and (campaign_phase != PHASE_DISCOVERY or not fast_discovery ):
2452+ typer .secho ("--rescreen yalnız --phase discover --fast ile kullanılabilir" , fg = typer .colors .RED )
2453+ raise typer .Exit (code = 1 )
2454+ if residential_only and campaign_phase != PHASE_ACQUISITION :
2455+ typer .secho ("--residential-only yalnız --phase acquire ile kullanılabilir" , fg = typer .colors .RED )
2456+ raise typer .Exit (code = 1 )
2457+ if manifest_only and (campaign_phase != PHASE_ACQUISITION or not fast_discovery ):
2458+ typer .secho ("--manifest-only yalnız --phase acquire --fast ile kullanılabilir" , fg = typer .colors .RED )
2459+ raise typer .Exit (code = 1 )
2460+ if direct_acquisition and (campaign_phase != PHASE_ACQUISITION or not fast_discovery ):
2461+ typer .secho ("--direct yalnız --phase acquire --fast ile kullanılabilir" , fg = typer .colors .RED )
2462+ raise typer .Exit (code = 1 )
2463+ if direct_acquisition and manifest_only :
2464+ typer .secho ("--direct ve --manifest-only birlikte kullanılamaz" , fg = typer .colors .RED )
2465+ raise typer .Exit (code = 1 )
2466+ if direct_acquisition and concurrency > 8 :
2467+ typer .secho ("--direct için --concurrency en fazla 8 olabilir" , fg = typer .colors .RED )
2468+ raise typer .Exit (code = 1 )
24302469 resolved_to = date_to or dt .date .today ().isoformat ()
24312470 resolved_from = date_from
24322471 if campaign_phase == PHASE_DISCOVERY and not resolved_from :
@@ -2450,17 +2489,20 @@ def uyap_campaign_cmd(
24502489 acquisition_scope = selected
24512490 if campaign_phase == PHASE_DISCOVERY :
24522491 full_plan = build_discovery_campaign_plan (
2453- selected , resolved_from , resolved_to , state = campaign_state ,
2492+ selected , resolved_from , resolved_to ,
2493+ state = {"windows" : []} if rescreen else campaign_state ,
24542494 newest_first = True , max_windows_per_province = max_windows_per_province ,
24552495 )
24562496 plan = limit_campaign_tasks (full_plan , max_provinces )
24572497 deferred_discovery_tasks = len (full_plan ) - len (plan )
24582498 else :
24592499 full_plan = build_acquisition_queue (
2460- store_dir , selected , date_from = resolved_from , date_to = date_to
2500+ store_dir , selected , date_from = resolved_from , date_to = date_to ,
2501+ residential_only = residential_only ,
24612502 )
24622503 preliminary_blockers = acquisition_queue_blockers (
2463- store_dir , selected , date_from = resolved_from , date_to = date_to
2504+ store_dir , selected , date_from = resolved_from , date_to = date_to ,
2505+ residential_only = residential_only ,
24642506 )
24652507 if max_provinces is not None :
24662508 work_provinces = {task ["province" ] for task in full_plan }
@@ -2494,14 +2536,16 @@ def uyap_campaign_cmd(
24942536 blocker_provinces ,
24952537 date_from = resolved_from ,
24962538 date_to = date_to ,
2539+ residential_only = residential_only ,
24972540 )
24982541 if campaign_phase == PHASE_ACQUISITION else []
24992542 )
25002543
25012544 discovery_mode = "fast" if fast_discovery else "ui"
2545+ property_scope = "konut" if residential_only else "tüm-taşınmaz"
25022546 typer .secho (
25032547 f"UYAP campaign · faz={ campaign_phase } · aktif il={ len (active_provinces )} · "
2504- f"görev={ len (plan )} · keşif={ discovery_mode } " ,
2548+ f"görev={ len (plan )} · keşif={ discovery_mode } · kapsam= { property_scope } " ,
25052549 fg = typer .colors .CYAN , bold = True ,
25062550 )
25072551 by_province : dict [str , int ] = {}
@@ -2540,6 +2584,30 @@ def uyap_campaign_cmd(
25402584 cdp_endpoint , store_dir = store_dir , genuine_path = genuine_path ,
25412585 request_delay_ms = delay_ms , stall_seconds = stall_timeout ,
25422586 )
2587+ if campaign_phase == PHASE_ACQUISITION and manifest_only :
2588+ result = collector .run_fast_manifest_scan (
2589+ plan , concurrency = concurrency , max_records = max_records
2590+ )
2591+ typer .secho (f"Belge manifest taraması: { result } " , fg = typer .colors .CYAN , bold = True )
2592+ if (
2593+ result .get ("stopped_reason" )
2594+ or result .get ("manifest_failures" )
2595+ or deferred_acquisition_tasks
2596+ ):
2597+ raise typer .Exit (code = 2 )
2598+ return
2599+ if campaign_phase == PHASE_ACQUISITION and direct_acquisition :
2600+ result = collector .run_fast_direct_acquisition (
2601+ plan , concurrency = concurrency , max_records = max_records
2602+ )
2603+ typer .secho (f"Doğrudan native edinim: { result } " , fg = typer .colors .CYAN , bold = True )
2604+ if (
2605+ result .get ("stopped_reason" )
2606+ or result .get ("retryable_failures" )
2607+ or deferred_acquisition_tasks
2608+ ):
2609+ raise typer .Exit (code = 2 )
2610+ return
25432611 totals = {
25442612 "windows" : 0 , "cards" : 0 , "acquired" : 0 , "failed" : 0 ,
25452613 "incomplete" : deferred_acquisition_tasks ,
@@ -2564,7 +2632,9 @@ def uyap_campaign_cmd(
25642632 remaining = max_records
25652633 if campaign_phase == PHASE_DISCOVERY :
25662634 if fast_discovery :
2567- result = collector .run_fast_discovery (plan , concurrency = concurrency )
2635+ result = collector .run_fast_discovery (
2636+ plan , concurrency = concurrency , force = rescreen
2637+ )
25682638 totals ["windows" ] += result ["windows_processed" ]
25692639 totals ["cards" ] += result ["result_cards_inspected" ]
25702640 totals ["saturated_unresolved" ] += result ["saturated_windows_unresolved" ]
0 commit comments