Skip to content

Commit

Permalink
[Cognitive Services - Health Insights] CADL revision for public previ…
Browse files Browse the repository at this point in the history
…ew (Azure#22990)

* health insights cadl + generated openapi spec

* fix PR Comments

* change country to countryOrRegion

* split to multiple cadl projects

* update cadl-project.yaml files

* update example with generic contact details

* update samples with generic contacts

* convert cadl to typespec

* update generated openapi spec

* convert cadl to typespec (#4)

* convert cadl to typespec

* update generated openapi spec

* move ClinicalNoteEvidence to common modules

* remove redundant imports

* fix typespec dependencies

* remove dependencies from main.tsp

* using rest

* move imports from service.tsp to its caller

* fix comment - directive error

* remove imports from service.tsp
  • Loading branch information
asaflevi-ms authored Mar 22, 2023
1 parent 806d161 commit aa3618d
Show file tree
Hide file tree
Showing 29 changed files with 3,872 additions and 0 deletions.
7 changes: 7 additions & 0 deletions custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ clientaccesspolicy
clienterror
clientgroup
clientlib
clinicaltrials
clipart
CLIs
CLOGFILE
Expand Down Expand Up @@ -923,6 +924,7 @@ hdinsight
Headnode
healthbot
healthcareapis
healthinsights
healthstatus
hecto
Heatbeat
Expand Down Expand Up @@ -1008,6 +1010,7 @@ integrationaccount
integrationruntimes
Intelli
intervaled
Interventional
Intraorg
intset
intune
Expand Down Expand Up @@ -1495,6 +1498,8 @@ OIDC
onboarded
Onboarding
Onboards
Onco
oncophenotype
ondemand
onedeploy
onmachine
Expand Down Expand Up @@ -1993,6 +1998,7 @@ snapshotset
snaptshot
SNAT
SNMP
SNOMED
Sobol
softwareplan
SOHSV
Expand Down Expand Up @@ -2231,6 +2237,7 @@ transcriptmoderationresult
transferkey
translatortext
trendingtopics
trialmatcher
triggeredwebjobs
triggerruns
TSVE
Expand Down
5 changes: 5 additions & 0 deletions specification/cognitiveservices/HealthInsights/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### linux gitignore

# Ignore output files
tsp-output
package-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import "./model.common.shared.tsp";

using TypeSpec.Rest;

namespace AzureHealthInsights;

alias Request = {
@doc("The list of patients, including their clinical information and data.")
patients: PatientRecord[];
};

alias ModelConfiguration = {
@doc("An indication whether the model should produce verbose output.")
verbose?: boolean = false;

@doc("An indication whether the model's output should include evidence for the inferences.")
includeEvidence?: boolean = true;
};

@doc("A patient record, including their clinical information and data.")
model PatientRecord {
@doc("""
A given identifier for the patient. Has to be unique across all patients in a single request.
""")
@minLength(1)
id: string;

@doc("""
Patient structured information, including demographics and known structured clinical information.
""")
info?: PatientInfo;

@doc("Patient unstructured clinical data, given as documents.")
data?: PatientDocument[];
}

@doc("Patient structured information, including demographics and known structured clinical information.")
model PatientInfo {
@doc("The patient's sex.")
sex?: PatientInfoSex;

@doc("The patient's date of birth.")
birthDate?: plainDate;

@doc("Known clinical information for the patient, structured.")
clinicalInfo?: ClinicalCodedElement[];
}

@doc("The patient's sex.")
enum PatientInfoSex {
Female: "female",
Male: "male",
Unspecified: "unspecified",
}

@doc("The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document).")
enum DocumentType {
Note: "note",
FhirBundle: "fhirBundle",
Dicom: "dicom",
GenomicSequencing: "genomicSequencing",
}

@doc("The type of the clinical document.")
enum ClinicalDocumentType {
Consultation: "consultation",
DischargeSummary: "dischargeSummary",
HistoryAndPhysical: "historyAndPhysical",
Procedure: "procedure",
Progress: "progress",
Imaging: "imaging",
Laboratory: "laboratory",
Pathology: "pathology",
}

@doc("""
The type of the content's source.
In case the source type is 'inline', the content is given as a string (for instance, text).
In case the source type is 'reference', the content is given as a URI.
""")
enum DocumentContentSourceType {
Inline: "inline",
Reference: "reference",
}

@doc("A clinical document related to a patient. Document here is in the wide sense - not just a text document (note).")
model PatientDocument {
@doc("The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document).")
type: DocumentType;

@doc("The type of the clinical document.")
clinicalType?: ClinicalDocumentType;

@doc("A given identifier for the document. Has to be unique across all documents for a single patient.")
@minLength(1)
id: string;

@doc("A 2 letter ISO 639-1 representation of the language of the document.")
language?: string;

@doc("The date and time when the document was created.")
createdDateTime?: zonedDateTime;

@doc("The content of the patient document.")
content: DocumentContent;
}

@doc("The content of the patient document.")
model DocumentContent {
@doc("""
The type of the content's source.
In case the source type is 'inline', the content is given as a string (for instance, text).
In case the source type is 'reference', the content is given as a URI.
""")
sourceType: DocumentContentSourceType;

@doc("""
The content of the document, given either inline (as a string) or as a reference (URI).
""")
value: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import "./model.common.shared.tsp";

using TypeSpec.Rest;

namespace AzureHealthInsights;

alias Response = {
@doc("A processing job identifier.")
@visibility("read")
@key
@format("uuid")
jobId: string;

@doc("The date and time when the processing job was created.")
@visibility("read")
createdDateTime: zonedDateTime;

@doc("The date and time when the processing job is set to expire.")
@visibility("read")
expirationDateTime: zonedDateTime;

@doc("The date and time when the processing job was last updated.")
@visibility("read")
lastUpdateDateTime: zonedDateTime;

@doc("The status of the processing job.")
@visibility("read")
status: JobStatus;

@doc("An array of errors, if any errors occurred during the processing job.")
@visibility("read")
errors?: Azure.Core.Foundations.Error[];
};


@doc("An inference made by the model regarding a patient.")
model Inference {
@doc("The value of the inference, as relevant for the given inference type.")
value: string;

@doc("The description corresponding to the inference value.")
description?: string;

@doc("Confidence score for this inference.")
@minValue(0)
@maxValue(1)
confidenceScore?: float32;
}

@doc("A piece of evidence from a clinical note (text document).")
model ClinicalNoteEvidence {
@doc("The identifier of the document containing the evidence.")
id: string;

@doc("The actual text span which is evidence for the inference.")
text?: string;

@doc("The start index of the evidence text span in the document (0 based).")
@minValue(0)
offset: int32;

@doc("The length of the evidence text span.")
@minValue(1)
length: int32;
}

@doc("A piece of evidence corresponding to an inference.")
model InferenceEvidence {
@doc("A piece of evidence from a clinical note (text document).")
patientDataEvidence?: ClinicalNoteEvidence;

@doc("""
A piece of clinical information, expressed as a code in a clinical coding
system.
""")
patientInfoEvidence?: ClinicalCodedElement;

@doc("A value indicating how important this piece of evidence is for the inference.")
@minValue(0)
@maxValue(1)
importance?: float32;
}

@doc("A piece of evidence corresponding to a Trial Matcher inference.")
model TrialMatcherInferenceEvidence {
@doc("A piece of evidence from the eligibility criteria text of a clinical trial.")
eligibilityCriteriaEvidence?: string;
...InferenceEvidence;
}

@doc("The status of the processing job.")
enum JobStatus {
NotStarted: "notStarted",
Running: "running",
Succeeded: "succeeded",
Failed: "failed",
PartiallyCompleted: "partiallyCompleted",
}

@doc("The version of the model used for inference, expressed as the model date.")
scalar ModelVersion extends string;
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using TypeSpec.Rest;

namespace AzureHealthInsights;

@doc("""
A piece of clinical information, expressed as a code in a clinical coding system.
""")
model ClinicalCodedElement {
@doc("The clinical coding system, e.g. ICD-10, SNOMED-CT, UMLS.")
system: string;

@doc("The code within the given clinical coding system.")
code: string;

@doc("The name of this coded concept in the coding system.")
name?: string;

@doc("A value associated with the code within the given clinical coding system.")
value?: string;
}

@doc("""
A location given as a combination of city, state and country/region. It could specify a city, a state or a country/region.
In case a city is specified, either state +country/region or country/region (for countries/regions where there are no states) should be added.
In case a state is specified (without a city), country/region should be added.
""")
model GeographicLocation {
@doc("City name.")
city?: string;

@doc("State name.")
state?: string;

@doc("Country/region name.")
countryOrRegion: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Azure.Core;
using TypeSpec.Http;
namespace AzureHealthInsights;

@doc("Long running RPC operation template")
op LongRunningRpcOperation<
TParams extends object,
TResponse extends object,
Traits extends object = {}
> is RpcOperation<
TParams & Traits,
Foundations.AcceptedResponse<Traits &
Foundations.LongRunningStatusLocation &
Foundations.RetryAfterHeader &
RepeatabilityResponseHeaders> | TResponse,
Traits
>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import "@azure-tools/typespec-client-generator-core";
import "./route.oncophenotype.tsp";

import "@typespec/rest";
import "@typespec/http";
import "@typespec/versioning";
import "../healthinsights.openapi/service.tsp";

using Azure.ClientGenerator.Core;

namespace ClientForAzureHealthInsights;

@client({
name: "CancerProfilingClient",
service: AzureHealthInsights
})
interface CancerProfilingClient {
InferCancerProfile is AzureHealthInsights.OncoPhenotype.CreateJob;
}
Loading

0 comments on commit aa3618d

Please sign in to comment.