Skip to content

Commit 5d33165

Browse files
ge94zecaz108github-actions[bot]claude
authored
Bugfix: Fix excessive api requests triggering genderdecoder (#2465)
Co-authored-by: Aniruddh Zaveri <92953467+az108@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: aniruddhzaveri <aniruddh.zaveri@tum.de> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e1f6df9 commit 5d33165

68 files changed

Lines changed: 1687 additions & 1702 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

openapi/openapi.yaml

Lines changed: 69 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,14 @@ paths:
110110
requestBody:
111111
content:
112112
application/json:
113-
schema: {$ref: '#/components/schemas/JobFormDTO'}
113+
schema: {$ref: '#/components/schemas/AnalyzeJobDescriptionRequestDTO'}
114114
required: true
115115
responses:
116116
'200':
117117
description: OK
118118
content:
119119
application/json:
120-
schema:
121-
type: array
122-
items: {$ref: '#/components/schemas/ComplianceIssue'}
120+
schema: {$ref: '#/components/schemas/JobAnalysisDTO'}
123121
/api/ai/extractPdfData:
124122
put:
125123
tags: [ai-resource]
@@ -1446,36 +1444,6 @@ paths:
14461444
content:
14471445
application/pdf:
14481446
schema: {type: string, format: binary}
1449-
/api/gender-bias/analyze:
1450-
post:
1451-
tags: [gender-bias-analysis-resource]
1452-
operationId: analyzeText
1453-
requestBody:
1454-
content:
1455-
application/json:
1456-
schema: {$ref: '#/components/schemas/GenderBiasAnalysisRequest'}
1457-
required: true
1458-
responses:
1459-
'200':
1460-
description: OK
1461-
content:
1462-
application/json:
1463-
schema: {$ref: '#/components/schemas/GenderBiasAnalysisResponse'}
1464-
/api/gender-bias/analyze-html:
1465-
post:
1466-
tags: [gender-bias-analysis-resource]
1467-
operationId: analyzeHtmlContent
1468-
requestBody:
1469-
content:
1470-
application/json:
1471-
schema: {$ref: '#/components/schemas/GenderBiasAnalysisRequest'}
1472-
required: true
1473-
responses:
1474-
'200':
1475-
description: OK
1476-
content:
1477-
application/json:
1478-
schema: {$ref: '#/components/schemas/GenderBiasAnalysisResponse'}
14791447
/api/images/defaults/job-banners:
14801448
get:
14811449
tags: [image-resource]
@@ -2064,6 +2032,26 @@ paths:
20642032
content:
20652033
application/json:
20662034
schema: {$ref: '#/components/schemas/PageAdminCreatedJobDTO'}
2035+
/api/jobs/analyze-gender-bias:
2036+
post:
2037+
tags: [job-resource]
2038+
operationId: analyzeGenderBias
2039+
parameters:
2040+
- name: lang
2041+
in: query
2042+
required: true
2043+
schema: {type: string}
2044+
requestBody:
2045+
content:
2046+
application/json:
2047+
schema: {$ref: '#/components/schemas/AnalyzeJobDescriptionRequestDTO'}
2048+
required: true
2049+
responses:
2050+
'200':
2051+
description: OK
2052+
content:
2053+
application/json:
2054+
schema: {$ref: '#/components/schemas/JobAnalysisDTO'}
20672055
/api/jobs/available:
20682056
get:
20692057
tags: [job-resource]
@@ -3128,6 +3116,14 @@ components:
31283116
AiUsageTimeRange:
31293117
type: string
31303118
enum: [LAST_DAY, LAST_WEEK, LAST_MONTH, LAST_THREE_MONTHS, ALL_TIME]
3119+
AnalyzeJobDescriptionRequestDTO:
3120+
type: object
3121+
properties:
3122+
jobDescriptionDE: {type: string}
3123+
jobDescriptionEN: {type: string}
3124+
jobId: {type: string, format: uuid}
3125+
title: {type: string}
3126+
required: [jobId]
31313127
ApplicantDTO:
31323128
type: object
31333129
properties:
@@ -3311,10 +3307,13 @@ components:
33113307
expiresIn: {type: integer, format: int64}
33123308
profileRequired: {type: boolean}
33133309
refreshExpiresIn: {type: integer, format: int64}
3314-
BiasedWordDTO:
3310+
BiasedIssueDTO:
33153311
type: object
33163312
properties:
3317-
type: {type: string}
3313+
language: {type: string}
3314+
type:
3315+
type: string
3316+
enum: [NON_INCLUSIVE, INCLUSIVE]
33183317
word: {type: string}
33193318
BookSlotRequestDTO:
33203319
type: object
@@ -3351,6 +3350,20 @@ components:
33513350
id: {type: string}
33523351
language: {type: string}
33533352
text: {type: string}
3353+
ComplianceIssueDTO:
3354+
type: object
3355+
properties:
3356+
action:
3357+
type: string
3358+
enum: [REPLACE, ADD, REMOVE]
3359+
article: {type: string}
3360+
category:
3361+
type: string
3362+
enum: [CRITICAL_AGG, TRANSPARENCY, DSGVO_MINIMIZATION, PUBLIC_SECTOR]
3363+
explanation: {type: string}
3364+
id: {type: string}
3365+
language: {type: string}
3366+
text: {type: string}
33543367
ConflictDataDTO:
33553368
type: object
33563369
properties:
@@ -3545,20 +3558,6 @@ components:
35453558
masterDegreeName: {type: string}
35463559
masterGrade: {type: string}
35473560
masterUniversity: {type: string}
3548-
GenderBiasAnalysisRequest:
3549-
type: object
3550-
properties:
3551-
language: {type: string}
3552-
text: {type: string}
3553-
GenderBiasAnalysisResponse:
3554-
type: object
3555-
properties:
3556-
biasedWords:
3557-
type: array
3558-
items: {$ref: '#/components/schemas/BiasedWordDTO'}
3559-
coding: {type: string}
3560-
language: {type: string}
3561-
originalText: {type: string}
35623561
ImageDTO:
35633562
type: object
35643563
properties:
@@ -3653,6 +3652,16 @@ components:
36533652
firstName: {type: string}
36543653
lastName: {type: string}
36553654
userId: {type: string, format: uuid}
3655+
JobAnalysisDTO:
3656+
type: object
3657+
properties:
3658+
aiScore: {type: integer, format: int32}
3659+
biasedIssues:
3660+
type: array
3661+
items: {$ref: '#/components/schemas/BiasedIssueDTO'}
3662+
complianceIssues:
3663+
type: array
3664+
items: {$ref: '#/components/schemas/ComplianceIssueDTO'}
36563665
JobCardDTO:
36573666
type: object
36583667
properties:
@@ -3694,16 +3703,19 @@ components:
36943703
JobDTO:
36953704
type: object
36963705
properties:
3706+
aiScore: {type: integer, format: int32}
3707+
biasedIssues:
3708+
type: array
3709+
items: {$ref: '#/components/schemas/BiasedIssueDTO'}
36973710
complianceIssues:
36983711
type: array
3699-
items: {$ref: '#/components/schemas/ComplianceIssue'}
3712+
items: {$ref: '#/components/schemas/ComplianceIssueDTO'}
37003713
contractDuration: {type: integer, format: int32}
37013714
endDate: {type: string, format: date}
37023715
fundingType:
37033716
type: string
37043717
enum: [FULLY_FUNDED, PARTIALLY_FUNDED, SCHOLARSHIP, SELF_FUNDED, INDUSTRY_SPONSORED,
37053718
GOVERNMENT_FUNDED, RESEARCH_GRANT]
3706-
genderBiasScore: {type: integer, format: int32}
37073719
imageId: {type: string, format: uuid}
37083720
imageUrl: {type: string}
37093721
jobDescriptionDE: {type: string}
@@ -3821,16 +3833,19 @@ components:
38213833
JobFormDTO:
38223834
type: object
38233835
properties:
3836+
aiScore: {type: integer, format: int32}
3837+
biasedIssues:
3838+
type: array
3839+
items: {$ref: '#/components/schemas/BiasedIssueDTO'}
38243840
complianceIssues:
38253841
type: array
3826-
items: {$ref: '#/components/schemas/ComplianceIssue'}
3842+
items: {$ref: '#/components/schemas/ComplianceIssueDTO'}
38273843
contractDuration: {type: integer, format: int32}
38283844
endDate: {type: string, format: date}
38293845
fundingType:
38303846
type: string
38313847
enum: [FULLY_FUNDED, PARTIALLY_FUNDED, SCHOLARSHIP, SELF_FUNDED, INDUSTRY_SPONSORED,
38323848
GOVERNMENT_FUNDED, RESEARCH_GRANT]
3833-
genderBiasScore: {type: integer, format: int32}
38343849
imageId: {type: string, format: uuid}
38353850
jobDescriptionDE: {type: string}
38363851
jobDescriptionEN: {type: string}
@@ -4334,7 +4349,6 @@ components:
43344349
TranslateComplianceDTO:
43354350
type: object
43364351
properties:
4337-
originalAnalysis: {$ref: '#/components/schemas/GenderBiasAnalysisResponse'}
43384352
text: {type: string, minLength: 1}
43394353
required: [text]
43404354
UpcomingInterviewDTO:
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package de.tum.cit.aet.ai.dto;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import de.tum.cit.aet.ai.constants.ComplianceAction;
5+
import de.tum.cit.aet.ai.constants.ComplianceCategory;
6+
import de.tum.cit.aet.ai.domain.ComplianceIssue;
7+
8+
@JsonInclude(JsonInclude.Include.NON_EMPTY)
9+
public record ComplianceIssueDTO(
10+
String id,
11+
ComplianceCategory category,
12+
String text,
13+
String article,
14+
String explanation,
15+
ComplianceAction action,
16+
String language
17+
) {
18+
/**
19+
* Creates a DTO from a persisted compliance issue.
20+
*
21+
* @param issue the persisted compliance issue
22+
* @return the mapped compliance issue DTO
23+
*/
24+
public static ComplianceIssueDTO from(ComplianceIssue issue) {
25+
return new ComplianceIssueDTO(
26+
issue.getId(),
27+
issue.getCategory(),
28+
issue.getText(),
29+
issue.getArticle(),
30+
issue.getExplanation(),
31+
issue.getAction(),
32+
issue.getLanguage()
33+
);
34+
}
35+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package de.tum.cit.aet.ai.dto;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import de.tum.cit.aet.ai.domain.ComplianceIssue;
5+
import de.tum.cit.aet.core.domain.BiasedIssue;
6+
import de.tum.cit.aet.core.dto.BiasedIssueDTO;
7+
import java.util.List;
8+
import java.util.Set;
9+
10+
@JsonInclude(JsonInclude.Include.NON_EMPTY)
11+
public record JobAnalysisDTO(Integer aiScore, List<ComplianceIssueDTO> complianceIssues, List<BiasedIssueDTO> biasedIssues) {
12+
/**
13+
* Creates an analysis DTO from the persisted issues.
14+
*
15+
* @param aiScore the combined AI score
16+
* @param complianceIssues the persisted compliance issues
17+
* @param biasedIssues the persisted biased-language issues
18+
* @return the mapped analysis DTO
19+
*/
20+
public static JobAnalysisDTO from(Integer aiScore, List<ComplianceIssue> complianceIssues, Set<BiasedIssue> biasedIssues) {
21+
return new JobAnalysisDTO(
22+
aiScore,
23+
complianceIssues.stream().map(ComplianceIssueDTO::from).toList(),
24+
biasedIssues.stream().map(BiasedIssueDTO::from).toList()
25+
);
26+
}
27+
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package de.tum.cit.aet.ai.dto;
22

33
import com.fasterxml.jackson.annotation.JsonInclude;
4-
import de.tum.cit.aet.core.dto.GenderBiasAnalysisResponse;
5-
import jakarta.annotation.Nullable;
64
import jakarta.validation.constraints.NotBlank;
75

86
@JsonInclude(JsonInclude.Include.NON_EMPTY)
9-
public record TranslateComplianceDTO(@NotBlank String text, @Nullable GenderBiasAnalysisResponse originalAnalysis) {}
7+
public record TranslateComplianceDTO(@NotBlank String text) {}

0 commit comments

Comments
 (0)