Skip to content

Commit a624d7f

Browse files
authored
[HealthDataAiService.Deid] SurrogateOnly version (#35903)
* Add SurrogateOnly info * Fix versioning bugs * Versioning * Add version json * Fix examples * Move/update examples * Add existing examples * Compilation updates * Formatting * Update models * Update special inputs * Update input format * Updated readme * Update in compilation * revert to orginal * Revert * revert * Pass typespec compiler tests * Update version name to 2025-07-15-preview * Remove option 1 * Fix inputLocale * Change EncodingType to TextEncodingType * Update tspconfig to resolve JS build failure
1 parent 3771488 commit a624d7f

24 files changed

+2093
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"title": "Cancel a de-identification job.",
3+
"operationId": "CancelJob",
4+
"parameters": {
5+
"api-version": "2025-07-15-preview",
6+
"name": "job_smith_documents_1",
7+
"x-ms-client-request-id": "00000000-0000-0000-0000-000000000000"
8+
},
9+
"responses": {
10+
"200": {
11+
"body": {
12+
"name": "job_smith_documents_1",
13+
"operation": "Redact",
14+
"sourceLocation": {
15+
"location": "https://blobtest.blob.core.windows.net/container",
16+
"prefix": "documents/"
17+
},
18+
"targetLocation": {
19+
"location": "https://blobtest.blob.core.windows.net/container",
20+
"prefix": "_output/",
21+
"overwrite": true
22+
},
23+
"customizations": {
24+
"redactionFormat": "[{type}]"
25+
},
26+
"status": "Canceled",
27+
"lastUpdatedAt": "2024-01-26T01:15:00.009Z",
28+
"createdAt": "2024-01-25T23:27:43.009Z",
29+
"startedAt": "2024-01-25T23:27:43.009Z",
30+
"summary": {
31+
"successful": 10,
32+
"failed": 0,
33+
"canceled": 2,
34+
"total": 12,
35+
"bytesProcessed": 4096
36+
}
37+
}
38+
}
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"title": "Create a de-identification job.",
3+
"operationId": "DeidentifyDocuments",
4+
"parameters": {
5+
"api-version": "2025-07-15-preview",
6+
"name": "job_smith_documents_1",
7+
"x-ms-client-request-id": "00000000-0000-0000-0000-000000000000",
8+
"resource": {
9+
"operation": "Redact",
10+
"sourceLocation": {
11+
"location": "https://blobtest.blob.core.windows.net/container",
12+
"prefix": "documents/"
13+
},
14+
"targetLocation": {
15+
"location": "https://blobtest.blob.core.windows.net/container",
16+
"prefix": "_output/",
17+
"overwrite": true
18+
},
19+
"customizations": {
20+
"redactionFormat": "[{type}]"
21+
}
22+
}
23+
},
24+
"responses": {
25+
"200": {
26+
"body": {
27+
"name": "job_smith_documents_1",
28+
"operation": "Redact",
29+
"sourceLocation": {
30+
"location": "https://blobtest.blob.core.windows.net/container",
31+
"prefix": "documents/"
32+
},
33+
"targetLocation": {
34+
"location": "https://blobtest.blob.core.windows.net/container",
35+
"prefix": "_output/",
36+
"overwrite": true
37+
},
38+
"customizations": {
39+
"redactionFormat": "[{type}]"
40+
},
41+
"status": "NotStarted",
42+
"lastUpdatedAt": "2024-01-26T01:15:00.009Z",
43+
"createdAt": "2024-01-25T23:27:43.009Z"
44+
}
45+
},
46+
"201": {
47+
"headers": {
48+
"original-uri": "https://contoso.com/operationstatus"
49+
},
50+
"body": {
51+
"name": "job_smith_documents_1",
52+
"operation": "Redact",
53+
"sourceLocation": {
54+
"location": "https://blobtest.blob.core.windows.net/container",
55+
"prefix": "documents/"
56+
},
57+
"targetLocation": {
58+
"location": "https://blobtest.blob.core.windows.net/container",
59+
"prefix": "_output/",
60+
"overwrite": true
61+
},
62+
"customizations": {
63+
"redactionFormat": "[{type}]"
64+
},
65+
"status": "NotStarted",
66+
"lastUpdatedAt": "2024-01-26T01:15:00.009Z",
67+
"createdAt": "2024-01-25T23:27:43.009Z"
68+
}
69+
}
70+
}
71+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"title": "De-identify text.",
3+
"operationId": "DeidentifyText",
4+
"parameters": {
5+
"api-version": "2025-07-15-preview",
6+
"x-ms-client-request-id": "00000000-0000-0000-0000-000000000000",
7+
"body": {
8+
"inputText": "Hello my name is John Smith.",
9+
"operation": "Redact",
10+
"customizations": {
11+
"redactionFormat": "[{type}]"
12+
}
13+
}
14+
},
15+
"responses": {
16+
"200": {
17+
"body": {
18+
"outputText": "Hello my name is [name]."
19+
}
20+
}
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"title": "Delete a de-identification job.",
3+
"operationId": "DeleteJob",
4+
"parameters": {
5+
"api-version": "2025-07-15-preview",
6+
"name": "job_smith_documents_1",
7+
"x-ms-client-request-id": "00000000-0000-0000-0000-000000000000"
8+
},
9+
"responses": {
10+
"204": {}
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"title": "Get a de-identification job.",
3+
"operationId": "GetJob",
4+
"parameters": {
5+
"api-version": "2025-07-15-preview",
6+
"name": "job_smith_documents_1",
7+
"x-ms-client-request-id": "00000000-0000-0000-0000-000000000000"
8+
},
9+
"responses": {
10+
"200": {
11+
"body": {
12+
"name": "job_smith_documents_1",
13+
"operation": "Surrogate",
14+
"sourceLocation": {
15+
"location": "https://blobtest.blob.core.windows.net/container",
16+
"prefix": "documents/"
17+
},
18+
"targetLocation": {
19+
"location": "https://blobtest.blob.core.windows.net/container",
20+
"prefix": "_output/",
21+
"overwrite": true
22+
},
23+
"customizations": {
24+
"surrogateLocale": "en-US"
25+
},
26+
"status": "Succeeded",
27+
"lastUpdatedAt": "2024-01-26T01:15:00.009Z",
28+
"createdAt": "2024-01-25T23:27:43.009Z",
29+
"startedAt": "2024-01-25T23:27:43.009Z",
30+
"summary": {
31+
"successful": 10,
32+
"failed": 0,
33+
"canceled": 0,
34+
"total": 10,
35+
"bytesProcessed": 4096
36+
}
37+
}
38+
}
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"title": "List processed documents within a job.",
3+
"operationId": "ListJobDocuments",
4+
"parameters": {
5+
"api-version": "2025-07-15-preview",
6+
"name": "job_smith_documents_1",
7+
"maxpagesize": 10,
8+
"continuationToken": "K1JJRDpzOEtaQWZabUQrQUNBQUFBQUFBQUFBQT09I1JUOjEjVFJDOjEwI0ZQQzpBZ0VBQUFBTUFDUUFBQUFBQUE9PQ==",
9+
"x-ms-client-request-id": "00000000-0000-0000-0000-000000000000"
10+
},
11+
"responses": {
12+
"200": {
13+
"body": {
14+
"value": [
15+
{
16+
"id": "00000000-0000-0000-0000-000000000000",
17+
"input": {
18+
"location": "https://blobtest.blob.core.windows.net/container/documents/patient_doc_1",
19+
"etag": "0x8DB638EEA0CC717"
20+
},
21+
"status": "Failed",
22+
"error": {
23+
"code": "FileNotFound",
24+
"message": "File was moved after job started.",
25+
"target": "SourceFile",
26+
"details": []
27+
}
28+
}
29+
],
30+
"nextLink": "https://deidtest.api.deid.azure.com/jobs/00000000-0000-0000-0000-000000000000/documents?maxpagesize=10&continuationToken=K1JJRDpzOEtaQWZabUQrQUNBQUFBQUFBQUFBQT09I1JUOjEjVFJDOjEwI0ZQQzpBZ0VBQUFBTUFDUUFBQUFBQUE9PQ=="
31+
}
32+
}
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"title": "List de-identification jobs.",
3+
"operationId": "ListJobs",
4+
"parameters": {
5+
"api-version": "2025-07-15-preview",
6+
"maxpagesize": 10,
7+
"continuationToken": "K1JJRDpzOEtaQWZabUQrQUNBQUFBQUFBQUFBQT09I1JUOjEjVFJDOjEwI0ZQQzpBZ0VBQUFBTUFDUUFBQUFBQUE9PQ==",
8+
"x-ms-client-request-id": "00000000-0000-0000-0000-000000000000"
9+
},
10+
"responses": {
11+
"200": {
12+
"body": {
13+
"value": [
14+
{
15+
"name": "job_smith_documents_1",
16+
"operation": "Redact",
17+
"sourceLocation": {
18+
"location": "https://blobtest.blob.core.windows.net/container",
19+
"prefix": "documents/"
20+
},
21+
"targetLocation": {
22+
"location": "https://blobtest.blob.core.windows.net/container",
23+
"prefix": "_output/",
24+
"overwrite": true
25+
},
26+
"customizations": {
27+
"redactionFormat": "[{type}]"
28+
},
29+
"status": "Succeeded",
30+
"lastUpdatedAt": "2024-01-26T01:15:00.009Z",
31+
"createdAt": "2024-01-25T23:27:43.009Z",
32+
"startedAt": "2024-01-25T23:27:43.009Z",
33+
"summary": {
34+
"successful": 10,
35+
"failed": 0,
36+
"canceled": 0,
37+
"total": 10,
38+
"bytesProcessed": 4096
39+
}
40+
}
41+
],
42+
"nextLink": "https://deidtest.api.deid.azure.com/jobs?maxpagesize=10&continuationToken=K1JJRDpzOEtaQWZabUQrQUNBQUFBQUFBQUFBQT09I1JUOjEjVFJDOjEwI0ZQQzpBZ0VBQUFBTUFDUUFBQUFBQUE9PQ=="
43+
}
44+
}
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"title": "De-identify text using SurrogateOnly operation.",
3+
"operationId": "DeidentifyText",
4+
"parameters": {
5+
"api-version": "2025-07-15-preview",
6+
"x-ms-client-request-id": "00000000-0000-0000-0000-000000000000",
7+
"body": {
8+
"inputText": "Patient John Doe was seen by Dr. Smith on 2024-01-15",
9+
"operation": "SurrogateOnly",
10+
"taggedEntities": {
11+
"encoding": "Utf16",
12+
"entities": [
13+
{
14+
"category": "Patient",
15+
"offset": 8,
16+
"length": 8,
17+
"text": "John Doe"
18+
},
19+
{
20+
"category": "Doctor",
21+
"offset": 29,
22+
"length": 9,
23+
"text": "Dr. Smith"
24+
},
25+
{
26+
"category": "Date",
27+
"offset": 42,
28+
"length": 10,
29+
"text": "2024-01-15"
30+
}
31+
]
32+
},
33+
"customizations": {
34+
"inputLocale": "es-US",
35+
"surrogateLocale": "en-US"
36+
}
37+
}
38+
},
39+
"responses": {
40+
"200": {
41+
"body": {
42+
"outputText": "Patient Michael Johnson was seen by Dr. Brown on 1987-06-23"
43+
}
44+
}
45+
}
46+
}

specification/healthdataaiservices/HealthDataAIServices.DeidServices/main.tsp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ model AadToken
3333
enum Versions {
3434
@useDependency(Azure.Core.Versions.v1_0_Preview_2)
3535
v2024_11_15: "2024-11-15",
36+
37+
@useDependency(Azure.Core.Versions.v1_0_Preview_2)
38+
v2025_07_15_preview: "2025-07-15-preview",
3639
}

specification/healthdataaiservices/HealthDataAIServices.DeidServices/models.tsp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import "@typespec/versioning";
2+
3+
using TypeSpec.Versioning;
4+
15
#suppress "@azure-tools/typespec-azure-core/casing-style" "AI Casing style to match OpenAI"
26
namespace HealthDataAIServices.DeidServices;
37

@@ -12,6 +16,10 @@ union DeidentificationOperationType {
1216
@doc("Tag Operation will detect all entities of PHI, their type, and return their locations in the document.")
1317
Tag: "Tag",
1418

19+
@doc("SurrogateOnly Operation will replace only specified entities of PHI with surrogate values.")
20+
@added(Versions.v2025_07_15_preview)
21+
SurrogateOnly: "SurrogateOnly",
22+
1523
string,
1624
}
1725

@@ -27,4 +35,8 @@ model SharedCustomizationOptions {
2735

2836
@doc("Locale in which the output surrogates are written.")
2937
surrogateLocale?: string = "en-US";
38+
39+
@doc("Locale of the input text. Used for better PHI detection. Defaults to 'en-US'.")
40+
@added(Versions.v2025_07_15_preview)
41+
inputLocale?: string = "en-US";
3042
}

0 commit comments

Comments
 (0)