Skip to content

Commit 936070d

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/2348-add-action-buttons-in-popover-for-recommendation-system
# Conflicts: # src/main/java/de/tum/cit/aet/ai/service/AiService.java # src/main/java/de/tum/cit/aet/ai/service/ComplianceScoreService.java # src/main/resources/config/liquibase/master.xml # src/main/webapp/app/shared/components/atoms/editor/editor.component.ts # src/main/webapp/app/shared/components/molecules/ai-compliance-popover/ai-compliance-popover.component.ts # src/test/java/de/tum/cit/aet/ai/service/ComplianceScoreServiceTest.java # src/test/webapp/app/job/job-creation-form/job-creation-form.component.spec.ts
2 parents a2454dc + 5d33165 commit 936070d

73 files changed

Lines changed: 1816 additions & 1800 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: 70 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
@@ -3352,6 +3351,21 @@ components:
33523351
language: {type: string}
33533352
suggestion: {type: string}
33543353
text: {type: string}
3354+
ComplianceIssueDTO:
3355+
type: object
3356+
properties:
3357+
action:
3358+
type: string
3359+
enum: [REPLACE, ADD, REMOVE]
3360+
article: {type: string}
3361+
category:
3362+
type: string
3363+
enum: [CRITICAL_AGG, TRANSPARENCY, DSGVO_MINIMIZATION, PUBLIC_SECTOR]
3364+
explanation: {type: string}
3365+
id: {type: string}
3366+
language: {type: string}
3367+
suggestion: {type: string}
3368+
text: {type: string}
33553369
ConflictDataDTO:
33563370
type: object
33573371
properties:
@@ -3546,20 +3560,6 @@ components:
35463560
masterDegreeName: {type: string}
35473561
masterGrade: {type: string}
35483562
masterUniversity: {type: string}
3549-
GenderBiasAnalysisRequest:
3550-
type: object
3551-
properties:
3552-
language: {type: string}
3553-
text: {type: string}
3554-
GenderBiasAnalysisResponse:
3555-
type: object
3556-
properties:
3557-
biasedWords:
3558-
type: array
3559-
items: {$ref: '#/components/schemas/BiasedWordDTO'}
3560-
coding: {type: string}
3561-
language: {type: string}
3562-
originalText: {type: string}
35633563
ImageDTO:
35643564
type: object
35653565
properties:
@@ -3654,6 +3654,16 @@ components:
36543654
firstName: {type: string}
36553655
lastName: {type: string}
36563656
userId: {type: string, format: uuid}
3657+
JobAnalysisDTO:
3658+
type: object
3659+
properties:
3660+
aiScore: {type: integer, format: int32}
3661+
biasedIssues:
3662+
type: array
3663+
items: {$ref: '#/components/schemas/BiasedIssueDTO'}
3664+
complianceIssues:
3665+
type: array
3666+
items: {$ref: '#/components/schemas/ComplianceIssueDTO'}
36573667
JobCardDTO:
36583668
type: object
36593669
properties:
@@ -3695,16 +3705,19 @@ components:
36953705
JobDTO:
36963706
type: object
36973707
properties:
3708+
aiScore: {type: integer, format: int32}
3709+
biasedIssues:
3710+
type: array
3711+
items: {$ref: '#/components/schemas/BiasedIssueDTO'}
36983712
complianceIssues:
36993713
type: array
3700-
items: {$ref: '#/components/schemas/ComplianceIssue'}
3714+
items: {$ref: '#/components/schemas/ComplianceIssueDTO'}
37013715
contractDuration: {type: integer, format: int32}
37023716
endDate: {type: string, format: date}
37033717
fundingType:
37043718
type: string
37053719
enum: [FULLY_FUNDED, PARTIALLY_FUNDED, SCHOLARSHIP, SELF_FUNDED, INDUSTRY_SPONSORED,
37063720
GOVERNMENT_FUNDED, RESEARCH_GRANT]
3707-
genderBiasScore: {type: integer, format: int32}
37083721
imageId: {type: string, format: uuid}
37093722
imageUrl: {type: string}
37103723
jobDescriptionDE: {type: string}
@@ -3822,16 +3835,19 @@ components:
38223835
JobFormDTO:
38233836
type: object
38243837
properties:
3838+
aiScore: {type: integer, format: int32}
3839+
biasedIssues:
3840+
type: array
3841+
items: {$ref: '#/components/schemas/BiasedIssueDTO'}
38253842
complianceIssues:
38263843
type: array
3827-
items: {$ref: '#/components/schemas/ComplianceIssue'}
3844+
items: {$ref: '#/components/schemas/ComplianceIssueDTO'}
38283845
contractDuration: {type: integer, format: int32}
38293846
endDate: {type: string, format: date}
38303847
fundingType:
38313848
type: string
38323849
enum: [FULLY_FUNDED, PARTIALLY_FUNDED, SCHOLARSHIP, SELF_FUNDED, INDUSTRY_SPONSORED,
38333850
GOVERNMENT_FUNDED, RESEARCH_GRANT]
3834-
genderBiasScore: {type: integer, format: int32}
38353851
imageId: {type: string, format: uuid}
38363852
jobDescriptionDE: {type: string}
38373853
jobDescriptionEN: {type: string}
@@ -4336,7 +4352,6 @@ components:
43364352
TranslateComplianceDTO:
43374353
type: object
43384354
properties:
4339-
originalAnalysis: {$ref: '#/components/schemas/GenderBiasAnalysisResponse'}
43404355
text: {type: string, minLength: 1}
43414356
required: [text]
43424357
UpcomingInterviewDTO:
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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 suggestion,
17+
String language
18+
) {
19+
/**
20+
* Creates a DTO from a persisted compliance issue.
21+
*
22+
* @param issue the persisted compliance issue
23+
* @return the mapped compliance issue DTO
24+
*/
25+
public static ComplianceIssueDTO from(ComplianceIssue issue) {
26+
return new ComplianceIssueDTO(
27+
issue.getId(),
28+
issue.getCategory(),
29+
issue.getText(),
30+
issue.getArticle(),
31+
issue.getExplanation(),
32+
issue.getAction(),
33+
issue.getSuggestion(),
34+
issue.getLanguage()
35+
);
36+
}
37+
}
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)