Skip to content

Commit

Permalink
feat(calc): tampa
Browse files Browse the repository at this point in the history
  • Loading branch information
nckhell committed Jan 2, 2025
1 parent 6a3a42d commit 85f999d
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 261 deletions.
4 changes: 2 additions & 2 deletions src/scores/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ import { sf12 } from './sf12/sf12'
// import { spadi } from './spadi/spadi'
import { simple_shoulder_test } from './sst/simple_shoulder_test'
// import { start_back_screening_tool } from './start_back_screening_tool/start_back_screening_tool'
// import { tampa } from './tampa/tampa'
import { tampa } from './tampa/tampa'
// import { visa_a, visa_g, visa_p } from './visa'
// import { yp_core } from './yp_core/yp_core'
// import { zarit_12 } from './zarit_12/zarit_12'
Expand Down Expand Up @@ -263,7 +263,7 @@ export const ScoreLibrary = createScoreLibrary({
simple_shoulder_test,
// start_back_screening_tool,
// stop_bang,
// tampa,
tampa,
ten_meter_walk_test,
// visa_a,
// visa_g,
Expand Down
178 changes: 65 additions & 113 deletions src/scores/tampa/definition/tampa_inputs.ts
Original file line number Diff line number Diff line change
@@ -1,129 +1,81 @@
import type { InputType } from '../../../src/types/calculations.types'
import { NumberInputType } from '../../../src/types/calculations/inputs/calculation-inputs.types'
import { z } from 'zod'
import { ScoreInputSchemaType, ScoreInputType } from '../../../types'

const type: NumberInputType = {
type: 'number',
allowed_answers: [
{ value: 1, label: { en: 'Strongly disagree' } },
{ value: 2, label: { en: 'Disagree' } },
{ value: 3, label: { en: 'Agree' } },
{ value: 4, label: { en: 'Strongly agree' } },
],
}
const type = {
type: z.union([z.literal(1), z.literal(2), z.literal(3), z.literal(4)]),
uiOptions: {
options: [
{ value: 1, label: { en: 'Strongly disagree' } },
{ value: 2, label: { en: 'Disagree' } },
{ value: 3, label: { en: 'Agree' } },
{ value: 4, label: { en: 'Strongly agree' } },
],
},
} satisfies ScoreInputType

export const TAMPA_INPUTS: Array<InputType> = [
{
input_id: 'Q01',
input_type,
required: true,
inverse: false,
},
{
input_id: 'Q02',
input_type,
required: true,
inverse: false,
},
{
input_id: 'Q03',
input_type,
required: true,
inverse: false,
},
{
input_id: 'Q04',
input_type,
required: true,
export const TAMPA_INPUTS = {
Q01: {
...type,
},
Q02: {
...type,
},
Q03: {
...type,
},
Q04: {
...type,
info: {
en: 'The answer on this question will be inversed by the calculation',
},
inverse: true,
},
{
input_id: 'Q05',
input_type,
required: true,
inverse: false,
},
{
input_id: 'Q06',
input_type,
required: true,
inverse: false,
},
{
input_id: 'Q07',
input_type,
required: true,
inverse: false,
},
{
input_id: 'Q08',
input_type,
required: true,
},
Q05: {
...type,
},
Q06: {
...type,
},
Q07: {
...type,
},
Q08: {
...type,
// required: true,
info: {
en: 'The answer on this question will be inversed by the calculation',
},
inverse: true,
},
{
input_id: 'Q09',
input_type,
required: true,
inverse: false,
},
{
input_id: 'Q10',
input_type,
required: true,
inverse: false,
},
{
input_id: 'Q11',
input_type,
required: true,
inverse: false,
},
{
input_id: 'Q12',
input_type,
required: true,
},
Q09: {
...type,
},
Q10: {
...type,
},
Q11: {
...type,
},
Q12: {
...type,
info: {
en: 'The answer on this question will be inversed by the calculation',
},
inverse: true,
},
{
input_id: 'Q13',
input_type,
required: true,
inverse: false,
},
{
input_id: 'Q14',
input_type,
required: true,
inverse: false,
},
{
input_id: 'Q15',
input_type,
required: true,
inverse: false,
},
{
input_id: 'Q16',
input_type,
required: true,
},
Q13: {
...type,
},
Q14: {
...type,
},
Q15: {
...type,
},
Q16: {
...type,
info: {
en: 'The answer on this question will be inversed by the calculation',
},
inverse: true,
},
{
input_id: 'Q17',
input_type,
required: true,
inverse: false,
Q17: {
...type,
},
]
} satisfies ScoreInputSchemaType
16 changes: 10 additions & 6 deletions src/scores/tampa/definition/tampa_output.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import type { CalculationOutputDefinition } from '../../../src/types/calculations.types'
import { z } from 'zod'
import { ScoreOutputSchemaType } from '../../../types'

export const TAMPA_OUTPUT: CalculationOutputDefinition[] = [
{
subresult_id: 'TAMPA',
export const TAMPA_OUTPUT = {
TAMPA: {
label: { en: 'Tampa score' },
type: 'number',
type: z.number(),
},
]
INTERPRETATION: {
label: { en: 'Interpretation' },
type: z.string(),
},
} satisfies ScoreOutputSchemaType
Loading

0 comments on commit 85f999d

Please sign in to comment.