Skip to content

Commit

Permalink
Merge pull request #851 from BIDMCDigitalPsychiatry/self-help
Browse files Browse the repository at this point in the history
Digit span game integration in dashboard
  • Loading branch information
sarithapillai8 authored Jan 14, 2025
2 parents c150ed0 + 19f7e2e commit be3b2c8
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/components/EmbeddedActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const demoActivities = {
"lamp.funny_memory": "funnymemory",
"lamp.trails_b": "dottouch",
"lamp.voice_survey": "speechrecording",
"lamp.digit_span": "digitspan",
}

export default function EmbeddedActivity({ participant, activity, name, onComplete, noBack, tab, ...props }) {
Expand Down
11 changes: 0 additions & 11 deletions src/components/Example.stories.tsx

This file was deleted.

12 changes: 12 additions & 0 deletions src/components/PreventSelectedActivities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ export const strategies = {
: (parseInt(slices.score ?? 0).toFixed(1) || 0) > 100
? 100
: parseInt(slices.score ?? 0).toFixed(1) || 0,
"lamp.dcog": (slices, activity, scopedItem) =>
slices.score == "NaN"
? 0
: (parseInt(slices.score ?? 0).toFixed(1) || 0) > 100
? 100
: parseInt(slices.score ?? 0).toFixed(1) || 0,
"lamp.balloon_risk": (slices, activity, scopedItem) => parseInt(slices.points ?? 0).toFixed(1) || 0,
"lamp.pop_the_bubbles": (slices, activity, scopedItem) => {
let temporalSlices = slices.filter(function (data) {
Expand All @@ -266,6 +272,12 @@ export const strategies = {
return (slices || []).map((x) => (!!x.type ? 1 : 0)).reduce((prev, cur) => prev + cur, 0)
},
"lamp.cats_and_dogs": (slices, activity, scopedItem) => (slices.correct_answers / slices.total_questions) * 100,
"lamp.digit_span": (slices, activity, scopedItem) =>
slices.score == "NaN"
? 0
: (parseInt(slices.score ?? 0).toFixed(1) || 0) > 100
? 100
: parseInt(slices.score ?? 0).toFixed(1) || 0,
"lamp.memory_game": (slices, activity, scopedItem) => (slices.correct_answers / slices.total_questions) * 100,
"lamp.funny_memory": (slices, activity, scopedItem) =>
(slices.number_of_correct_pairs_recalled / slices.number_of_total_pairs) * 100,
Expand Down
1 change: 1 addition & 0 deletions src/components/Researcher/ActivityList/Activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const games = [
"lamp.trails_b",
"lamp.voice_survey",
"lamp.fragmented_letters",
"lamp.digit_span",
]

const useStyles = makeStyles((theme: Theme) =>
Expand Down
1 change: 1 addition & 0 deletions src/components/Researcher/ActivityList/ActivityHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export default function ActivityHeader({
"lamp.symbol_digit_substitution",
"lamp.spin_wheel",
"lamp.fragmented_letters",
"lamp.digit_span",
].includes(activitySpecId) && (
<ActivityImage
onChange={(val) => setVisualSettings(val)}
Expand Down
9 changes: 9 additions & 0 deletions src/components/Researcher/ActivityList/ActivityMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,15 @@ export const SchemaList = () => {
},
},
},
"lamp.digit_span": {
type: "object",
properties: {
settings: {
title: i18n.t("Activity Settings"),
type: "object",
},
},
},
"lamp.cats_and_dogs_new": {
type: "object",
properties: {
Expand Down
2 changes: 2 additions & 0 deletions src/components/Researcher/ActivityList/AddActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export default function AddActivity({
"lamp.trails_b": `${t("Trails B")}`,
"lamp.voice_survey": `${t("Speech Recording")}`,
"lamp.fragmented_letters": `${t("Fragmented Letters")}`,
"lamp.digit_span": `${t("Digit Span")}`,
}

const getActivitySpec = async (id) => {
Expand All @@ -179,6 +180,7 @@ export default function AddActivity({
useEffect(() => {
;(async () => {
const allSpecs = await LAMP.ActivitySpec.all()
console.log(allSpecs)
let availableSpecs = allSpecs.filter((x: any) => Object.keys(activitiesObj).includes(x?.id))
let otherSpecs = allSpecs.filter((x: any) => !Object.keys(activitiesObj).includes(x?.id))
let i = 0
Expand Down
2 changes: 2 additions & 0 deletions src/components/Researcher/ActivityList/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const availableActivitySpecs = [
"lamp.trails_b",
"lamp.voice_survey",
"lamp.fragmented_letters",
"lamp.digit_span",
]
export const games = [
"lamp.jewels_a",
Expand All @@ -82,6 +83,7 @@ export const games = [
"lamp.trails_b",
"lamp.voice_survey",
"lamp.fragmented_letters",
"lamp.digit_span",
]
export default function ActivityList({
researcherId,
Expand Down
1 change: 1 addition & 0 deletions src/components/Survey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const games = [
"lamp.funny_memory",
"lamp.trails_b",
"lamp.voice_survey",
"lamp.digit_span",
]

export default function Survey({ participant, activities, showStreak, ...props }) {
Expand Down

0 comments on commit be3b2c8

Please sign in to comment.