@sjcrh/proteinpaint-types 2.83.0 → 2.85.0

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.
Files changed (135) hide show
  1. package/dist/routes.ts +28847 -0
  2. package/package.json +17 -11
  3. package/src/Mclass.js +0 -0
  4. package/src/checkers/routes.js +167 -0
  5. package/src/dataset.js +0 -0
  6. package/src/fileOrUrl.js +0 -0
  7. package/src/filter.js +0 -0
  8. package/src/genome.js +0 -0
  9. package/src/index.js +66 -0
  10. package/src/routes/brainImaging.js +11 -0
  11. package/src/routes/brainImagingSamples.js +11 -0
  12. package/src/routes/burden.js +44 -0
  13. package/src/routes/dataset.js +12 -0
  14. package/src/routes/dsdata.js +12 -0
  15. package/src/routes/dzimages.js +12 -0
  16. package/src/routes/errorResponse.js +0 -0
  17. package/src/routes/filter.gdc.js +0 -0
  18. package/src/routes/gdc.maf.js +17 -0
  19. package/src/routes/gdc.mafBuild.js +12 -0
  20. package/src/routes/gdc.topMutatedGenes.js +12 -0
  21. package/src/routes/genelookup.js +12 -0
  22. package/src/routes/genesetEnrichment.js +12 -0
  23. package/src/routes/genesetOverrepresentation.js +12 -0
  24. package/src/routes/healthcheck.js +23 -0
  25. package/src/routes/hicdata.js +12 -0
  26. package/src/routes/hicgenome.js +29 -0
  27. package/src/routes/hicstat.js +12 -0
  28. package/src/routes/isoformlst.js +12 -0
  29. package/src/routes/ntseq.js +12 -0
  30. package/src/routes/pdomain.js +12 -0
  31. package/src/routes/routeApi.js +0 -0
  32. package/src/routes/samplewsimages.js +12 -0
  33. package/src/routes/snp.js +11 -0
  34. package/src/routes/termdb.DE.js +13 -0
  35. package/src/routes/termdb.boxplot.js +12 -0
  36. package/src/routes/termdb.categories.js +48 -0
  37. package/src/routes/termdb.cluster.js +12 -0
  38. package/src/routes/termdb.cohort.summary.js +12 -0
  39. package/src/routes/termdb.cohorts.js +12 -0
  40. package/src/routes/termdb.descrstats.js +48 -0
  41. package/src/routes/termdb.numericcategories.js +12 -0
  42. package/src/routes/termdb.percentile.js +49 -0
  43. package/src/routes/termdb.rootterm.js +27 -0
  44. package/src/routes/termdb.sampleImages.js +12 -0
  45. package/src/routes/termdb.singleSampleMutation.js +12 -0
  46. package/src/routes/termdb.singlecellDEgenes.js +12 -0
  47. package/src/routes/termdb.singlecellData.js +12 -0
  48. package/src/routes/termdb.singlecellSamples.js +12 -0
  49. package/src/routes/termdb.termchildren.js +28 -0
  50. package/src/routes/termdb.termsbyids.js +12 -0
  51. package/src/routes/termdb.topTermsByType.js +12 -0
  52. package/src/routes/termdb.topVariablyExpressedGenes.js +12 -0
  53. package/src/routes/termdb.violin.js +49 -0
  54. package/src/routes/tileserver.js +12 -0
  55. package/src/routes/wsimages.js +12 -0
  56. package/src/terms/categorical.js +0 -0
  57. package/src/terms/condition.js +0 -0
  58. package/src/terms/geneExpression.js +0 -0
  59. package/src/terms/geneVariant.js +0 -0
  60. package/src/terms/metaboliteIntensity.js +0 -0
  61. package/src/terms/numeric.js +0 -0
  62. package/src/terms/q.js +0 -0
  63. package/src/terms/samplelst.js +0 -0
  64. package/src/terms/singleCellCellType.js +0 -0
  65. package/src/terms/singleCellGeneExpression.js +0 -0
  66. package/src/terms/snp.js +0 -0
  67. package/src/terms/snps.js +0 -0
  68. package/src/terms/term.js +0 -0
  69. package/src/terms/tw.js +0 -0
  70. package/src/terms/updated-types.js +0 -0
  71. package/src/termsetting.js +0 -0
  72. package/src/test/numeric.type.spec.js +117 -0
  73. package/src/vocab.js +0 -0
  74. package/src/Mclass.ts +0 -8
  75. package/src/dataset.ts +0 -1575
  76. package/src/docs.json +0 -16417
  77. package/src/fileOrUrl.ts +0 -15
  78. package/src/filter.ts +0 -125
  79. package/src/genome.ts +0 -123
  80. package/src/index.ts +0 -57
  81. package/src/routes/brainImaging.ts +0 -21
  82. package/src/routes/burden.ts +0 -69
  83. package/src/routes/dzimages.ts +0 -9
  84. package/src/routes/errorResponse.ts +0 -6
  85. package/src/routes/filter.gdc.ts +0 -15
  86. package/src/routes/gdc.maf.ts +0 -41
  87. package/src/routes/gdc.mafBuild.ts +0 -13
  88. package/src/routes/gdc.topMutatedGenes.ts +0 -25
  89. package/src/routes/genelookup.ts +0 -10
  90. package/src/routes/genesetEnrichment.ts +0 -46
  91. package/src/routes/genesetOverrepresentation.ts +0 -36
  92. package/src/routes/healthcheck.ts +0 -57
  93. package/src/routes/hicdata.ts +0 -37
  94. package/src/routes/hicgenome.ts +0 -22
  95. package/src/routes/hicstat.ts +0 -45
  96. package/src/routes/sampledzimages.ts +0 -1
  97. package/src/routes/samplewsimages.ts +0 -15
  98. package/src/routes/termdb.DE.ts +0 -44
  99. package/src/routes/termdb.boxplot.ts +0 -40
  100. package/src/routes/termdb.categories.ts +0 -26
  101. package/src/routes/termdb.cluster.ts +0 -86
  102. package/src/routes/termdb.getSampleImages.ts +0 -14
  103. package/src/routes/termdb.getTopTermsByType.ts +0 -21
  104. package/src/routes/termdb.getdescrstats.ts +0 -31
  105. package/src/routes/termdb.getnumericcategories.ts +0 -21
  106. package/src/routes/termdb.getpercentile.ts +0 -17
  107. package/src/routes/termdb.getrootterm.ts +0 -22
  108. package/src/routes/termdb.gettermchildren.ts +0 -21
  109. package/src/routes/termdb.singleSampleMutation.ts +0 -18
  110. package/src/routes/termdb.singlecellDEgenes.ts +0 -30
  111. package/src/routes/termdb.singlecellData.ts +0 -58
  112. package/src/routes/termdb.singlecellSamples.ts +0 -35
  113. package/src/routes/termdb.termsbyids.ts +0 -15
  114. package/src/routes/termdb.topVariablyExpressedGenes.ts +0 -45
  115. package/src/routes/termdb.violin.ts +0 -74
  116. package/src/routes/wsimages.ts +0 -12
  117. package/src/terms/categorical.ts +0 -106
  118. package/src/terms/condition.ts +0 -55
  119. package/src/terms/geneExpression.ts +0 -32
  120. package/src/terms/geneVariant.ts +0 -51
  121. package/src/terms/metaboliteIntensity.ts +0 -31
  122. package/src/terms/numeric.ts +0 -253
  123. package/src/terms/q.ts +0 -38
  124. package/src/terms/samplelst.ts +0 -41
  125. package/src/terms/singleCellCellType.ts +0 -22
  126. package/src/terms/singleCellGeneExpression.ts +0 -28
  127. package/src/terms/snp.ts +0 -28
  128. package/src/terms/snps.ts +0 -110
  129. package/src/terms/term.ts +0 -184
  130. package/src/terms/tw.ts +0 -38
  131. package/src/terms/updated-types.ts +0 -9
  132. package/src/termsetting.ts +0 -197
  133. package/src/test/numeric.type.spec.ts +0 -275
  134. package/src/typedoc.js +0 -30
  135. package/src/vocab.ts +0 -37
