gps-global-types 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/link.types.tsx +12 -12
- package/mst.types.tsx +65 -62
- package/package.json +1 -1
package/link.types.tsx
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {BaseType,Selection, SimulationLinkDatum, SimulationNodeDatum} from 'd3';
|
|
2
|
-
import { mstGlobalTypes } from './mst.types';
|
|
1
|
+
import type { BaseType, Selection, SimulationLinkDatum, SimulationNodeDatum } from 'd3';
|
|
2
|
+
import type { mstGlobalTypes } from './mst.types.tsx';
|
|
3
3
|
interface coords {
|
|
4
|
-
x:number,
|
|
5
|
-
y:number
|
|
4
|
+
x: number,
|
|
5
|
+
y: number
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export interface EdgeType { // extends SimulationLinkDatum<NodeType>} anything not defined here was added by d3 (or i fucked up)
|
|
8
|
+
source: coords // node _id edge to
|
|
9
|
+
target: coords // node _id edge from
|
|
10
|
+
value: number // distance between source and target
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export type gLinkType =
|
|
13
|
+
export type gLinkType = Selection<SVGGElement, EdgeType, BaseType, unknown>
|
|
14
14
|
export interface LinkType {
|
|
15
|
-
g:gLinkType
|
|
15
|
+
g: gLinkType
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export interface LinkProps
|
|
18
|
+
export interface LinkProps {
|
|
19
19
|
data: EdgeType[],
|
|
20
|
-
force:mstGlobalTypes
|
|
20
|
+
force: mstGlobalTypes
|
|
21
21
|
}
|
|
22
22
|
export type svgSelection = Selection<BaseType, gLinkType, Element, LinkType>; //Selection<Element,LinkType,Element,any>
|
package/mst.types.tsx
CHANGED
|
@@ -13,15 +13,15 @@ export interface mstGlobalTypes {
|
|
|
13
13
|
fuzzyThreshold: number, //= 0, // nodes outside of requested list that are x alleles away from the original mst
|
|
14
14
|
neighbor: number, //= 1, // how many isolate neighbors to return (minimum)
|
|
15
15
|
slim?: boolean, //false //are the node labels collapsed or expanded?
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
//interactive nodes
|
|
18
18
|
// checkedNodes:mrsnId[], ????
|
|
19
19
|
// highlightedNodes:mrsnId[] ????
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export const colorFields= ['armordPatientId','mlst','sampleType','armordFacility','armordCountry','custom color'] as const; //no :string[] ! removes 'const'
|
|
23
|
-
export const dateFields= ['armordCultureDate','month','quarter','year'] as const;
|
|
24
|
-
export const labelFields= ['armordMrsnIdLBL','mrsnIdLBL','armordAccessionNumberLBL','armordPatientIdLBL','custom label'] as const;
|
|
22
|
+
export const colorFields = ['armordPatientId', 'mlst', 'sampleType', 'armordFacility', 'armordCountry', 'custom color'] as const; //no :string[] ! removes 'const'
|
|
23
|
+
export const dateFields = ['armordCultureDate', 'month', 'quarter', 'year'] as const;
|
|
24
|
+
export const labelFields = ['armordMrsnIdLBL', 'mrsnIdLBL', 'armordAccessionNumberLBL', 'armordPatientIdLBL', 'custom label'] as const;
|
|
25
25
|
|
|
26
26
|
export type colorKey = typeof colorFields[number];
|
|
27
27
|
export type dateKey = typeof dateFields[number];
|
|
@@ -32,77 +32,80 @@ export type labelKey = typeof labelFields[number];
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
type CustomDictEntry
|
|
36
|
-
type CustomDict = Record<ObjectId,CustomDictEntry>
|
|
37
|
-
|
|
35
|
+
type CustomDictEntry = Record<colorKey | dateKey, Color> | Record<labelKey, string>;
|
|
36
|
+
export type CustomDict = Record<ObjectId, CustomDictEntry>
|
|
38
37
|
|
|
39
38
|
|
|
39
|
+
export interface LatestNodes { armordCultureDate: Date | string, isos: NodeType[], _id: ObjectId[] }
|
|
40
40
|
export interface MSTGraph {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
name?:string,
|
|
42
|
+
snapshotData?:SnapshotType
|
|
43
|
+
nodes: NodeType[] // core parameter of d3tree.js . keeps all isolates collection data
|
|
44
|
+
links: EdgeType[] // core parameter of d3tree.js
|
|
45
|
+
latest: LatestNodes // earliest node for easy toggling
|
|
46
|
+
custom: CustomDict // . I KNOW THIS IS DUMB but from user's pov it results in seamless color transitions across pages
|
|
47
|
+
legend: MSTLegend // saves legend configs across all color fields
|
|
48
|
+
missing:Record<string,any>[] //todo: isolate.types. global
|
|
46
49
|
}interface FlashTable {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
"_id": ObjectId,
|
|
51
|
+
"MRSN ID¹": mrsnId,
|
|
52
|
+
"Cx Date": Date | string,
|
|
53
|
+
"Cx Source": string,
|
|
54
|
+
"Wards": string,
|
|
55
|
+
"Prev Report #²": string,
|
|
56
|
+
"Accession #": armordAccessionNumber,
|
|
57
|
+
"Last Name": "...",
|
|
58
|
+
"DOD ID": "..."
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
interface FlashData { //todo: add 'tier1s' here
|
|
59
|
-
dateCreated:Date,
|
|
60
|
-
first:boolean, //first node added to thec cluster
|
|
61
|
-
isolateCount:number,
|
|
62
|
-
lastModified:Date,
|
|
63
|
-
mostRecent:{
|
|
64
|
-
_id:ObjectId[],
|
|
65
|
-
armordCultureDate:Date|string,
|
|
66
|
-
isos:Record<string,any>[], //todo
|
|
62
|
+
dateCreated: Date,
|
|
63
|
+
first: boolean, //first node added to thec cluster
|
|
64
|
+
isolateCount: number,
|
|
65
|
+
lastModified: Date,
|
|
66
|
+
mostRecent: {
|
|
67
|
+
_id: ObjectId[],
|
|
68
|
+
armordCultureDate: Date | string,
|
|
69
|
+
isos: Record<string, any>[], //todo
|
|
67
70
|
}
|
|
68
|
-
mostCloselyRelated:{
|
|
69
|
-
_id:ObjectId,
|
|
70
|
-
armordCultureDate:Date|string,
|
|
71
|
-
distance:number
|
|
71
|
+
mostCloselyRelated: {
|
|
72
|
+
_id: ObjectId,
|
|
73
|
+
armordCultureDate: Date | string,
|
|
74
|
+
distance: number
|
|
72
75
|
},
|
|
73
|
-
patientCount:number,
|
|
74
|
-
st:string,
|
|
75
|
-
table:FlashTable[],
|
|
76
|
-
wardCount:string,
|
|
77
|
-
wgsId:string
|
|
76
|
+
patientCount: number,
|
|
77
|
+
st: string,
|
|
78
|
+
table: FlashTable[],
|
|
79
|
+
wardCount: string,
|
|
80
|
+
wgsId: string
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
|
|
81
84
|
interface MSTResult {
|
|
82
|
-
flash:FlashData,
|
|
83
|
-
graph:MSTGraph,
|
|
84
|
-
tabular:{
|
|
85
|
-
isolate:Record<string,any>[],
|
|
86
|
-
amr:Record<string,any>[]
|
|
85
|
+
flash: FlashData,
|
|
86
|
+
graph: MSTGraph,
|
|
87
|
+
tabular: {
|
|
88
|
+
isolate: Record<string, any>[],
|
|
89
|
+
amr: Record<string, any>[]
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
interface LegendBullet { //or custom upload data
|
|
91
|
-
color:Color,
|
|
92
|
-
label:string
|
|
94
|
+
color: Color,
|
|
95
|
+
label: string
|
|
93
96
|
}
|
|
94
97
|
|
|
95
|
-
type MSTLegend = Record<colorKey,LegendBullet[]
|
|
98
|
+
export type MSTLegend = Record<colorKey, LegendBullet[]> | Record<dateKey, 'date'> | { 'beforeAndAfter': [{ color: '#666666', label: 'Before ' }, { color: '#4a64aa', label: 'After ' }] }
|
|
96
99
|
|
|
97
100
|
|
|
98
101
|
|
|
99
|
-
interface SnapshotType {
|
|
100
|
-
_id:ObjectId,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
export interface SnapshotType {
|
|
103
|
+
_id: ObjectId,
|
|
104
|
+
form: mstGlobalTypes,
|
|
105
|
+
legend: LegendBullet[],
|
|
106
|
+
nodes: Record<ObjectId, LegendBullet>,
|
|
107
|
+
scheme: string,
|
|
108
|
+
transforms: Record<ObjectId, { x: number, y: number }>
|
|
106
109
|
}
|
|
107
110
|
/** /mst route RESULT
|
|
108
111
|
|
|
@@ -111,7 +114,7 @@ interface SnapshotType {
|
|
|
111
114
|
* @property {MSTGraph} data except it only requires links,nodes,legend, and custom
|
|
112
115
|
* @property {ForceObject} form
|
|
113
116
|
* @property {String|null} _id cluster _id
|
|
114
|
-
* @property {function(Snapshot)} setSnapshot
|
|
117
|
+
* @property {function(Snapshot)} setSnapshot
|
|
115
118
|
* @property {function(MSTGraph)} setData trigger parent data state which affects variables in parent
|
|
116
119
|
* @property {function([[import('../../typedefs/MSTree').mrsnId[],Boolean ]])} setSelected connects nodes to table rows on click
|
|
117
120
|
*/
|
|
@@ -122,7 +125,7 @@ interface SnapshotType {
|
|
|
122
125
|
*/
|
|
123
126
|
/**string
|
|
124
127
|
* @typedef ItolProps
|
|
125
|
-
* @property {string} scheme
|
|
128
|
+
* @property {string} scheme
|
|
126
129
|
* @property {ObjectId[]} isolates targets centered for analysis
|
|
127
130
|
* @property {int} neighbors min # of nearest samples to include (beyond targets)
|
|
128
131
|
* @property {int} threshold max allelic distance from the targets to include
|
|
@@ -135,13 +138,13 @@ interface SnapshotType {
|
|
|
135
138
|
* @property {Date} lastModified
|
|
136
139
|
* @property {Date} dateModified
|
|
137
140
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
141
|
+
*
|
|
142
|
+
*
|
|
143
|
+
*
|
|
144
|
+
*
|
|
145
|
+
*
|
|
143
146
|
* @typedef {{...SplashReq,...MstFields}} MSTreeReq
|
|
144
147
|
*
|
|
145
148
|
*/
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
// module.exports = { MSTGraph, MSTLegend, NodeType,EdgeType,Hex, ColorField,LabelField}
|
|
150
|
+
// exports.unused = {};
|