2026-05-22 15:47:03 +00:00
|
|
|
import type { DiseaseCatalogItem, DiseaseSlug } from './diseases';
|
2026-05-22 14:26:13 +00:00
|
|
|
|
|
|
|
|
export type ManualClassificationRequest = {
|
|
|
|
|
diseaseSlug: DiseaseSlug;
|
|
|
|
|
observation: string;
|
|
|
|
|
location: string;
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-22 15:47:03 +00:00
|
|
|
export type ManualClassificationRecord = ManualClassificationRequest & {
|
2026-05-22 14:26:13 +00:00
|
|
|
id: string;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
disease: DiseaseCatalogItem;
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-22 15:13:22 +00:00
|
|
|
export type PredictionProbability = {
|
|
|
|
|
diseaseSlug: DiseaseSlug;
|
2026-05-22 15:47:03 +00:00
|
|
|
label: string;
|
2026-05-22 15:13:22 +00:00
|
|
|
confidence: number;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type UploaderMetadata = {
|
|
|
|
|
public_id: string;
|
2026-05-22 15:47:03 +00:00
|
|
|
telegram_file_id?: string;
|
|
|
|
|
telegram_file_unique_id?: string;
|
2026-05-22 15:13:22 +00:00
|
|
|
file_name: string;
|
|
|
|
|
mime_type: string;
|
|
|
|
|
size_bytes: number;
|
|
|
|
|
file_type: string;
|
|
|
|
|
download_url: string;
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-22 15:47:03 +00:00
|
|
|
export type DiagnosisStatus =
|
|
|
|
|
| 'ai_verified'
|
|
|
|
|
| 'needs_review'
|
|
|
|
|
| 'expert_verified'
|
|
|
|
|
| 'expert_corrected'
|
|
|
|
|
| 'failed';
|
|
|
|
|
|
|
|
|
|
export type UserRole = 'user' | 'expert';
|
|
|
|
|
|
|
|
|
|
export type AuthUser = {
|
|
|
|
|
id: string;
|
|
|
|
|
email: string;
|
|
|
|
|
name: string;
|
|
|
|
|
role: UserRole;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type AuthFeatures = {
|
|
|
|
|
googleOAuthEnabled: boolean;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type AuthMeResponse = {
|
|
|
|
|
user: AuthUser | null;
|
|
|
|
|
features: AuthFeatures;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type AuthRequest = {
|
|
|
|
|
email: string;
|
|
|
|
|
password: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type RegisterRequest = AuthRequest & {
|
|
|
|
|
name: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type AuthResponse = {
|
|
|
|
|
user: AuthUser;
|
|
|
|
|
features: AuthFeatures;
|
2026-06-15 19:43:02 +07:00
|
|
|
token?: string;
|
2026-05-22 15:47:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type DiagnosisPrediction = {
|
|
|
|
|
id: string;
|
|
|
|
|
diseaseSlug: DiseaseSlug | null;
|
|
|
|
|
modelLabel: string;
|
|
|
|
|
confidence: number;
|
|
|
|
|
rank: number;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type ExpertReviewRecord = {
|
|
|
|
|
id: string;
|
|
|
|
|
diagnosisId: string;
|
|
|
|
|
expertId: string;
|
|
|
|
|
verdict: 'verified' | 'corrected';
|
|
|
|
|
correctedDiseaseSlug: DiseaseSlug | null;
|
|
|
|
|
notes: string;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
expert: AuthUser;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type DiagnosisRecord = {
|
|
|
|
|
id: string;
|
|
|
|
|
userId: string;
|
|
|
|
|
predictedDiseaseSlug: DiseaseSlug | null;
|
|
|
|
|
confidence: number | null;
|
|
|
|
|
status: DiagnosisStatus;
|
|
|
|
|
failureReason: string | null;
|
|
|
|
|
imageUrl: string;
|
|
|
|
|
uploaderPublicId: string;
|
|
|
|
|
imageFileName: string;
|
|
|
|
|
imageMimeType: string;
|
|
|
|
|
imageSizeBytes: number;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
updatedAt: string;
|
|
|
|
|
disease: DiseaseCatalogItem | null;
|
|
|
|
|
predictions: DiagnosisPrediction[];
|
|
|
|
|
latestReview: ExpertReviewRecord | null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type ReviewDiagnosisRequest = {
|
|
|
|
|
verdict: 'verified' | 'corrected';
|
|
|
|
|
correctedDiseaseSlug?: DiseaseSlug;
|
|
|
|
|
notes: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type DashboardSummary = {
|
|
|
|
|
diseaseCount: number;
|
|
|
|
|
classificationCount: number;
|
|
|
|
|
imageClassificationCount: number;
|
|
|
|
|
needsReviewCount: number;
|
|
|
|
|
riskDistribution: {
|
|
|
|
|
low: number;
|
|
|
|
|
medium: number;
|
|
|
|
|
high: number;
|
|
|
|
|
};
|
|
|
|
|
latestClassification: ManualClassificationRecord | null;
|
|
|
|
|
latestDiagnosis: DiagnosisRecord | null;
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-22 15:13:22 +00:00
|
|
|
export type ImageClassificationRecord = {
|
|
|
|
|
id: string;
|
|
|
|
|
predictedDiseaseSlug: DiseaseSlug;
|
|
|
|
|
confidence: number;
|
|
|
|
|
probabilities: PredictionProbability[];
|
|
|
|
|
imageUrl: string;
|
|
|
|
|
originalFileName: string;
|
|
|
|
|
uploaderPublicId: string;
|
|
|
|
|
uploader: UploaderMetadata;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
disease: DiseaseCatalogItem;
|
|
|
|
|
};
|