@quesmed/types 2.6.267 → 2.6.269

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 (29) hide show
  1. package/dist/cjs/models/OsceMarksheet.d.ts +2 -0
  2. package/dist/cjs/resolvers/fragments/osce.js +2 -0
  3. package/dist/cjs/resolvers/mutation/restricted/asset.d.ts +20 -0
  4. package/dist/cjs/resolvers/mutation/restricted/asset.js +22 -0
  5. package/dist/cjs/resolvers/mutation/restricted/index.d.ts +2 -0
  6. package/dist/cjs/resolvers/mutation/restricted/index.js +2 -0
  7. package/dist/cjs/resolvers/mutation/restricted/osce.d.ts +1 -0
  8. package/dist/cjs/resolvers/mutation/restricted/osce.js +16 -4
  9. package/dist/cjs/resolvers/mutation/restricted/station.d.ts +81 -0
  10. package/dist/cjs/resolvers/mutation/restricted/station.js +90 -0
  11. package/dist/cjs/resolvers/query/restricted/index.d.ts +1 -0
  12. package/dist/cjs/resolvers/query/restricted/index.js +1 -0
  13. package/dist/cjs/resolvers/query/restricted/station.d.ts +35 -0
  14. package/dist/cjs/resolvers/query/restricted/station.js +40 -0
  15. package/dist/mjs/models/OsceMarksheet.d.ts +2 -0
  16. package/dist/mjs/resolvers/fragments/osce.js +2 -0
  17. package/dist/mjs/resolvers/mutation/restricted/asset.d.ts +20 -0
  18. package/dist/mjs/resolvers/mutation/restricted/asset.js +19 -0
  19. package/dist/mjs/resolvers/mutation/restricted/index.d.ts +2 -0
  20. package/dist/mjs/resolvers/mutation/restricted/index.js +2 -0
  21. package/dist/mjs/resolvers/mutation/restricted/osce.d.ts +1 -0
  22. package/dist/mjs/resolvers/mutation/restricted/osce.js +16 -4
  23. package/dist/mjs/resolvers/mutation/restricted/station.d.ts +81 -0
  24. package/dist/mjs/resolvers/mutation/restricted/station.js +85 -0
  25. package/dist/mjs/resolvers/query/restricted/index.d.ts +1 -0
  26. package/dist/mjs/resolvers/query/restricted/index.js +1 -0
  27. package/dist/mjs/resolvers/query/restricted/station.d.ts +35 -0
  28. package/dist/mjs/resolvers/query/restricted/station.js +37 -0
  29. package/package.json +1 -1
@@ -26,6 +26,8 @@ export interface IOsceMarksheetMark {
26
26
  osceMarksheet?: IOsceMarksheet;
27
27
  osceStationMarkId: Id;
28
28
  osceStationMark?: IOsceStationMark;
29
+ secondaryMark: number | null;
30
+ score: number | null;
29
31
  }
