Skip to content

Commit

Permalink
Revert back HealthInsights change (#28515)
Browse files Browse the repository at this point in the history
  • Loading branch information
pshao25 authored Mar 29, 2024
1 parent e367672 commit 50b1a6f
Show file tree
Hide file tree
Showing 21 changed files with 1,545 additions and 203 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import "./model.common.shared.tsp";
import "./model.common.fhir.elements.tsp";
import "./model.common.fhir.resources.tsp";

using TypeSpec.Rest;

Expand Down Expand Up @@ -30,8 +32,11 @@ Patient structured information, including demographics and known structured clin
""")
info?: PatientInfo;

@doc("Patient encounters/visits.")
encounters?: Array<Encounter>;

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

@doc("Patient structured information, including demographics and known structured clinical information.")
Expand All @@ -43,7 +48,7 @@ model PatientInfo {
birthDate?: plainDate;

@doc("Known clinical information for the patient, structured.")
clinicalInfo?: ClinicalCodedElement[];
clinicalInfo?: Array<Fhir.R4.Resource>;
}

#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update"
Expand Down Expand Up @@ -72,22 +77,26 @@ union ClinicalDocumentType {
Consultation: "consultation",
DischargeSummary: "dischargeSummary",
HistoryAndPhysical: "historyAndPhysical",
RadiologyReport: "radiologyReport",
Procedure: "procedure",
Progress: "progress",
Imaging: "imaging",
Laboratory: "laboratory",
Pathology: "pathology",
PathologyReport: "pathologyReport",
}

#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update"
@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).
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.
""")
union DocumentContentSourceType {
string,

@doc("The content is given as a string (for instance, text).")
Inline: "inline",

@doc("The content is given as a URI.")
Reference: "reference",
}

Expand All @@ -109,10 +118,99 @@ model PatientDocument {
@doc("The date and time when the document was created.")
createdDateTime?: utcDateTime;

@doc("Document author(s)")
authors?: Array<DocumentAuthor>;

@doc("specialty type the document")
specialtyType?: SpecialtyType;

@doc("Administrative metadata for the document.")
administrativeMetadata?: DocumentAdministrativeMetadata;

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

@doc("Document administrative metadata")
model DocumentAdministrativeMetadata {
@doc("List of procedure information associated with the document.")
@minItems(1)
orderedProcedures?: Array<OrderedProcedure>;

@doc("Reference to the encounter associated with the document.")
encounterId?: string;
}

@doc("visit/encounter information")
model Encounter {
@doc("The id of the visit.")
id: string;

@doc("""
Time period of the visit.
In case of admission, use timePeriod.start to indicate the admission time and timePeriod.end to indicate the discharge time.
""")
period?: TimePeriod;

@doc("The class of the encounter.")
class?: EncounterClass;
}

@doc("Known values codes that can be used to indicate the class of encounter (TODO://Based on FHIR value set--http://....).")
union EncounterClass {
string,

@doc("""
A patient encounter where a patient is admitted by a hospital or equivalent facility, assigned to a location where patients generally stay at least overnight and provided with room, board, and continuous nursing service.
""")
InPatient: "inpatient",

@doc("""
The term ambulatory usually implies that the patient has come to the location and is not assigned to a bed. Sometimes referred to as an outpatient encounter.
""")
Ambulatory: "ambulatory",

@doc("""
An encounter where the patient usually will start in different encounter, such as one in the emergency department but then transition to this type of encounter because they require a significant period of treatment and monitoring to determine whether or not their condition warrants an inpatient admission or discharge.
""")
Observation: "observation",

@doc("""
A patient encounter that takes place at a dedicated healthcare service delivery location where the patient receives immediate evaluation and treatment, provided until the patient can be discharged or responsibility for the patient's care is transferred elsewhere (for example, the patient could be admitted as an inpatient or transferred to another facility.
""")
Emergency: "emergency",

@doc("""
A patient encounter where the patient is not physically present for the encounter, such as in a telehealth encounter, phone call, or electronic communication.
""")
Virtual: "virtual",

@doc("""
Healthcare encounter that takes place in the residence of the patient or a designee
""")
HealthHome: "healthHome",
}

@doc("Known values codes that can be used to indicate the type of the Specialty.")
union SpecialtyType {
string,

@doc("pathology")
Pathology: "pathology",

@doc("radiology")
Radiology: "radiology",
}

@doc("Document author")
model DocumentAuthor {
@doc("author id")
id?: string;

@doc("Text representation of the full name")
fullName?: string;
}

@doc("The content of the patient document.")
model DocumentContent {
@doc("""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,46 @@ using TypeSpec.Rest;

namespace AzureHealthInsights;

alias Response = {
#suppress "@azure-tools/typespec-azure-core/no-format" "This is an old spec"
@doc("A processing job identifier.")
/**
* Provides status details for long running operations.
* @template TStatusResult The type of the operation status result.
* @template TStatusError The type of the operation status error. If not provided, the default error is used.
*/
@doc("Provides status details for long running operations.")
model HealthInsightsOperationStatus<
TStatusResult = never,
TStatusError = Foundations.Error
> {
@key("operationId")
@doc("The unique ID of the operation.")
@visibility("read")
@key
jobId: Azure.Core.uuid;
id: Azure.Core.uuid;

@doc("The status of the operation")
@visibility("read")
@lroStatus
status: JobStatus;

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

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

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

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

@doc("An array of errors, if any errors occurred during the processing job.")
@visibility("read")
errors?: Azure.Core.Foundations.Error[];
};
@doc("Error object that describes the error when status is \"Failed\".")
error?: TStatusError;

@doc("The result of the operation.")
@lroResult
result?: TStatusResult;
}
////////////////// Inference //////////////////
@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.")
Expand All @@ -47,6 +59,26 @@ model Inference {
confidenceScore?: float32;
}

#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next version"
@doc("The status of the processing job.")
@lroStatus
union JobStatus {
string,
NotStarted: "notStarted",
Running: "running",

@lroSucceeded
Succeeded: "succeeded",

@lroFailed
Failed: "failed",

Canceled: "canceled",
}

@doc("The version of the model used for inference, expressed as the model date.")
scalar ModelVersion extends string;

@doc("A piece of evidence from a clinical note (text document).")
model ClinicalNoteEvidence {
@doc("The identifier of the document containing the evidence.")
Expand Down Expand Up @@ -80,30 +112,3 @@ system.
@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;
}

#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next version"
@doc("The status of the processing job.")
union JobStatus {
string,
NotStarted: "notStarted",
Running: "running",

@lroSucceeded
Succeeded: "succeeded",

@lroFailed
Failed: "failed",

PartiallyCompleted: "partiallyCompleted",
}

@doc("The version of the model used for inference, expressed as the model date.")
scalar ModelVersion extends string;
Loading

0 comments on commit 50b1a6f

Please sign in to comment.