-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: extract schema types * address comments
- Loading branch information
Showing
7 changed files
with
68 additions
and
67 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
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
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
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 |
---|---|---|
@@ -1,60 +1,3 @@ | ||
// If a globally shared type or interface doesn't have a clear owner, put it here | ||
|
||
export type Category = number | string | boolean; | ||
|
||
export interface AnnotationColumn { | ||
categories?: Category[]; | ||
name: string; | ||
type: "string" | "float32" | "int32" | "categorical" | "boolean"; | ||
writable: boolean; | ||
} | ||
|
||
interface DataFrame { | ||
nObs: number; | ||
nVar: number; | ||
// TODO(thuang): Not sure what other types are available | ||
type: "float32"; | ||
} | ||
|
||
export interface LayoutColumn { | ||
dims: string[]; | ||
name: string; | ||
// TODO(thuang): Not sure what other types are available | ||
type: "float32"; | ||
} | ||
interface RawLayout { | ||
obs: LayoutColumn[]; | ||
var?: LayoutColumn[]; | ||
} | ||
|
||
interface RawAnnotations { | ||
obs: { | ||
columns: AnnotationColumn[]; | ||
index: string; | ||
}; | ||
var: { | ||
columns: AnnotationColumn[]; | ||
index: string; | ||
}; | ||
} | ||
|
||
export interface RawSchema { | ||
annotations: RawAnnotations; | ||
dataframe: DataFrame; | ||
layout: RawLayout; | ||
} | ||
|
||
interface Annotations extends RawAnnotations { | ||
obsByName: { [name: string]: AnnotationColumn }; | ||
varByName: { [name: string]: AnnotationColumn }; | ||
} | ||
|
||
interface Layout extends RawLayout { | ||
obsByName: { [name: string]: LayoutColumn }; | ||
varByName: { [name: string]: LayoutColumn }; | ||
} | ||
|
||
export interface Schema extends RawSchema { | ||
annotations: Annotations; | ||
layout: Layout; | ||
} | ||
export {}; |
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,58 @@ | ||
type Category = number | string | boolean; | ||
|
||
export interface AnnotationColumnSchema { | ||
categories?: Category[]; | ||
name: string; | ||
type: "string" | "float32" | "int32" | "categorical" | "boolean"; | ||
writable: boolean; | ||
} | ||
|
||
interface XMatrixSchema { | ||
nObs: number; | ||
nVar: number; | ||
// TODO(thuang): Not sure what other types are available | ||
type: "float32"; | ||
} | ||
|
||
export interface EmbeddingSchema { | ||
dims: string[]; | ||
name: string; | ||
// TODO(thuang): Not sure what other types are available | ||
type: "float32"; | ||
} | ||
interface RawLayoutSchema { | ||
obs: EmbeddingSchema[]; | ||
var?: EmbeddingSchema[]; | ||
} | ||
|
||
interface RawAnnotationsSchema { | ||
obs: { | ||
columns: AnnotationColumnSchema[]; | ||
index: string; | ||
}; | ||
var: { | ||
columns: AnnotationColumnSchema[]; | ||
index: string; | ||
}; | ||
} | ||
|
||
export interface RawSchema { | ||
annotations: RawAnnotationsSchema; | ||
dataframe: XMatrixSchema; | ||
layout: RawLayoutSchema; | ||
} | ||
|
||
interface AnnotationsSchema extends RawAnnotationsSchema { | ||
obsByName: { [name: string]: AnnotationColumnSchema }; | ||
varByName: { [name: string]: AnnotationColumnSchema }; | ||
} | ||
|
||
interface LayoutSchema extends RawLayoutSchema { | ||
obsByName: { [name: string]: EmbeddingSchema }; | ||
varByName: { [name: string]: EmbeddingSchema }; | ||
} | ||
|
||
export interface Schema extends RawSchema { | ||
annotations: AnnotationsSchema; | ||
layout: LayoutSchema; | ||
} |
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
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