generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Data Models Add in initial pass at data models based on dev meeting * Minor Fixes
- Loading branch information
Showing
1 changed file
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import {Shape} from "react-image-label"; | ||
|
||
|
||
// ----------------------------------------------------------------------------- | ||
// Report Vision Models | ||
// ----------------------------------------------------------------------------- | ||
|
||
type Base64<imageType extends string> = `data:image/${imageType};base64${string}` | ||
|
||
interface Template { | ||
id: string; | ||
name: string; | ||
description: string; | ||
labName: string | ||
pages: Page[]; | ||
status: TemplateStatus; | ||
createdBy: User; | ||
updatedBy: User | undefined; | ||
createdAt: Date; | ||
updatedAt: Date | undefined; | ||
organization: Organization; | ||
} | ||
|
||
type TemplateStatus = "Completed" | "In Progress" | "Deprecated" | ||
|
||
interface Label { | ||
key: string; | ||
color: string; | ||
humanReadableName: string; | ||
required: boolean; | ||
createdAt: Date; | ||
updatedAt: Date | undefined; | ||
createdBy: User; | ||
updatedBy: User | undefined; | ||
} | ||
|
||
interface Page { | ||
id: string; | ||
baseImage: Base64<"png">; | ||
segmentationTemplate: Base64<"png">; | ||
labels: Label[]; | ||
shapes: Shape[]; | ||
createdAt: Date; | ||
updatedAt: Date | undefined; | ||
createdBy: User; | ||
updatedBy: User | undefined; | ||
} | ||
|
||
interface User { | ||
id: string; | ||
name: string; | ||
email: string; | ||
password: string; // This will need to be hashed and salted | ||
organization: Organization; | ||
createdAt: Date; | ||
updatedAt: Date | undefined; | ||
} | ||
|
||
interface Upload { | ||
id: string; | ||
createdBy: User; | ||
updatedBy: User | undefined; | ||
createdAt: Date; | ||
updatedAt: Date | undefined; | ||
extractions: Extraction[]; | ||
} | ||
|
||
interface Extraction { | ||
status: ExtractionStatus; | ||
segmentationTemplate: Template; | ||
pages: Base64<"png">[]; | ||
fields: ExtractedField[]; | ||
corrections: ExtractedField[]; // Human corrections | ||
createdAt: Date; | ||
updatedAt: Date | undefined; | ||
createdBy: User; | ||
updatedBy: User | undefined; | ||
} | ||
|
||
type ExtractionStatus = "In Progress" | "In Review" | "Submission" | "Discarded" | ||
|
||
interface ExtractedField { | ||
label: string; | ||
value: string; | ||
confidence: number | undefined; // Optional because it doesn't need to be stored for human corrections | ||
createdAt: Date; | ||
updatedAt: Date | undefined; | ||
createdBy: User; | ||
updatedBy: User | undefined; | ||
} | ||
|
||
interface Organization { | ||
id: string; | ||
name: string; | ||
admin: User; | ||
createdAt: Date; | ||
updatedAt: Date | undefined; | ||
} | ||
|
||
interface Notification { | ||
id: string; | ||
organization: Organization; | ||
content: string; | ||
createdBy: User; | ||
updatedBy: User | undefined; | ||
createdAt: Date; | ||
updatedAt: Date | undefined; | ||
} | ||
// ----------------------------------------------------------------------------- | ||
// Metadata Models | ||
// ----------------------------------------------------------------------------- | ||
|
||
interface FeatureFlag { | ||
id: string; | ||
name: string; | ||
enabled: boolean; | ||
createdAt: Date; | ||
updatedAt: Date | undefined; | ||
organization: Organization; | ||
// Intentionally not including createdBy and updatedBy, users aren't creating feature flags | ||
} |