Spaces:
Running
Running
| /* ------------------------------------------------------------------ */ | |
| /* Lexical data model (UKC LMF schema, per SRS §2) */ | |
| /* ------------------------------------------------------------------ */ | |
| export type POS = "n" | "v" | "a" | "r"; | |
| export type SenseRelType = "derivation" | "antonym" | "metonym"; | |
| export type SynsetRelType = | |
| | "hypernym" | |
| | "mero_part" | |
| | "mero_substance" | |
| | "mero_member" | |
| | "attribute"; | |
| export interface SenseRelation { | |
| relType: SenseRelType; | |
| target: string; // ben-sen{integer} | |
| } | |
| export interface SynsetRelation { | |
| relType: SynsetRelType; | |
| target: string; // ben-syn{integer} | |
| } | |
| export interface Sense { | |
| id: string; // ben-sen{integer} | |
| synset: string; // ben-syn{integer} | |
| relations?: SenseRelation[]; | |
| } | |
| export interface LexicalEntry { | |
| id: string; // ben-word-{pos}{integer} | |
| lemma: string; | |
| pos: POS; | |
| senses: Sense[]; | |
| } | |
| export interface SynsetDefinition { | |
| language: "ben" | "eng"; | |
| text: string; | |
| } | |
| export interface Synset { | |
| id: string; // ben-syn{integer} | |
| ili: string; // {offset}-{pos} | |
| pos: POS; | |
| lexicalized: boolean; | |
| definition?: SynsetDefinition; | |
| relations?: SynsetRelation[]; | |
| } | |
| export interface LexiconMeta { | |
| id: string; | |
| label: string; | |
| language: string; | |
| email: string; | |
| license: string; | |
| version: string; | |
| source: string; | |
| description: string; | |
| publisher: string; | |
| } | |
| /* ------------------------------------------------------------------ */ | |
| /* Roles and access control (SRS §3) */ | |
| /* ------------------------------------------------------------------ */ | |
| export type Role = | |
| | "PLATFORM_ARCHITECT" | |
| | "SYSTEM_MODERATOR" | |
| | "CONTRIBUTOR" | |
| | "LEXICAL_EDITOR" | |
| | "CHIEF_LEXICAL_EDITOR" | |
| | "ARBITRATION_CURATOR"; | |
| export interface User { | |
| id: string; | |
| username: string; | |
| name: string; | |
| role: Role; | |
| email: string; | |
| active: boolean; | |
| suspended: boolean; | |
| joinedAt: string; // ISO date | |
| } | |
| export interface AccessToken { | |
| id: string; // UUID | |
| userId: string; | |
| role: Role; | |
| token: string; // demo token string | |
| issuedBy: string; | |
| issuedAt: string; | |
| expiresAt: string; | |
| revoked: boolean; | |
| } | |
| export interface Session { | |
| userId: string; | |
| username: string; | |
| name: string; | |
| role: Role; | |
| } | |
| /* ------------------------------------------------------------------ */ | |
| /* Entry lifecycle (SRS §5) */ | |
| /* ------------------------------------------------------------------ */ | |
| export type EntryState = | |
| | "DRAFT" | |
| | "PENDING_REVIEW" | |
| | "UNDER_REVIEW" | |
| | "FLAGGED" | |
| | "C_FLAGGED" | |
| | "EDITOR_APPROVED" | |
| | "ARBITRATION" | |
| | "VALIDATED" | |
| | "REJECTED"; | |
| export interface StateTransition { | |
| from: EntryState | null; | |
| to: EntryState; | |
| actorId: string; | |
| actorRole: Role | "SYSTEM"; | |
| timestamp: string; | |
| comment?: string; | |
| } | |
| /** A crowdsourced submission moving through the validation pipeline. */ | |
| export interface Submission { | |
| id: string; // sub-{n} | |
| state: EntryState; | |
| contributorId: string; | |
| createdAt: string; | |
| updatedAt: string; | |
| assignedTo?: string; // reviewer user id | |
| /* proposed lexical payload (Quick Input form, SRS §6.2) */ | |
| writtenForm: string; | |
| pos: POS; | |
| synsetAction: "link" | "create"; | |
| synsetId?: string; // when linking to existing synset | |
| iliCode?: string; // when creating a new synset | |
| definitionLanguage?: "ben" | "eng"; | |
| definitionText?: string; | |
| senseRelations: SenseRelation[]; | |
| synsetRelations: SynsetRelation[]; | |
| reviewerNote?: string; // contributor's note for reviewers | |
| /* review trail */ | |
| history: StateTransition[]; | |
| editorComment?: string; // latest FLAG comment | |
| cleComment?: string; // latest C_FLAG note | |
| rejectionReason?: string; | |
| validatedBy?: string; | |
| validatedAt?: string; | |
| } | |
| /* ------------------------------------------------------------------ */ | |
| /* Arbitration (SRS §7.6) */ | |
| /* ------------------------------------------------------------------ */ | |
| export type ArbitrationStatus = | |
| | "RESPONSE_WINDOW" | |
| | "ACTIVE" | |
| | "TIE_PENDING" | |
| | "RESOLVED"; | |
| export type ArbitrationVerdictOption = | |
| | "APPROVE_CLAIMANT" | |
| | "APPROVE_ACCUSED" | |
| | "REJECT"; | |
| export interface ArbitrationVote { | |
| curatorId: string; | |
| verdict: ArbitrationVerdictOption; | |
| rationale: string; | |
| correctionNote?: string; | |
| votedAt: string; | |
| } | |
| export interface ArbitrationCase { | |
| id: string; // case-{n} | |
| submissionId: string; | |
| claimantId: string; | |
| accusedId: string; | |
| disputeType: "DISPUTE_REJECTION" | "DISPUTE_FLAG" | "ESCALATION"; | |
| disputeNote: string; | |
| counterClaim?: string; | |
| openedAt: string; | |
| responseDeadline: string; | |
| status: ArbitrationStatus; | |
| votes: ArbitrationVote[]; | |
| excludedCuratorIds: string[]; // conflict-of-interest rule | |
| finalVerdict?: ArbitrationVerdictOption; | |
| verdictBy?: "PANEL" | "TIE_BREAK"; | |
| tieBrokenBy?: string; | |
| resolvedAt?: string; | |
| correctionApplied?: boolean; | |
| correctionNote?: string; | |
| } | |
| /* ------------------------------------------------------------------ */ | |
| /* Audit + configuration (SRS §3.2, §4, §5.3) */ | |
| /* ------------------------------------------------------------------ */ | |
| export interface AuditEvent { | |
| id: string; | |
| timestamp: string; | |
| actorId: string; | |
| actorRole: Role | "SYSTEM"; | |
| action: string; | |
| targetType: | |
| | "SUBMISSION" | |
| | "USER" | |
| | "TOKEN" | |
| | "EXPORT" | |
| | "CONFIG" | |
| | "ARBITRATION" | |
| | "AUTH"; | |
| targetId?: string; | |
| detail?: string; | |
| } | |
| export interface SystemConfig { | |
| maxEntriesPerSession: number; | |
| maxEntriesPerDay: number; | |
| suspensionThreshold: number; | |
| minSubmissionSeconds: number; | |
| anomalyThresholdPerHour: number; | |
| ipRequestsPerMinute: number; | |
| sessionTimeoutMinutes: number; | |
| captchaEnabled: boolean; | |
| honeypotEnabled: boolean; | |
| captchaScoreThreshold: number; | |
| } | |
| export interface ExportRecord { | |
| id: string; | |
| timestamp: string; | |
| actorId: string; | |
| entryCount: number; | |
| synsetCount: number; | |
| sha256: string; | |
| config: string; | |
| } | |