Spaces:
Sleeping
Sleeping
[NOTICKET] Add field criteria_id in scoring v2 endpoitn
Browse files- README.md +26 -33
- interfaces/api/agentic.py +1 -0
- services/agentic/profile_scoring.py +4 -5
README.md
CHANGED
|
@@ -7,8 +7,6 @@ sdk: docker
|
|
| 7 |
app_port: 7860
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 11 |
-
|
| 12 |
## Schemas
|
| 13 |
```plain
|
| 14 |
1. Build Schema
|
|
@@ -126,41 +124,36 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
| 126 |
## List API
|
| 127 |
### User
|
| 128 |
```plain
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
```
|
| 133 |
### Tenant
|
| 134 |
```plain
|
| 135 |
-
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
```
|
| 138 |
-
|
| 139 |
-
## Create User Example
|
| 140 |
-
Input:
|
| 141 |
-
{
|
| 142 |
-
"username": "harryyanto.ia@bukittechnology.com",
|
| 143 |
-
"password": "Test12345$!",
|
| 144 |
-
"email": "harryyanto.ia@bukittechnology.com",
|
| 145 |
-
"full_name": "Harryyanto Ishaq Agasi",
|
| 146 |
-
"role": "Admin",
|
| 147 |
-
"tenant_id": "03ce53dd-9fc8-43e0-b047-c927602304a9",
|
| 148 |
-
"notes": "admin"
|
| 149 |
-
}
|
| 150 |
-
|
| 151 |
-
Output:
|
| 152 |
-
{
|
| 153 |
-
"user_id": "eb3de1ed-2e3f-4c95-b29b-b31f85f01730",
|
| 154 |
-
"username": "harryyanto.ia@bukittechnology.com",
|
| 155 |
-
"email": "harryyanto.ia@bukittechnology.com",
|
| 156 |
-
"full_name": "Harryyanto Ishaq Agasi",
|
| 157 |
-
"role": "Admin",
|
| 158 |
-
"is_active": true,
|
| 159 |
-
"tenant_id": "03ce53dd-9fc8-43e0-b047-c927602304a9",
|
| 160 |
-
"created_at": "2026-02-19T15:42:05.726988Z"
|
| 161 |
-
}
|
| 162 |
-
|
| 163 |
-
|
| 164 |
|
| 165 |
## How To
|
| 166 |
1. Init schema on DB
|
|
|
|
| 7 |
app_port: 7860
|
| 8 |
---
|
| 9 |
|
|
|
|
|
|
|
| 10 |
## Schemas
|
| 11 |
```plain
|
| 12 |
1. Build Schema
|
|
|
|
| 124 |
## List API
|
| 125 |
### User
|
| 126 |
```plain
|
| 127 |
+
POST /admin/users β
Create user
|
| 128 |
+
POST /admin/login β
Login, returns JWT Bearer token
|
| 129 |
+
GET /admin/me β
Get current authenticated user
|
| 130 |
```
|
| 131 |
### Tenant
|
| 132 |
```plain
|
| 133 |
+
POST /admin/tenants β
Create tenant
|
| 134 |
+
GET /admin/tenants/{name} β
Get tenant by name
|
| 135 |
+
```
|
| 136 |
+
### File
|
| 137 |
+
```plain
|
| 138 |
+
POST /file/upload β
Upload multiple PDF files
|
| 139 |
+
GET /file/user/{user_id} β
Get file metadata by user
|
| 140 |
+
DELETE /file/{filename} β
Soft-delete file (marks is_deleted=True)
|
| 141 |
+
GET /file/score_card β
Dashboard summary (total files, extracted profiles, %)
|
| 142 |
+
```
|
| 143 |
+
### Profile
|
| 144 |
+
```plain
|
| 145 |
+
POST /profile/extract_profile β
Extract structured profile from a CV PDF
|
| 146 |
+
GET /profile/{profile_id} β
Get extracted profile by ID
|
| 147 |
+
GET /profile/profiles/{criteria_id} β
Get profiles by criteria ID
|
| 148 |
+
```
|
| 149 |
+
### Agentic
|
| 150 |
+
```plain
|
| 151 |
+
POST /agentic/create_filter β
Create filter/criteria
|
| 152 |
+
GET /agentic/filter/{criteria_id} β
Get filter by ID
|
| 153 |
+
POST /agentic/create_weight β
Create weight config for scoring
|
| 154 |
+
POST /agentic/calculate_score β οΈ DEPRECATED Old single scoring endpoint
|
| 155 |
+
POST /agentic/v2/calculate_score β
Bulk scoring (v2, recommended)
|
| 156 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
## How To
|
| 159 |
1. Init schema on DB
|
interfaces/api/agentic.py
CHANGED
|
@@ -142,6 +142,7 @@ async def create_weight(
|
|
| 142 |
)
|
| 143 |
|
| 144 |
|
|
|
|
| 145 |
@router.post("/calculate_score")
|
| 146 |
async def calculate_score(
|
| 147 |
weight_id: str,
|
|
|
|
| 142 |
)
|
| 143 |
|
| 144 |
|
| 145 |
+
# DEPRECATED
|
| 146 |
@router.post("/calculate_score")
|
| 147 |
async def calculate_score(
|
| 148 |
weight_id: str,
|
services/agentic/profile_scoring.py
CHANGED
|
@@ -592,14 +592,10 @@ class AgenticScoringService:
|
|
| 592 |
# Create criteria_id
|
| 593 |
filter_svc = AgenticFilterService(db=self.db, user=self.user)
|
| 594 |
criteria = requirements.get("criteria")
|
| 595 |
-
print(f"DEBUG: scoring_v2/criteria: {criteria}")
|
| 596 |
|
| 597 |
weight = requirements.get("criteria_weight")
|
| 598 |
-
print(f"DEBUG: scoring_v2/weight: {weight}")
|
| 599 |
|
| 600 |
criteria_id = await filter_svc.create_filter_v2(filter=criteria)
|
| 601 |
-
print(f"DEBUG: scoring_v2/criteria_id: {criteria_id}")
|
| 602 |
-
|
| 603 |
|
| 604 |
weight_svc = AgenticWeightService(db=self.db, user=self.user)
|
| 605 |
cv_weight = CVWeight(
|
|
@@ -668,7 +664,10 @@ class AgenticScoringService:
|
|
| 668 |
# Insert Score Result to DB
|
| 669 |
scores = await create_scores(self.db, score_results)
|
| 670 |
|
| 671 |
-
return
|
|
|
|
|
|
|
|
|
|
| 672 |
except Exception as E:
|
| 673 |
logger.error(f"profile scoring v2 error, {E}")
|
| 674 |
traceback.print_exc()
|
|
|
|
| 592 |
# Create criteria_id
|
| 593 |
filter_svc = AgenticFilterService(db=self.db, user=self.user)
|
| 594 |
criteria = requirements.get("criteria")
|
|
|
|
| 595 |
|
| 596 |
weight = requirements.get("criteria_weight")
|
|
|
|
| 597 |
|
| 598 |
criteria_id = await filter_svc.create_filter_v2(filter=criteria)
|
|
|
|
|
|
|
| 599 |
|
| 600 |
weight_svc = AgenticWeightService(db=self.db, user=self.user)
|
| 601 |
cv_weight = CVWeight(
|
|
|
|
| 664 |
# Insert Score Result to DB
|
| 665 |
scores = await create_scores(self.db, score_results)
|
| 666 |
|
| 667 |
+
return {
|
| 668 |
+
"criteria_id":criteria_id,
|
| 669 |
+
"scores":scores
|
| 670 |
+
}
|
| 671 |
except Exception as E:
|
| 672 |
logger.error(f"profile scoring v2 error, {E}")
|
| 673 |
traceback.print_exc()
|