Spaces:
Running
Running
File size: 5,120 Bytes
d075a5b | 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | """Pydantic schemas for BPO API responses."""
from pydantic import BaseModel
from typing import List, Optional, Dict, Any
# ============================================================================
# Error Response Models
# ============================================================================
class RequisitionNotFoundResponse(BaseModel):
"""Response returned when a requisition ID is not found."""
error: str
message: str
suggested_requisition_ids: List[str]
# ============================================================================
# Candidate Source Response Models
# ============================================================================
class SLAMetric(BaseModel):
"""SLA metric for a single source."""
source_name: str
sla_percentage: int
class SLAPerSourceResponse(BaseModel):
"""Response for get_sla_per_source API."""
metrics: List[SLAMetric]
class HireMetric(BaseModel):
"""Hire metric for a single source."""
source_name: str
total_hires: int
class TotalHiresBySourceResponse(BaseModel):
"""Response for get_total_hires_by_source API."""
job_id: str
metrics: List[HireMetric]
total_hires: int
class VolumeMetric(BaseModel):
"""Volume metric for a single source."""
source_name: str
candidate_volume: int
percentage: int
class CandidateVolumeResponse(BaseModel):
"""Response for get_candidate_volume_by_source API."""
job_id: str
total_candidate_volume: int
metrics: List[VolumeMetric]
heading: str
class FunnelMetric(BaseModel):
"""Funnel conversion metric for a single source."""
source_name: str
first_round_review_percentage: float
interview_rate: float
offer_acceptance_rate: float
class FunnelConversionResponse(BaseModel):
"""Response for get_funnel_conversion_by_source API."""
job_id: str
metrics: List[FunnelMetric]
class MetadataResponse(BaseModel):
"""Response for get_metadata_and_timeframe API."""
job_id: str
time_frame_start: str
time_frame_end: str
data_last_updated: str
total_requisitions_analysed: int
class DefinitionsResponse(BaseModel):
"""Response for get_definitions_and_methodology API."""
job_id: str
definitions: Dict[str, str]
calculation_notes: str
top_metrics_considered: List[str]
class SourceSummaryMetric(BaseModel):
"""Summary metric for a single source."""
source_name: str
jobs_filled_percentage: int
first_round_review_percentage: int
offer_acceptance_rate: int
total_hires: int
class SourceRecommendationResponse(BaseModel):
"""Response for get_source_recommendation_summary API."""
total_requisitions: int
metrics: List[SourceSummaryMetric]
# ============================================================================
# Skills Response Models
# ============================================================================
class SkillWithAnalysis(BaseModel):
"""Skill with historical analysis."""
name: str
skill_occurrence: int
correlation: str
class SkillAnalysisResponse(BaseModel):
"""Response for get_skill_analysis API."""
historical_jobs: int
input_skills: List[Any]
historical_skills_with_analysis: List[SkillWithAnalysis]
class ImpactMetrics(BaseModel):
"""Impact metrics for skill analysis."""
fill_rate_percentage: float
time_to_fill_days: int
candidate_pool_size: int
class SkillImpactFillRateResponse(BaseModel):
"""Response for get_skill_impact_fill_rate API."""
skill_name: str
impact: ImpactMetrics
compared_to_baseline: ImpactMetrics
class SkillImpactSLAResponse(BaseModel):
"""Response for get_skill_impact_sla API."""
requisition_id: str
skill_name: str
sla_achievement_with_skill: int
sla_achievement_without_skill: int
delta: int
class SkillJustificationImpact(BaseModel):
"""Impact metrics within justification."""
fill_rate_percentage: float
time_to_fill_days: int
candidate_pool_size: int
class SkillJustificationData(BaseModel):
"""Justification data for skill relevance."""
requisition_id: str
skill_name: str
sla_achievement_with_skill: int
sla_achievement_without_skill: int
delta: int
impact: SkillJustificationImpact
compared_to_baseline: SkillJustificationImpact
class SkillRelevanceResponse(BaseModel):
"""Response for get_skill_relevance_justification API."""
requisition_id: str
skill_name: str
is_relevant: bool
justification: SkillJustificationData
class SuccessCriteria(BaseModel):
"""Success criteria thresholds."""
time_to_fill_threshold_days: int
offer_acceptance_rate_min: int
sla_compliance_min: int
candidate_quality_rating_avg: float
class SuccessfulPostingResponse(BaseModel):
"""Response for get_successful_posting_criteria API."""
criteria: SuccessCriteria
justification: str
class DataSourcesResponse(BaseModel):
"""Response for get_data_sources_used API."""
requisition_id: str
datasets_used: List[str]
models_involved: List[str]
|