30
32
  export declare enum EOsceRoles {
31
33
  ALL = 0,
@@ -100,6 +100,8 @@ exports.OSCE_MARKSHEET_MARK_FIELDS = (0, client_1.gql) `
100
100
  id
101
101
  index
102
102
  mark
103
+ score
104
+ secondaryMark
103
105
  selectedChoice
104
106
  osceMarksheetId
105
107
  osceStationMarkId
@@ -0,0 +1,20 @@
1
+ import { FileData, IPicture, Id } from '../../../models';
2
+ import { AdminData, graphqlNormalize } from '../../types';
3
+ export interface IAssetInput {
4
+ file: File | FileData;
5
+ caption?: string | null;
6
+ name: string;
7
+ topicId?: Id;
8
+ sensitive: boolean;
9
+ overlay?: boolean;
10
+ }
11
+ export declare const CREATE_ASSETS: import("@apollo/client").DocumentNode;
12
+ export type ICreateAssetsVar = {
13
+ inputs: IAssetInput[];
14
+ };
15
+ export type ICreateAssetsData = AdminData<(IPicture & graphqlNormalize)[], 'createAssets'>;
16
+ export declare const REMOVE_ASSETS: import("@apollo/client").DocumentNode;
17
+ export type IRemoveAssetsVar = {
18
+ ids: Id[];
19
+ };
20
+ export type IRemoveAssetsData = AdminData<boolean, 'removeAssets'>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REMOVE_ASSETS = exports.CREATE_ASSETS = void 0;
4
+ const client_1 = require("@apollo/client");
5
+ const fragments_1 = require("../../fragments");
6
+ exports.CREATE_ASSETS = (0, client_1.gql) `
7
+ ${fragments_1.PICTURE_FIELDS}
8
+ mutation CreateAssets($inputs: [CreateAssetsInput!]!) {
9
+ restricted {
10
+ createAssets(inputs: $inputs) {
11
+ ...PictureFields
12
+ }
13
+ }
14
+ }
15
+ `;
16
+ exports.REMOVE_ASSETS = (0, client_1.gql) `
17
+ mutation RemoveAssets($ids: [ID!]!) {
18
+ restricted {
19
+ removeAssets(ids: $ids)
20
+ }
21
+ }
22
+ `;
@@ -1,4 +1,5 @@
1
1
  export * from './agora';
2
+ export * from './asset';
2
3
  export * from './circuit';
3
4
  export * from './book';
4
5
  export * from './chapter';
@@ -9,6 +10,7 @@ export * from './notification';
9
10
  export * from './osce';
10
11
  export * from './preset';
11
12
  export * from './questionDiscussion';
13
+ export * from './station';
12
14
  export * from './stripe';
13
15
  export * from './todo';
14
16
  export * from './token';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./agora"), exports);
18
+ __exportStar(require("./asset"), exports);
18
19
  __exportStar(require("./circuit"), exports);
19
20
  __exportStar(require("./book"), exports);
20
21
  __exportStar(require("./chapter"), exports);
@@ -25,6 +26,7 @@ __exportStar(require("./notification"), exports);
25
26
  __exportStar(require("./osce"), exports);
26
27
  __exportStar(require("./preset"), exports);
27
28
  __exportStar(require("./questionDiscussion"), exports);
29
+ __exportStar(require("./station"), exports);
28
30
  __exportStar(require("./stripe"), exports);
29
31
  __exportStar(require("./todo"), exports);
30
32
  __exportStar(require("./token"), exports);
@@ -45,6 +45,7 @@ export declare const MARK_OSCE_MARKSHEET_MARK: import("@apollo/client").Document
45
45
  export interface IMarkOsceMarksheetMarkVar {
46
46
  osceMarksheetMarkId: Id;
47
47
  mark: number | EPaceMarkType;
48
+ secondaryMark?: number;
48
49
  corrected?: Boolean;
49
50
  }
50
51
  export type IMarkOsceMarksheetMarkData = RestrictedData<graphqlNormalize & Partial<IOsceMarksheetMark>, 'markOsceMarksheetMark'>;
@@ -84,16 +84,19 @@ exports.CHANGE_OSCE_ROLE = (0, client_1.gql) `
84
84
  }
85
85
  `;
86
86
  exports.MARK_OSCE_MARKSHEET_MARK = (0, client_1.gql) `
87
- mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!, $corrected: Boolean) {
87
+ mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!, $secondaryMark: Int, $corrected: Boolean) {
88
88
  restricted {
89
89
  markOsceMarksheetMark(
90
90
  osceMarksheetMarkId: $osceMarksheetMarkId
91
91
  mark: $mark
92
+ secondaryMark: $secondaryMark
92
93
  corrected: $corrected
93
94
  ) {
94
95
  id
95
96
  selectedChoice
96
97
  mark
98
+ score
99
+ secondaryMark
97
100
  }
98
101
  }
99
102
  }
