Skip to content

Commit

Permalink
redesign with AFE schema considerations
Browse files Browse the repository at this point in the history
  • Loading branch information
CynthiaKamau committed May 28, 2024
1 parent 2d22e64 commit c9635c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/repeat/repeat.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { ExternalFunctionContext } from '../../external-function-context';
const renderingByTypeMap: Record<string, RenderType> = {
obsGroup: 'group',
testOrder: 'select',
diagnosis: 'ui-select-extended',
};

const Repeat: React.FC<FormFieldProps> = ({ question, onChange, handler }) => {
Expand Down
12 changes: 12 additions & 0 deletions src/transformers/angular-fe-schema-transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ function handleQuestion(question: FormField, form: FormSchema) {
: { hasProgramFields: true };
form.meta = formMeta;
}
if (question.type === 'diagnosis') {
handleDiagnosesDataSource(question);
}
try {
transformByType(question);
transformByRendering(question);
Expand Down Expand Up @@ -177,3 +180,12 @@ function handleQuestionsWithObsComments(sectionQuestions: Array<FormField>): Arr

return augmentedQuestions;
}

function handleDiagnosesDataSource(question: FormField) {
if ('dataSource' in question.questionOptions && question.questionOptions['dataSource'] === 'diagnoses') {
question.questionOptions.datasource = {
name: 'problem_datasource',
};
delete question.questionOptions['dataSource'];
}
}

0 comments on commit c9635c2

Please sign in to comment.