@@ -1,45 +0,0 @@
1
- //import GdcFilter0 from './filter.gdc'
2
- import type { Filter } from '../filter.ts'
3
- import type { ErrorResponse } from './errorResponse.ts'
4
-
5
- export type TermdbTopVariablyExpressedGenesRequest = {
6
- /** Ref genome */
7
- genome: string
8
- /** Ds label */
9
- dslabel: string
10
- /** Number of top genes requested */
11
- maxGenes: number
12
- /** optional param defined by dataset. if to scan all or subset of genes */
13
- geneSet?: {
14
- /** Indicates the geneset to return
15
- * all - all genes
16
- * custom - user defined list of genes
17
- * msigdb - msigdb geneset
18
- */
19
- type: 'all' | 'custom' | 'msigdb'
20
- /** Sent as null for 'all' types. Otherwise a list of gene symbols */
21
- geneList: string[] | null
22
- }
23
- /** optional parameter defined in gdc dataset. not used for non-gdc ds */
24
- min_median_log2_uqfpkm?: number
25
- /** filter extreme values (in native implementation): true/false */
26
- filter_extreme_values?: number
27
- /** min_count of fpkm when filter_extreme_values (in native implementation) = true */
28
- min_count?: number
29
- /** min_total_count of fpkm when filter_extreme_values (in native implementation) = true */
30
- min_total_count?: number
31
- /** Filter type: variance/inter-quartile region (in native implementation) */
32
- rank_type?: {
33
- type: 'var' | 'iqr'
34
- }
35
- filter?: Filter
36
- /** JSON, optional GDC cohort filter to restrict cases */
37
- filter0?: any //GdcFilter0
38
- }
39
-
40
- type ValidResponse = {
41
- /** Array of gene names TODO may change element to objs */
42
- genes: string[]
43
- }
44
-
45
- export type TermdbTopVariablyExpressedGenesResponse = ErrorResponse | ValidResponse
@@ -1,74 +0,0 @@
1
- import type { Filter } from '../filter.ts'
2
- import type { ErrorResponse } from './errorResponse.ts'
3
-
4
- export type getViolinRequest = {
5
- genome: string
6
- dslabel: string
7
- embedder: string
8
- /** main tw to fetch numeric data to show in violin */
9
- tw: any
10
- /** optional tw to divide tw data into multiple violins and show under one axis */
11
- divideTw?: any
12
- /** A number representing the device's pixel ratio, which may be used for rendering quality adjustments */
13
- devicePixelRatio: number
14
- /** optional mass filter */
15
- filter?: Filter
16
- /** optional read-only invisible filter TODO GdcFilter0 */
17
- filter0?: any
18
- /** A number representing the width of the SVG (Scalable Vector Graphics) box, used for rendering the chart */
19
- svgw: number
20
- /** A string with two possible values: 'horizontal' or 'vertical', indicating the orientation of the chart, either horizontal or vertical */
21
- orientation: 'horizontal' | 'vertical'
22
- /** A string representing the type of symbol used on the plot, which can be either 'circles' or 'rugs' */
23
- datasymbol: string
24
- /** A number representing the radius of the data symbols rendered on the plot */
25
- radius: number
26
- /** A number representing the width of the stroke used to generate the data symbols (data symbols are rendered on the server side) */
27
- strokeWidth: number
28
- /** A number representing the dimension perpendicular to the violin spread (the height of the axis) */
29
- axisHeight: number
30
- /** A number representing the right margin of the chart or plot */
31
- rightMargin: number
32
- /** A string representing a unit of measurement (e.g., 'log' for log scale) */
33
- unit: string
34
- /** ?? */
35
- isKDE: boolean
36
- }
37
-
38
- interface binsEntries {
39
- x0: number
40
- x1: number
41
- density: number
42
- }
43
- interface valuesEntries {
44
- id: string
45
- label: string
46
- value: number
47
- }
48
-
49
- interface pvalueEntries {
50
- value?: string
51
- html?: string
52
- }
53
-
54
- type plot = {
55
- label: string
56
- plotValueCount: number
57
- src: string
58
- bins: binsEntries[]
59
- densityMax: number
60
- biggestBin: number
61
- summaryStats: {
62
- values: valuesEntries[]
63
- }
64
- }
65
-
66
- export type getViolinResponse = ValidResponse | ErrorResponse
67
-
68
- type ValidResponse = {
69
- min: number
70
- max: number
71
- plots: plot[]
72
- pvalues?: pvalueEntries[][]
73
- uncomputableValueObj: any
74
- }
@@ -1,12 +0,0 @@
1
- export type GetWSImagesRequest = {
2
- genome: string
3
- dslabel: string
4
- sampleId: string
5
- wsimage: string
6
- }
7
-
8
- export type GetWSImagesResponse = {
9
- sessionId: string
10
- slide_dimensions: number[]
11
- status: string
12
- }
@@ -1,106 +0,0 @@
1
- import {
2
- BaseTerm,
3
- TermValues,
4
- GroupSettingQ,
5
- ValuesQ,
6
- TermGroupSetting,
7
- BaseTW,
8
- PredefinedGroupSettingQ,
9
- CustomGroupSettingQ
10
- } from './term.ts'
11
- import { RawValuesQ, RawPredefinedGroupsetQ, RawCustomGroupsetQ, MinBaseQ } from './q.ts'
12
- import { TermSettingInstance } from '../termsetting.ts'
13
-
14
- /**
15
- * A raw categorical term q object, before filling-in
16
- *
17
- * test:CategoricalQ:
18
- *
19
- * @category TW
20
- */
21
-
22
- export type RawCatTWValues = BaseTW & {
23
- type?: 'CatTWValues'
24
- /** must already exist, for dictionary terms, TwRouter.fill() will use mayHydrateDictTwLst() */
25
- term: CategoricalTerm
26
- q: RawValuesQ
27
- }
28
-
29
- export type RawCatTWPredefinedGS = BaseTW & {
30
- type?: 'CatTWPredefinedGS'
31
- term: CategoricalTerm
32
- q: RawPredefinedGroupsetQ
33
- }
34
-
35
- export type RawCatTWCustomGS = BaseTW & {
36
- type?: 'CatTWCustomGS'
37
- term: CategoricalTerm
38
- q: RawCustomGroupsetQ
39
- }
40
-
41
- export type RawCatTW = RawCatTWValues | RawCatTWPredefinedGS | RawCatTWCustomGS
42
-
43
- export type CategoricalBaseQ = MinBaseQ & {
44
- mode?: 'discrete' | 'binary'
45
- }
46
-
47
- export type CategoricalQ = GroupSettingQ | ValuesQ
48
-
49
- export type CategoricalTerm = BaseTerm & {
50
- type: 'categorical'
51
- values: TermValues
52
- groupsetting: TermGroupSetting
53
- }
54
-
55
- /**
56
- * A categorical term wrapper object
57
- *
58
- * @group Termdb
59
- * @category TW
60
- */
61
-
62
- export type CategoricalTW = BaseTW & {
63
- //id: string
64
- type: 'CatTWValues' | 'CatTWPredefinedGS' | 'CatTWCustomGS'
65
- q: CategoricalQ
66
- term: CategoricalTerm
67
- }
68
-
69
- export type CatTWValues = BaseTW & {
70
- //id: string
71
- term: CategoricalTerm
72
- q: ValuesQ
73
- type: 'CatTWValues'
74
- // do not use this boolean flag, defined here only to help illustrate
75
- // in tw/test/fake/app.js why this is type check error prone and
76
- // less preferred than a discriminant prop that also works at runtime
77
- isCatTWValues?: true
78
- }
79
-
80
- export type CatTWPredefinedGS = BaseTW & {
81
- //id: string
82
- term: CategoricalTerm
83
- q: PredefinedGroupSettingQ
84
- type: 'CatTWPredefinedGS'
85
- // do not use this boolean flag, defined here only to help illustrate
86
- // in tw/test/fake/app.js why this is type check error prone and
87
- // less preferred than a discriminant prop that also works at runtime
88
- isCatTWPredefiendGS?: true
89
- }
90
-
91
- export type CatTWCustomGS = BaseTW & {
92
- //id: string
93
- term: CategoricalTerm
94
- q: CustomGroupSettingQ
95
- type: 'CatTWCustomGS'
96
- }
97
-
98
- export type CatTWTypes = CatTWValues | CatTWPredefinedGS | CatTWCustomGS
99
-
100
- export type CategoricalTermSettingInstance = TermSettingInstance & {
101
- q: CategoricalQ
102
- term: CategoricalTerm
103
- category2samplecount: any
104
- validateGroupsetting: () => { text: string; bgcolor?: string }
105
- error?: string
106
- }
@@ -1,55 +0,0 @@
1
- import { BaseTerm, BaseQ, TermValues } from './term.ts'
2
- import { TermWrapper } from './tw.ts'
3
-
4
- /**
5
- * @category TW
6
- */
7
-
8
- export type ConditionQ = BaseQ & {
9
- mode: 'discrete' | 'binary' | 'cuminc' | 'cox'
10
- type?: 'values'
11
- bar_by_children?: boolean // 'true' if term is not a leaf and has subconditions
12
- bar_by_grade?: boolean /* 'true' for barchart. Always 'true' for cuminc and logistic/cox outcome (children terms are not allowed for those cases)
13
- when 'true', 'value_by_*' flags are effective.*/
14
- breaks?: number[] /*
15
- Breaks grades into groups
16
- Array length=1, will break grades to 2 groups.
17
- E.g. [3] divides to [-1,0,1,2,], [3,4,5]
18
- Allowed for both conditionModes "discrete/binary"
19
- Array length=2, break to 3 groups.
20
- E.g. [1,2] divides to [-1,0], [1], [2,3,4,5]
21
- E.g. [1,3] divides to [-1,0], [1,2], [3,4,5]
22
- Only allowed for conditionMode="discrete" but not "binary"
23
- */
24
- timeScale: 'age' | 'time'
25
- value_by_max_grade?: boolean //'false' if bar_by_children is 'true'
26
- value_by_most_recent?: boolean //'false' if bar_by_children is 'true'
27
- value_by_computable_grade?: boolean //'true' if bar_by_children is 'true'
28
- groups?: any // TODO: should use a defined type
29
- }
30
-
31
- export type ConditionTerm = BaseTerm & {
32
- type: 'condition'
33
- values: TermValues
34
- }
35
-
36
- /**
37
- * @group Termdb
38
- * @category TW
39
- */
40
- export type ConditionTW = TermWrapper & {
41
- term: ConditionTerm
42
- q: ConditionQ //replace the generic Q with specific condition Q
43
- }
44
-
45
- /**
46
- * @group Termdb
47
- * @category TW
48
- */
49
- /*
50
- export type ConditionTermSettingInstance = TermSettingInstance & {
51
- q: ConditionQ
52
- category2samplecount: { key: string; label: string; count: number }[]
53
- refGrp: any
54
- }
55
- */
@@ -1,32 +0,0 @@
1
- import { TermWrapper } from './tw.ts'
2
- import { NumericTerm, NumericQ } from './numeric.ts'
3
- import { TermSettingInstance } from '../termsetting.ts'
4
-
5
- /*
6
- --------EXPORTED--------
7
- GeneExpressionQ
8
- GeneExpressionTermWrapper
9
- GeneExpressionTermSettingInstance
10
-
11
- */
12
-
13
- export type GeneExpressionQ = NumericQ & { dt?: number }
14
-
15
- export type GeneExpressionTW = TermWrapper & {
16
- q: GeneExpressionQ
17
- term: GeneExpressionTerm
18
- }
19
-
20
- export type GeneExpressionTerm = NumericTerm & {
21
- gene: string
22
- // temporarily allowing chr/start/stop to support
23
- // legacy fpkm files
24
- chr?: string
25
- start?: number
26
- stop?: number
27
- }
28
-
29
- export type GeneExpressionTermSettingInstance = TermSettingInstance & {
30
- q: GeneExpressionQ
31
- term: GeneExpressionTerm
32
- }
@@ -1,51 +0,0 @@
1
- import { MinBaseQ, BaseTerm, EnabledTermGroupSetting, BaseTW, GroupSettingQ, ValuesQ } from '../index.ts'
2
- import { TermSettingInstance } from '../termsetting.ts'
3
-
4
- export type GeneVariantBaseQ = MinBaseQ & {
5
- cnvGainCutoff?: number
6
- cnvMaxLength?: number
7
- cnvMinAbsValue?: number
8
- cnvLossCutoff?: number
9
- exclude: string[]
10
- dt?: number
11
- origin?: string
12
- }
13
-
14
- export type GeneVariantQ = GeneVariantBaseQ & (ValuesQ | GroupSettingQ)
15
-
16
- type GeneVariantBaseTerm = BaseTerm & {
17
- type: 'geneVariant'
18
- groupsetting: EnabledTermGroupSetting
19
- }
20
-
21
- export type GeneVariantGeneTerm = GeneVariantBaseTerm & {
22
- kind: 'gene'
23
- gene: string
24
- // chr,start,stop should exist together as a separate type called
25
- // 'Coord', but hard to code as atomic `& Coord` because it may
26
- // need to be filled in
27
- chr?: string
28
- start?: number
29
- stop?: number
30
- }
31
-
32
- export type GeneVariantCoordTerm = GeneVariantBaseTerm & {
33
- kind: 'coord'
34
- chr: string
35
- start: number
36
- stop: number
37
- }
38
-
39
- export type GeneVariantTerm = GeneVariantGeneTerm | GeneVariantCoordTerm
40
-
41
- export type GeneVariantTW = BaseTW & {
42
- term: GeneVariantTerm
43
- q: GeneVariantQ
44
- }
45
-
46
- export type GeneVariantTermSettingInstance = TermSettingInstance & {
47
- q: GeneVariantQ
48
- term: GeneVariantTerm
49
- category2samplecount: any
50
- groupSettingInstance?: any
51
- }
@@ -1,31 +0,0 @@
1
- import { TermWrapper } from './tw.ts'
2
- import { BaseQ } from './term.ts'
3
- import { NumericTerm } from './numeric.ts'
4
- import { TermSettingInstance } from '../termsetting.ts'
5
-
6
- /*
7
- --------EXPORTED--------
8
- MetaboliteIntensityQ
9
- MetaboliteIntensityTermWrapper
10
- MetaboliteIntensityTermSettingInstance
11
-
12
- */
13
-
14
- export type MetaboliteIntensityQ = BaseQ & {
15
- mode: 'continuous'
16
- }
17
-
18
- export type MetaboliteIntensityTW = TermWrapper & {
19
- q: MetaboliteIntensityQ
20
- term: MetaboliteIntensityTerm
21
- }
22
-
23
- export type MetaboliteIntensityTerm = NumericTerm & {
24
- metabolite: string
25
- bins: any
26
- }
27
-
28
- export type MetaboliteIntensityTermSettingInstance = TermSettingInstance & {
29
- q: MetaboliteIntensityQ
30
- term: MetaboliteIntensityTerm
31
- }
@@ -1,253 +0,0 @@
1
- import { MinBaseQ, BaseTW, TermValues, BaseTerm } from '../index.ts'
2
-
3
- export type RawRegularBin = Partial<RegularNumericBinConfig> & { preferredBins?: string }
4
-
5
- export type RawNumTWRegularBin = BaseTW & {
6
- type?: 'NumTWRegularBin'
7
- term: NumericTerm
8
- q: RawRegularBin
9
- }
10
-
11
- export type RawCustomBin = Partial<CustomNumericBinConfig> & { preferredBins?: string }
12
-
13
- export type RawNumTWCustomBin = BaseTW & {
14
- type?: 'NumTWCustomBin'
15
- term: NumericTerm
16
- q: RawCustomBin
17
- }
18
-
19
- export type RawNumTWCont = BaseTW & {
20
- type?: 'NumTWCont'
21
- term: NumericTerm
22
- q: ContinuousNumericQ
23
- }
24
-
25
- export type RawNumTWSpline = BaseTW & {
26
- type?: 'NumTWSpline'
27
- term: NumericTerm
28
- q: SplineNumericQ
29
- }
30
-
31
- export type RawNumTW = RawNumTWCustomBin | RawNumTWRegularBin | RawNumTWCont | RawNumTWSpline
32
-
33
- export type NumericTerm = BaseTerm & {
34
- id?: string
35
- // these concrete term.type values make it clear that only these are numeric,
36
- // "categorical", "condition", and other term.types are not included in this union
37
- type: 'integer' | 'float' | 'geneExpression' | 'metaboliteIntensity'
38
- bins: PresetNumericBins
39
- values?: TermValues
40
- unit?: string
41
- /*densityNotAvailable?: boolean //Not used?
42
- logScale?: string | number
43
- max?: number
44
- min?: number
45
- name?: string
46
- skip0forPercentile?: boolean
47
- tvs?: Tvs
48
- values?: TermValues
49
- unit?: string
50
- valueConversion?: ValueConversion*/
51
- }
52
-
53
- export type NumericDictTerm = BaseTerm & {
54
- id?: string
55
- type: 'integer' | 'float'
56
- bins: PresetNumericBins
57
- values?: TermValues
58
- unit?: string
59
- }
60
-
61
- export type StartUnboundedBin = {
62
- // where possible, assign a concrete value (true) when it is known in advance,
63
- // in which case, do not use an abstract type (boolean) to startunbounded
64
- startunbounded: true
65
- startinclusive?: false // cannot include an infinite bound
66
- stop: number
67
- stopinclusive?: boolean
68
- stopunbounded?: false
69
- label?: string
70
- }
71
-
72
- export type StopUnboundedBin = {
73
- start: number
74
- stopunbounded: true
75
- startinclusive?: boolean
76
- startunbounded?: false
77
- stopinclusive?: false // cannot include an infinite bound
78
- label?: string
79
- }
80
-
81
- // TODO??? should separate a fully bounded bin by startinclusive, stopinclusive
82
- // since neighboring bins must not contain the same boundary value
83
- export type FullyBoundedBin = {
84
- startunbounded?: false
85
- startinclusive?: boolean
86
- start: number
87
- stop: number
88
- stopinclusive?: boolean
89
- stopunbounded?: false
90
- label?: string
91
- }
92
-
93
- export type NumericBin = StartUnboundedBin | FullyBoundedBin | StopUnboundedBin
94
-
95
- export type RegularNumericBinConfig = MinBaseQ & {
96
- type: 'regular-bin' // another concrete value being assigned, instead of `string`
97
- //regular-sized bins
98
- mode?: 'discrete'
99
- bin_size: number
100
- // first_bin.stop is always required
101
- first_bin: StartUnboundedBin | FullyBoundedBin
102
-
103
- // if last_bin?.start is set, then a fixed last bin is used; otherwise it's not fixed and computed from data
104
- last_bin?: StopUnboundedBin | FullyBoundedBin
105
- label_offset?: number
106
- }
107
-
108
- export type CustomNumericBinConfig = MinBaseQ & {
109
- type: 'custom-bin'
110
- mode?: 'discrete' | 'binary'
111
- // since ts will allow NumericBin[] to be empty,
112
- // use this workaround to define a non-empty array
113
- lst: [NumericBin, ...NumericBin[]]
114
- preferredBins?: 'median'
115
- }
116
-
117
- // |
118
- // {
119
- // type?: 'custom-bin'
120
- // mode?: 'discrete' | 'binary'
121
- // // since ts will allow NumericBin[] to be empty,
122
- // // use this workaround to define a non-empty array
123
- // lst?: [NumericBin, ...NumericBin[]]
124
- // }
125
-
126
- /*export type NumericQ = BaseQ & {
127
- // termType: 'float' | 'integer' -- converts to 'numeric'
128
- preferredBins?: 'median' | 'less' | 'default'
129
- modeBinaryCutoffType: 'normal' | 'percentile'
130
- modeBinaryCutoffPercentile?: number
131
- knots?: any //[]?
132
- scale?: number //0.1 | 0.01 | 0.001
133
- rounding: string
134
- }*/
135
-
136
- export type PresetNumericBins = {
137
- default: RegularNumericBinConfig | CustomNumericBinConfig
138
- less: RegularNumericBinConfig | CustomNumericBinConfig
139
- label_offset?: number
140
- label_offset_ignored?: boolean
141
- rounding?: string
142
- min?: number
143
- max?: number
144
- }
145
-
146
- export type BinnedNumericQ = RegularNumericBinConfig | CustomNumericBinConfig
147
-
148
- export type DiscreteNumericQ = BinnedNumericQ //&
149
- // MinBaseQ & {
150
- // mode: 'discrete' | 'binary'
151
- // }
152
-
153
- // TODO: test with live code that defines an actual binary q object
154
- export type BinaryNumericQ = MinBaseQ & {
155
- mode: 'binary'
156
- type: 'custom-bin'
157
- // tuple type with 2 members
158
- lst: [StartUnboundedBin | FullyBoundedBin, StopUnboundedBin | FullyBoundedBin]
159
- }
160
-
161
- export type ContinuousNumericQ = MinBaseQ & {
162
- mode: 'continuous'
163
- // TODO: do not use a boolean, convert to a `transform: 'zscore' | ...` option
164
- convert2ZScore?: boolean
165
- //scale?: string
166
- // todo below: q.type is expected to be undefined for now,
167
- // but may be used later like in other q.modes,
168
- // making type optional here makes NumericQ operations/conditions
169
- // work consistently within the TermWrapper union type
170
- type?: undefined
171
- }
172
-
173
- export type SplineNumericQ = MinBaseQ & {
174
- mode: 'spline'
175
- knots: {
176
- value: number
177
- }[]
178
- // todo below: q.type is expected to be undefined for now,
179
- // but may be used later like in other q.modes,
180
- // making type optional here makes NumericQ operations/conditions
181
- // work consistently within the TermWrapper union type
182
- type?: undefined
183
- }
184
-
185
- export type NumericQ = DiscreteNumericQ | BinaryNumericQ | ContinuousNumericQ | SplineNumericQ
186
-
187
- export type NumericTW = BaseTW & {
188
- //id: string
189
- term: NumericTerm
190
- q: NumericQ
191
- }
192
-
193
- export type NumTWDiscrete = BaseTW & {
194
- type: 'NumTWDiscrete'
195
- term: NumericTerm
196
- q: DiscreteNumericQ
197
- }
198
-
199
- export type NumTWRegularBin = BaseTW & {
200
- type: 'NumTWRegularBin'
201
- term: NumericTerm
202
- q: RegularNumericBinConfig
203
- }
204
-
205
- export type NumTWCustomBin = BaseTW & {
206
- type: 'NumTWCustomBin'
207
- term: NumericTerm
208
- q: CustomNumericBinConfig
209
- }
210
-
211
- export type NumTWBinaryBin = BaseTW & {
212
- type: 'NumTWBinaryBin'
213
- term: NumericTerm
214
- q: BinaryNumericQ
215
- }
216
-
217
- export type NumTWBinary = BaseTW & {
218
- type: 'NumTWBinary'
219
- term: NumericTerm
220
- q: BinaryNumericQ
221
- }
222
-
223
- export type NumTWCont = BaseTW & {
224
- type: 'NumTWCont'
225
- term: NumericTerm
226
- q: ContinuousNumericQ
227
- }
228
-
229
- export type NumTWSpline = BaseTW & {
230
- type: 'NumTWSpline'
231
- term: NumericTerm
232
- q: SplineNumericQ
233
- }
234
-
235
- export type NumTWTypes = NumTWRegularBin | NumTWCustomBin | NumTWBinary | NumTWCont | NumTWSpline
236
- export type NumTWDiscreteTypes = NumTWRegularBin | NumTWCustomBin //| NumTWBinary
237
-
238
- export type DefaultMedianQ = {
239
- isAtomic?: true
240
- mode: 'discrete'
241
- type: 'custom-bin'
242
- preferredBins: 'median'
243
- lst: []
244
- }
245
-
246
- export type DefaultBinnedQ = {
247
- isAtomic: true
248
- mode: 'discrete'
249
- type: 'regular-bin' | 'custom-bin'
250
- preferredBins: 'default' | 'less'
251
- }
252
-
253
- export type DefaultNumericQ = NumericQ | DefaultBinnedQ | DefaultMedianQ
package/src/terms/q.ts DELETED
@@ -1,38 +0,0 @@
1
- import { HiddenValues, GroupSettingQ, GroupEntry } from './term.ts'
2
-
3
- // MinBaseQ is BaseQ without .mode and .type
4
- // MinBaseQ should eventually replace BaseQ because .mode and .type
5
- // should be specified in a term-type-specific manner
6
- export type MinBaseQ = {
7
- /**Automatically set by fillTermWrapper()
8
- Applies to barchart, survival plot, and cuminc plot.
9
- Contains categories of a term to be hidden in its chart. This should only apply to client-side rendering, and should not be part of “dataName” when requesting data from server. Server will always provide a summary for all categories. It’s up to the client to show/hide categories.
10
- This allows the key visibility to be stored in state, while toggling visibility will not trigger data re-request.
11
- Currently termsetting menu does not manage this attribute. It’s managed by barchart legend.
12
- */
13
- hiddenValues?: HiddenValues
14
- /**indicates this object should not be extended by a copy-merge tool */
15
- isAtomic?: true
16
- name?: string
17
- reuseId?: string
18
- }
19
-
20
- export type RawValuesQ = MinBaseQ & { type?: 'values'; mode?: 'binary' }
21
-
22
- export type RawPredefinedGroupsetQ = MinBaseQ & {
23
- type: 'predefined-groupset'
24
- mode?: 'binary' | 'discrete'
25
- predefined_groupset_idx: number
26
- /** deprecated nested object, will be handled by reshapeLegacyTW() in TwRouter */
27
- groupsetting?: { inuse?: boolean } & GroupSettingQ
28
- }
29
-
30
- export type RawCustomGroupsetQ = MinBaseQ & {
31
- type: 'custom-groupset'
32
- mode?: 'binary' | 'discrete'
33
- customset: {
34
- groups: GroupEntry[]
35
- }
36
- /** deprecated nested object, will be handled by reshapeLegacyTW() in TwRouter */
37
- groupsetting?: { inuse?: boolean } & GroupSettingQ
38
- }