@@ -103,10 +106,13 @@ const optimisticMarkOsceMarksheetMark = (variables, productType) => {
103
106
  if (productType === models_1.EProductType.PACES) {
104
107
  data.selectedChoice = variables.mark;
105
108
  data.mark = null;
109
+ data.secondaryMark = variables.secondaryMark;
110
+ data.score = null;
106
111
  }
107
112
  else {
108
113
  data.mark = variables.mark;
109
114
  data.selectedChoice = null;
115
+ data.score = variables.mark;
110
116
  }
111
117
  return {
112
118
  restricted: {
@@ -133,6 +139,8 @@ const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
133
139
  fields: {
134
140
  selectedChoice: () => markOsceMarksheetMark.selectedChoice,
135
141
  mark: () => markOsceMarksheetMark.mark,
142
+ secondaryMark: () => markOsceMarksheetMark.secondaryMark,
143
+ score: () => markOsceMarksheetMark.score,
136
144
  },
137
145
  });
138
146
  if (!variables.corrected) {
@@ -159,6 +167,8 @@ const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
159
167
  fragment OsceMarksheetMarksForScore on OsceMarksheet {
160
168
  marks {
161
169
  mark
170
+ score
171
+ secondaryMark
162
172
  }
163
173
  }
164
174
  `,
@@ -166,12 +176,14 @@ const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
166
176
  if (!marksheet?.marks?.length) {
167
177
  return;
168
178
  }
169
- const total = marksheet.marks.length;
170
- const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
179
+ const hasSecondaryMarks = marksheet.marks.some((m) => m.secondaryMark);
180
+ const total = hasSecondaryMarks ? 2 * marksheet.marks.length : marksheet.marks.length;
181
+ // const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
182
+ const userScore = marksheet.marks.reduce((sum, m) => sum + Number(m.score), 0);
171
183
  cache.modify({
172
184
  id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
173
185
  fields: {
174
- score: () => scored / total,
186
+ score: () => userScore / total,
175
187
  },
176
188
  });
177
189
  };
@@ -0,0 +1,81 @@
1
+ import { ApolloCache } from '@apollo/client';
2
+ import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
3
+ import { IClinicalDataModule, Id, IOsceStation, IOsceStationPhaseTimer, IStationExaminerQuestion } from '../../../models';
4
+ import { IAssetBinding } from '../../../models/Picture';
5
+ import { graphqlNormalize, RestrictedData } from '../../types';
6
+ import { EOsceType } from '../../../models';
7
+ export interface IJobStationMarkInput {
8
+ header?: string;
9
+ name?: string;
10
+ index?: number;
11
+ excludeFromAi?: boolean;
12
+ weight?: number;
13
+ }
14
+ export declare const CREATE_STATION: import("@apollo/client").DocumentNode;
15
+ export type ICreateStationData = RestrictedData<graphqlNormalize & IOsceStation, 'createStation'>;
16
+ export interface ICreateStationVar {
17
+ input: {
18
+ name: string;
19
+ hiddenName?: string;
20
+ osceTypeId?: number;
21
+ enabled?: number;
22
+ visibility?: number;
23
+ entitlementIds?: number[];
24
+ difficulty?: number;
25
+ pictureId?: number;
26
+ candidateBrief?: string;
27
+ examinerBrief?: string;
28
+ actorBrief?: string;
29
+ llmActorBrief?: string;
30
+ explanation?: string;
31
+ aiEnabled?: boolean;
32
+ aiConfig?: Record<string, unknown>;
33
+ phaseTimers?: IOsceStationPhaseTimer;
34
+ clinicalData?: IClinicalDataModule[];
35
+ topicIds?: number[];
36
+ marks?: IJobStationMarkInput[];
37
+ examinerQuestions?: IStationExaminerQuestion[];
38
+ assets?: IAssetBinding[];
39
+ };
40
+ }
41
+ export declare const updateCacheOnCreateStation: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<ICreateStationData>, options: ApolloUpdateOptions<ICreateStationVar>) => void;
42
+ export declare const UPDATE_STATION: import("@apollo/client").DocumentNode;
43
+ export type IUpdateStationData = RestrictedData<graphqlNormalize & IOsceStation, 'updateStation'>;
44
+ export interface IUpdateStationVar {
45
+ input: {
46
+ id: Id;
47
+ name?: string;
48
+ enabled?: number;
49
+ visibility?: number;
50
+ osceTypeId?: number;
51
+ hiddenName?: string;
52
+ entitlementIds?: number[];
53
+ difficulty?: number;
54
+ pictureId?: number;
55
+ candidateBrief?: string;
56
+ examinerBrief?: string;
57
+ actorBrief?: string;
58
+ llmActorBrief?: string;
59
+ explanation?: string;
60
+ aiEnabled?: boolean;
61
+ aiConfig?: Record<string, unknown>;
62
+ phaseTimers?: IOsceStationPhaseTimer;
63
+ clinicalData?: IClinicalDataModule[];
64
+ topicIds?: number[];
65
+ marks?: IJobStationMarkInput[];
66
+ assets?: IAssetBinding[];
67
+ examinerQuestions?: IStationExaminerQuestion[];
68
+ };
69
+ }
70
+ export declare const updateCacheOnUpdateStation: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpdateStationData>, options: ApolloUpdateOptions<IUpdateStationVar>) => void;
71
+ export interface IGenerateStationSession {
72
+ sessionId: string;
73
+ }
74
+ export type IGenerateStationData = RestrictedData<graphqlNormalize & IGenerateStationSession, 'generateStation'>;
75
+ export interface IGenerateStationVar {
76
+ input: {
77
+ prompt: string;
78
+ osceTypeId: EOsceType;
79
+ };
80
+ }
81
+ export declare const GENERATE_STATION: import("@apollo/client").DocumentNode;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GENERATE_STATION = exports.updateCacheOnUpdateStation = exports.UPDATE_STATION = exports.updateCacheOnCreateStation = exports.CREATE_STATION = void 0;
4
+ const client_1 = require("@apollo/client");
5
+ const osce_1 = require("../../fragments/osce");
6
+ const restricted_1 = require("../../query/restricted");
7
+ exports.CREATE_STATION = (0, client_1.gql) `
8
+ ${osce_1.OSCE_STATION_FIELDS}
9
+ mutation CreateStation($input: CreateStationInput!) {
10
+ restricted {
11
+ createStation(input: $input) {
12
+ ...OsceStationFields
13
+ }
14
+ }
15
+ }
16
+ `;
17
+ const updateCacheOnCreateStation = (cache, result, options) => {
18
+ const { createStation } = result?.data?.restricted || {};
19
+ const { variables } = options || {};
20
+ if (!createStation || !variables) {
21
+ return;
22
+ }
23
+ const prevData = cache.readQuery({
24
+ variables: { solo: false },
25
+ query: restricted_1.OSCE_STATIONS,
26
+ });
27
+ if (prevData) {
28
+ const { osceStations } = prevData.restricted || {};
29
+ cache.writeQuery({
30
+ query: restricted_1.OSCE_STATIONS,
31
+ variables: { solo: false },
32
+ data: {
33
+ ...prevData,
34
+ restricted: {
35
+ ...prevData.restricted,
36
+ osceStations: [{ ...createStation }, ...osceStations],
37
+ },
38
+ },
39
+ });
40
+ }
41
+ else {
42
+ cache.writeQuery({
43
+ query: restricted_1.OSCE_STATIONS,
44
+ variables: { solo: false },
45
+ data: {
46
+ restricted: {
47
+ __typename: 'RestrictedQuery',
48
+ osceStations: [{ ...createStation }],
49
+ },
50
+ },
51
+ });
52
+ }
53
+ };
54
+ exports.updateCacheOnCreateStation = updateCacheOnCreateStation;
55
+ exports.UPDATE_STATION = (0, client_1.gql) `
56
+ ${osce_1.OSCE_STATION_FIELDS}
57
+ mutation UpdateStation($input: UpdateStationInput!) {
58
+ restricted {
59
+ updateStation(input: $input) {
60
+ ...OsceStationFields
61
+ }
62
+ }
63
+ }
64
+ `;
65
+ const updateCacheOnUpdateStation = (cache, result, options) => {
66
+ const { updateStation } = result?.data?.restricted || {};
67
+ const { variables } = options || {};
68
+ if (!updateStation || !variables) {
69
+ return;
70
+ }
71
+ cache.writeFragment({
72
+ id: cache.identify({
73
+ id: variables.input.id,
74
+ __typename: 'OsceStation',
75
+ }),
76
+ data: { ...updateStation },
77
+ fragment: osce_1.OSCE_STATION_FIELDS,
78
+ fragmentName: 'OsceStationFields',
79
+ });
80
+ };
81
+ exports.updateCacheOnUpdateStation = updateCacheOnUpdateStation;
82
+ exports.GENERATE_STATION = (0, client_1.gql) `
83
+ mutation GenerateStation($input: GenerateStationInput!) {
84
+ restricted {
85
+ generateStation(input: $input) {
86
+ sessionId
87
+ }
88
+ }
89
+ }
90
+ `;
@@ -15,6 +15,7 @@ export * from './qBank';
15
15
  export * from './quesBook';
16
16
  export * from './question';
17
17
  export * from './replication';
18
+ export * from './station';
18
19
  export * from './todos';
19
20
  export * from './topics';
20
21
  export * from './ukmlaTopics';
@@ -31,6 +31,7 @@ __exportStar(require("./qBank"), exports);
31
31
  __exportStar(require("./quesBook"), exports);
32
32
  __exportStar(require("./question"), exports);
33
33
  __exportStar(require("./replication"), exports);
34
+ __exportStar(require("./station"), exports);
34
35
  __exportStar(require("./todos"), exports);
35
36
  __exportStar(require("./topics"), exports);
36
37
  __exportStar(require("./ukmlaTopics"), exports);
@@ -0,0 +1,35 @@
1
+ import { EOsceType, IStationExaminerQuestion } from '../../../models';
2
+ import { graphqlNormalize, RestrictedData } from '../../types';
3
+ export declare enum EGenerateStationStatus {
4
+ PENDING = "PENDING",
5
+ READY = "READY",
6
+ FAILED = "FAILED"
7
+ }
8
+ export interface IGeneratedStationMark {
9
+ header?: string;
10
+ name?: string;
11
+ index?: number;
12
+ weight?: number;
13
+ excludeFromAi?: boolean;
14
+ }
15
+ export interface IGeneratedStation {
16
+ name?: string;
17
+ osceTypeId?: EOsceType;
18
+ difficulty?: number;
19
+ candidateBrief?: string;
20
+ examinerBrief?: string;
21
+ actorBrief?: string;
22
+ explanation?: string;
23
+ examinerQuestions?: IStationExaminerQuestion[];
24
+ marks?: IGeneratedStationMark[];
25
+ }
26
+ export interface IGenerateStationResult {
27
+ status: EGenerateStationStatus;
28
+ station?: IGeneratedStation;
29
+ error?: string;
30
+ }
31
+ export type IGenerateStationStatusData = RestrictedData<graphqlNormalize & IGenerateStationResult, 'generateStationStatus'>;
32
+ export interface IGenerateStationStatusVar {
33
+ sessionId: string;
34
+ }
35
+ export declare const GENERATE_STATION_STATUS: import("@apollo/client").DocumentNode;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GENERATE_STATION_STATUS = exports.EGenerateStationStatus = void 0;
4
+ const client_1 = require("@apollo/client");
5
+ var EGenerateStationStatus;
6
+ (function (EGenerateStationStatus) {
7
+ EGenerateStationStatus["PENDING"] = "PENDING";
8
+ EGenerateStationStatus["READY"] = "READY";
9
+ EGenerateStationStatus["FAILED"] = "FAILED";
10
+ })(EGenerateStationStatus = exports.EGenerateStationStatus || (exports.EGenerateStationStatus = {}));
11
+ exports.GENERATE_STATION_STATUS = (0, client_1.gql) `
12
+ query GenerateStationStatus($sessionId: String!) {
13
+ restricted {
14
+ generateStationStatus(sessionId: $sessionId) {
15
+ status
16
+ error
17
+ station {
18
+ name
19
+ osceTypeId
20
+ difficulty
21
+ candidateBrief
22
+ examinerBrief
23
+ actorBrief
24
+ explanation
25
+ examinerQuestions {
26
+ index
27
+ question
28
+ }
29
+ marks {
30
+ header
31
+ name
32
+ index
33
+ weight
34
+ excludeFromAi
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+ `;
@@ -26,6 +26,8 @@ export interface IOsceMarksheetMark {
26
26
  osceMarksheet?: IOsceMarksheet;
27
27
  osceStationMarkId: Id;
28
28
  osceStationMark?: IOsceStationMark;
29
+ secondaryMark: number | null;
30
+ score: number | null;
29
31
  }
30
32
  export declare enum EOsceRoles {
31
33
  ALL = 0,
@@ -97,6 +97,8 @@ export const OSCE_MARKSHEET_MARK_FIELDS = gql `
97
97
  id
98
98
  index
99
99
  mark
100
+ score
101
+ secondaryMark
100
102
  selectedChoice
101
103
  osceMarksheetId
102
104
  osceStationMarkId
@@ -0,0 +1,20 @@
1
+ import { FileData, IPicture, Id } from '../../../models';
2
+ import { AdminData, graphqlNormalize } from '../../types';
3
+ export interface IAssetInput {
4
+ file: File | FileData;
5
+ caption?: string | null;
6
+ name: string;
7
+ topicId?: Id;
8
+ sensitive: boolean;
9
+ overlay?: boolean;
10
+ }
11
+ export declare const CREATE_ASSETS: import("@apollo/client").DocumentNode;
12
+ export type ICreateAssetsVar = {
13
+ inputs: IAssetInput[];
14
+ };
15
+ export type ICreateAssetsData = AdminData<(IPicture & graphqlNormalize)[], 'createAssets'>;
16
+ export declare const REMOVE_ASSETS: import("@apollo/client").DocumentNode;
17
+ export type IRemoveAssetsVar = {
18
+ ids: Id[];
19
+ };
20
+ export type IRemoveAssetsData = AdminData<boolean, 'removeAssets'>;
@@ -0,0 +1,19 @@
1
+ import { gql } from '@apollo/client';
2
+ import { PICTURE_FIELDS } from '../../fragments';
3
+ export const CREATE_ASSETS = gql `
4
+ ${PICTURE_FIELDS}
5
+ mutation CreateAssets($inputs: [CreateAssetsInput!]!) {
6
+ restricted {
7
+ createAssets(inputs: $inputs) {
8
+ ...PictureFields
9
+ }
10
+ }
11
+ }
12
+ `;
13
+ export const REMOVE_ASSETS = gql `
14
+ mutation RemoveAssets($ids: [ID!]!) {
15
+ restricted {
16
+ removeAssets(ids: $ids)
17
+ }
18
+ }
19
+ `;
@@ -1,4 +1,5 @@
1
1
  export * from './agora';
2
+ export * from './asset';
2
3
  export * from './circuit';
3
4
  export * from './book';
4
5
  export * from './chapter';
@@ -9,6 +10,7 @@ export * from './notification';
9
10
  export * from './osce';
10
11
  export * from './preset';
11
12
  export * from './questionDiscussion';
13
+ export * from './station';
12
14
  export * from './stripe';
13
15
  export * from './todo';
14
16
  export * from './token';
@@ -1,4 +1,5 @@
1
1
  export * from './agora';
2
+ export * from './asset';
2
3
  export * from './circuit';
3
4
  export * from './book';
4
5
  export * from './chapter';
@@ -9,6 +10,7 @@ export * from './notification';
9
10
  export * from './osce';
10
11
  export * from './preset';
11
12
  export * from './questionDiscussion';
13
+ export * from './station';
12
14
  export * from './stripe';
13
15
  export * from './todo';
14
16
  export * from './token';
@@ -45,6 +45,7 @@ export declare const MARK_OSCE_MARKSHEET_MARK: import("@apollo/client").Document
45
45
  export interface IMarkOsceMarksheetMarkVar {
46
46
  osceMarksheetMarkId: Id;
47
47
  mark: number | EPaceMarkType;
48
+ secondaryMark?: number;
48
49
  corrected?: Boolean;
49
50
  }
50
51
  export type IMarkOsceMarksheetMarkData = RestrictedData<graphqlNormalize & Partial<IOsceMarksheetMark>, 'markOsceMarksheetMark'>;
@@ -81,16 +81,19 @@ export const CHANGE_OSCE_ROLE = gql `
81
81
  }
82
82
  `;
83
83
  export const MARK_OSCE_MARKSHEET_MARK = gql `
84
- mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!, $corrected: Boolean) {
84
+ mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!, $secondaryMark: Int, $corrected: Boolean) {
85
85
  restricted {
86
86
  markOsceMarksheetMark(
87
87
  osceMarksheetMarkId: $osceMarksheetMarkId
88
88
  mark: $mark
89
+ secondaryMark: $secondaryMark
89
90
  corrected: $corrected
90
91
  ) {
91
92
  id
92
93
  selectedChoice
93
94
  mark
95
+ score
96
+ secondaryMark
94
97
  }
95
98
  }
96
99
  }
@@ -100,10 +103,13 @@ export const optimisticMarkOsceMarksheetMark = (variables, productType) => {
100
103
  if (productType === EProductType.PACES) {
101
104
  data.selectedChoice = variables.mark;
102
105
  data.mark = null;
106
+ data.secondaryMark = variables.secondaryMark;
107
+ data.score = null;
103
108
  }
104
109
  else {
105
110
  data.mark = variables.mark;
106
111
  data.selectedChoice = null;
112
+ data.score = variables.mark;
107
113
  }
108
114
  return {
109
115
  restricted: {
@@ -129,6 +135,8 @@ export const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
129
135
  fields: {
130
136
  selectedChoice: () => markOsceMarksheetMark.selectedChoice,
131
137
  mark: () => markOsceMarksheetMark.mark,
138
+ secondaryMark: () => markOsceMarksheetMark.secondaryMark,
139
+ score: () => markOsceMarksheetMark.score,
132
140
  },
133
141
  });
134
142
  if (!variables.corrected) {
@@ -155,6 +163,8 @@ export const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
155
163
  fragment OsceMarksheetMarksForScore on OsceMarksheet {
156
164
  marks {
157
165
  mark
166
+ score
167
+ secondaryMark
158
168
  }
159
169
  }
160
170
  `,
@@ -162,12 +172,14 @@ export const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
162
172
  if (!marksheet?.marks?.length) {
163
173
  return;
164
174
  }
165
- const total = marksheet.marks.length;
166
- const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
175
+ const hasSecondaryMarks = marksheet.marks.some((m) => m.secondaryMark);
176
+ const total = hasSecondaryMarks ? 2 * marksheet.marks.length : marksheet.marks.length;
177
+ // const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
178
+ const userScore = marksheet.marks.reduce((sum, m) => sum + Number(m.score), 0);
167
179
  cache.modify({
168
180
  id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
169
181
  fields: {
170
- score: () => scored / total,
182
+ score: () => userScore / total,
171
183
  },
172
184
  });
173
185
  };
@@ -0,0 +1,81 @@
1
+ import { ApolloCache } from '@apollo/client';
2
+ import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
3
+ import { IClinicalDataModule, Id, IOsceStation, IOsceStationPhaseTimer, IStationExaminerQuestion } from '../../../models';
4
+ import { IAssetBinding } from '../../../models/Picture';
5
+ import { graphqlNormalize, RestrictedData } from '../../types';
6
+ import { EOsceType } from '../../../models';
7
+ export interface IJobStationMarkInput {
8
+ header?: string;
9
+ name?: string;
10
+ index?: number;
11
+ excludeFromAi?: boolean;
12
+ weight?: number;
13
+ }
14
+ export declare const CREATE_STATION: import("@apollo/client").DocumentNode;
15
+ export type ICreateStationData = RestrictedData<graphqlNormalize & IOsceStation, 'createStation'>;
16
+ export interface ICreateStationVar {
17
+ input: {
18
+ name: string;
19
+ hiddenName?: string;
20
+ osceTypeId?: number;
21
+ enabled?: number;
22
+ visibility?: number;
23
+ entitlementIds?: number[];
24
+ difficulty?: number;
25
+ pictureId?: number;
26
+ candidateBrief?: string;
27
+ examinerBrief?: string;
28
+ actorBrief?: string;
29
+ llmActorBrief?: string;
30
+ explanation?: string;
31
+ aiEnabled?: boolean;
32
+ aiConfig?: Record<string, unknown>;
33
+ phaseTimers?: IOsceStationPhaseTimer;
34
+ clinicalData?: IClinicalDataModule[];
35
+ topicIds?: number[];
36
+ marks?: IJobStationMarkInput[];
37
+ examinerQuestions?: IStationExaminerQuestion[];
38
+ assets?: IAssetBinding[];
39
+ };
40
+ }
41
+ export declare const updateCacheOnCreateStation: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<ICreateStationData>, options: ApolloUpdateOptions<ICreateStationVar>) => void;
42
+ export declare const UPDATE_STATION: import("@apollo/client").DocumentNode;
43
+ export type IUpdateStationData = RestrictedData<graphqlNormalize & IOsceStation, 'updateStation'>;
44
+ export interface IUpdateStationVar {
45
+ input: {
46
+ id: Id;
47
+ name?: string;
48
+ enabled?: number;
49
+ visibility?: number;
50
+ osceTypeId?: number;
51
+ hiddenName?: string;
52
+ entitlementIds?: number[];
53
+ difficulty?: number;
54
+ pictureId?: number;
55
+ candidateBrief?: string;
56
+ examinerBrief?: string;
57
+ actorBrief?: string;
58
+ llmActorBrief?: string;
59
+ explanation?: string;
60
+ aiEnabled?: boolean;
61
+ aiConfig?: Record<string, unknown>;
62
+ phaseTimers?: IOsceStationPhaseTimer;
63
+ clinicalData?: IClinicalDataModule[];
64
+ topicIds?: number[];
65
+ marks?: IJobStationMarkInput[];
66
+ assets?: IAssetBinding[];
67
+ examinerQuestions?: IStationExaminerQuestion[];
68
+ };
69
+ }
70
+ export declare const updateCacheOnUpdateStation: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpdateStationData>, options: ApolloUpdateOptions<IUpdateStationVar>) => void;
71
+ export interface IGenerateStationSession {
72
+ sessionId: string;
73
+ }
74
+ export type IGenerateStationData = RestrictedData<graphqlNormalize & IGenerateStationSession, 'generateStation'>;
75
+ export interface IGenerateStationVar {
76
+ input: {
77
+ prompt: string;
78
+ osceTypeId: EOsceType;
79
+ };
80
+ }
81
+ export declare const GENERATE_STATION: import("@apollo/client").DocumentNode;
@@ -0,0 +1,85 @@
1
+ import { gql } from '@apollo/client';
2
+ import { OSCE_STATION_FIELDS } from '../../fragments/osce';
3
+ import { OSCE_STATIONS, } from '../../query/restricted';
4
+ export const CREATE_STATION = gql `
5
+ ${OSCE_STATION_FIELDS}
6
+ mutation CreateStation($input: CreateStationInput!) {
7
+ restricted {
8
+ createStation(input: $input) {
9
+ ...OsceStationFields
10
+ }
11
+ }
12
+ }
13
+ `;
14
+ export const updateCacheOnCreateStation = (cache, result, options) => {
15
+ const { createStation } = result?.data?.restricted || {};
16
+ const { variables } = options || {};
17
+ if (!createStation || !variables) {
18
+ return;
19
+ }
20
+ const prevData = cache.readQuery({
21
+ variables: { solo: false },
22
+ query: OSCE_STATIONS,
23
+ });
24
+ if (prevData) {
25
+ const { osceStations } = prevData.restricted || {};
26
+ cache.writeQuery({
27
+ query: OSCE_STATIONS,
28
+ variables: { solo: false },
29
+ data: {
30
+ ...prevData,
31
+ restricted: {
32
+ ...prevData.restricted,
33
+ osceStations: [{ ...createStation }, ...osceStations],
34
+ },
35
+ },
36
+ });
37
+ }
38
+ else {
39
+ cache.writeQuery({
40
+ query: OSCE_STATIONS,
41
+ variables: { solo: false },
42
+ data: {
43
+ restricted: {
44
+ __typename: 'RestrictedQuery',
45
+ osceStations: [{ ...createStation }],
46
+ },
47
+ },
48
+ });
49
+ }
50
+ };
51
+ export const UPDATE_STATION = gql `
52
+ ${OSCE_STATION_FIELDS}
53
+ mutation UpdateStation($input: UpdateStationInput!) {
54
+ restricted {
55
+ updateStation(input: $input) {
56
+ ...OsceStationFields
57
+ }
58
+ }
59
+ }
60
+ `;
61
+ export const updateCacheOnUpdateStation = (cache, result, options) => {
62
+ const { updateStation } = result?.data?.restricted || {};
63
+ const { variables } = options || {};
64
+ if (!updateStation || !variables) {
65
+ return;
66
+ }
67
+ cache.writeFragment({
68
+ id: cache.identify({
69
+ id: variables.input.id,
70
+ __typename: 'OsceStation',
71
+ }),
72
+ data: { ...updateStation },
73
+ fragment: OSCE_STATION_FIELDS,
74
+ fragmentName: 'OsceStationFields',
75
+ });
76
+ };
77
+ export const GENERATE_STATION = gql `
78
+ mutation GenerateStation($input: GenerateStationInput!) {
79
+ restricted {
80
+ generateStation(input: $input) {
81
+ sessionId
82
+ }
83
+ }
84
+ }
85
+ `;
@@ -15,6 +15,7 @@ export * from './qBank';
15
15
  export * from './quesBook';
16
16
  export * from './question';
17
17
  export * from './replication';
18
+ export * from './station';
18
19
  export * from './todos';
19
20
  export * from './topics';
20
21
  export * from './ukmlaTopics';
@@ -15,6 +15,7 @@ export * from './qBank';
15
15
  export * from './quesBook';
16
16
  export * from './question';
17
17
  export * from './replication';
18
+ export * from './station';
18
19
  export * from './todos';
19
20
  export * from './topics';
20
21
  export * from './ukmlaTopics';
@@ -0,0 +1,35 @@
1
+ import { EOsceType, IStationExaminerQuestion } from '../../../models';
2
+ import { graphqlNormalize, RestrictedData } from '../../types';
3
+ export declare enum EGenerateStationStatus {
4
+ PENDING = "PENDING",
5
+ READY = "READY",
6
+ FAILED = "FAILED"
7
+ }
8
+ export interface IGeneratedStationMark {
9
+ header?: string;
10
+ name?: string;
11
+ index?: number;
12
+ weight?: number;
13
+ excludeFromAi?: boolean;
14
+ }
15
+ export interface IGeneratedStation {
16
+ name?: string;
17
+ osceTypeId?: EOsceType;
18
+ difficulty?: number;
19
+ candidateBrief?: string;
20
+ examinerBrief?: string;
21
+ actorBrief?: string;
22
+ explanation?: string;
23
+ examinerQuestions?: IStationExaminerQuestion[];
24
+ marks?: IGeneratedStationMark[];
25
+ }
26
+ export interface IGenerateStationResult {
27
+ status: EGenerateStationStatus;
28
+ station?: IGeneratedStation;
29
+ error?: string;
30
+ }
31
+ export type IGenerateStationStatusData = RestrictedData<graphqlNormalize & IGenerateStationResult, 'generateStationStatus'>;
32
+ export interface IGenerateStationStatusVar {
33
+ sessionId: string;
34
+ }
35
+ export declare const GENERATE_STATION_STATUS: import("@apollo/client").DocumentNode;
@@ -0,0 +1,37 @@
1
+ import { gql } from '@apollo/client';
2
+ export var EGenerateStationStatus;
3
+ (function (EGenerateStationStatus) {
4
+ EGenerateStationStatus["PENDING"] = "PENDING";
5
+ EGenerateStationStatus["READY"] = "READY";
6
+ EGenerateStationStatus["FAILED"] = "FAILED";
7
+ })(EGenerateStationStatus || (EGenerateStationStatus = {}));
8
+ export const GENERATE_STATION_STATUS = gql `
9
+ query GenerateStationStatus($sessionId: String!) {
10
+ restricted {
11
+ generateStationStatus(sessionId: $sessionId) {
12
+ status
13
+ error
14
+ station {
15
+ name
16
+ osceTypeId
17
+ difficulty
18
+ candidateBrief
19
+ examinerBrief
20
+ actorBrief
21
+ explanation
22
+ examinerQuestions {
23
+ index
24
+ question
25
+ }
26
+ marks {
27
+ header
28
+ name
29
+ index
30
+ weight
31
+ excludeFromAi
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
37
+ `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.267",
3
+ "version": "2.6.269",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",