@aehrc/smart-forms-renderer 0.1.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.
- package/dist/api/populate.d.ts +8 -0
- package/dist/components/Alert.styles.d.ts +12 -0
- package/dist/components/BackToTopButton/BackToTopButton.d.ts +7 -0
- package/dist/components/Box.styles.d.ts +28 -0
- package/dist/components/FormComponents/BooleanItem/BooleanField.d.ts +8 -0
- package/dist/components/FormComponents/BooleanItem/BooleanItem.d.ts +9 -0
- package/dist/components/FormComponents/DateItem/DateField.d.ts +12 -0
- package/dist/components/FormComponents/DateItem/DateItem.d.ts +9 -0
- package/dist/components/FormComponents/DateTimeItem/DateTimeField.d.ts +12 -0
- package/dist/components/FormComponents/DateTimeItem/DateTimeItem.d.ts +9 -0
- package/dist/components/FormComponents/DecimalItem/DecimalField.d.ts +15 -0
- package/dist/components/FormComponents/DecimalItem/DecimalItem.d.ts +9 -0
- package/dist/components/FormComponents/DisplayItem/DisplayInstructions.d.ts +6 -0
- package/dist/components/FormComponents/DisplayItem/DisplayInstructions.styles.d.ts +9 -0
- package/dist/components/FormComponents/DisplayItem/DisplayItem.d.ts +7 -0
- package/dist/components/FormComponents/GridGroup/GridGroup.d.ts +10 -0
- package/dist/components/FormComponents/GridGroup/GridRow.d.ts +11 -0
- package/dist/components/FormComponents/GridGroup/GridTable.d.ts +11 -0
- package/dist/components/FormComponents/GroupItem/GroupHeading.d.ts +9 -0
- package/dist/components/FormComponents/GroupItem/GroupItem.d.ts +15 -0
- package/dist/components/FormComponents/GroupItem/GroupItem.styles.d.ts +11 -0
- package/dist/components/FormComponents/GroupItem/GroupItemSwitcher.d.ts +10 -0
- package/dist/components/FormComponents/GroupItem/NextTabButton.d.ts +7 -0
- package/dist/components/FormComponents/GroupItem/NextTabButtonWrapper.d.ts +8 -0
- package/dist/components/FormComponents/IntegerItem/IntegerField.d.ts +15 -0
- package/dist/components/FormComponents/IntegerItem/IntegerItem.d.ts +9 -0
- package/dist/components/FormComponents/Item.styles.d.ts +6 -0
- package/dist/components/FormComponents/ItemParts/ContextDisplayItem.d.ts +7 -0
- package/dist/components/FormComponents/ItemParts/FadingCheckIcon.d.ts +6 -0
- package/dist/components/FormComponents/ItemParts/ItemFieldGrid.d.ts +10 -0
- package/dist/components/FormComponents/ItemParts/ItemLabelText.d.ts +7 -0
- package/dist/components/FormComponents/ItemParts/ItemLabelWrapper.d.ts +7 -0
- package/dist/components/FormComponents/ItemParts/QItemCheckboxSingle.d.ts +10 -0
- package/dist/components/FormComponents/ItemParts/QItemCheckboxSingleWithOpenLabel.d.ts +10 -0
- package/dist/components/FormComponents/ItemParts/QItemRadioButtonWithOpenLabel.d.ts +10 -0
- package/dist/components/FormComponents/Lists.styles.d.ts +11 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoice.d.ts +9 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceAutocomplete.d.ts +9 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceCheckboxAnswerOption.d.ts +11 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceCheckboxAnswerValueSet.d.ts +11 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceRadioAnswerOption.d.ts +11 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceRadioAnswerValueSet.d.ts +11 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceRadioSingle.d.ts +8 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceSelectAnswerOption.d.ts +9 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceSelectAnswerValueSet.d.ts +9 -0
- package/dist/components/FormComponents/QItemOpenChoice/QItemOpenChoice.d.ts +9 -0
- package/dist/components/FormComponents/QItemOpenChoice/QItemOpenChoiceAutocomplete.d.ts +9 -0
- package/dist/components/FormComponents/QItemOpenChoice/QItemOpenChoiceCheckboxAnswerOption.d.ts +11 -0
- package/dist/components/FormComponents/QItemOpenChoice/QItemOpenChoiceRadioAnswerOption.d.ts +11 -0
- package/dist/components/FormComponents/QItemOpenChoice/QItemOpenChoiceSelectAnswerOption.d.ts +9 -0
- package/dist/components/FormComponents/QItemOpenChoice/QItemOpenChoiceSelectAnswerValueSet.d.ts +9 -0
- package/dist/components/FormComponents/RepeatGroup/AddItemButton.d.ts +8 -0
- package/dist/components/FormComponents/RepeatGroup/DeleteItemButton.d.ts +9 -0
- package/dist/components/FormComponents/RepeatGroup/RepeatGroup.d.ts +10 -0
- package/dist/components/FormComponents/RepeatGroup/RepeatGroupItem.d.ts +13 -0
- package/dist/components/FormComponents/RepeatItem/AddItemButton.d.ts +8 -0
- package/dist/components/FormComponents/RepeatItem/DeleteItemButton.d.ts +9 -0
- package/dist/components/FormComponents/RepeatItem/RepeatField.d.ts +12 -0
- package/dist/components/FormComponents/RepeatItem/RepeatItem.d.ts +9 -0
- package/dist/components/FormComponents/RepeatItem/RepeatItem.styles.d.ts +22 -0
- package/dist/components/FormComponents/SingleItem/SingleItem.d.ts +9 -0
- package/dist/components/FormComponents/SingleItem/SingleItemSwitcher.d.ts +9 -0
- package/dist/components/FormComponents/StringItem/StringField.d.ts +15 -0
- package/dist/components/FormComponents/StringItem/StringItem.d.ts +9 -0
- package/dist/components/FormComponents/Tables/DeleteRowButton.d.ts +9 -0
- package/dist/components/FormComponents/Tables/QItemGroupTable.d.ts +10 -0
- package/dist/components/FormComponents/Tables/QItemGroupTableRow.d.ts +10 -0
- package/dist/components/FormComponents/Tables/Table.styles.d.ts +10 -0
- package/dist/components/FormComponents/TextItem/TextField.d.ts +14 -0
- package/dist/components/FormComponents/TextItem/TextItem.d.ts +9 -0
- package/dist/components/FormComponents/Textfield.styles.d.ts +5 -0
- package/dist/components/FormComponents/TimeItem/TimeField.d.ts +12 -0
- package/dist/components/FormComponents/TimeItem/TimeItem.d.ts +9 -0
- package/dist/components/FormComponents/Typography.styles.d.ts +6 -0
- package/dist/components/FormComponents/UrlItem/UrlField.d.ts +14 -0
- package/dist/components/FormComponents/UrlItem/UrlItem.d.ts +9 -0
- package/dist/components/FormRenderer/FormBodyCollapsible.d.ts +9 -0
- package/dist/components/FormRenderer/FormBodySingleCollapsible.d.ts +12 -0
- package/dist/components/FormRenderer/FormBodySingleCollapsibleWrapper.d.ts +12 -0
- package/dist/components/FormRenderer/FormBodyTabbed.d.ts +9 -0
- package/dist/components/FormRenderer/FormRenderer.d.ts +3 -0
- package/dist/components/FormRenderer/FormTitle.d.ts +7 -0
- package/dist/components/FormRenderer/FormTopLevelItem.d.ts +9 -0
- package/dist/components/FormRenderer/SmartFormsRenderer.d.ts +9 -0
- package/dist/components/FormRenderer/index.d.ts +1 -0
- package/dist/components/Iconify/Iconify.d.ts +10 -0
- package/dist/components/Lists.styles.d.ts +11 -0
- package/dist/components/Tabs/CompleteTabButton.d.ts +7 -0
- package/dist/components/Tabs/FormBodySingleTab.d.ts +10 -0
- package/dist/components/Tabs/FormBodyTabList.d.ts +10 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/hooks/useBackToTop.d.ts +2 -0
- package/dist/hooks/useDebounce.d.ts +2 -0
- package/dist/hooks/useDecimalCalculatedExpression.d.ts +14 -0
- package/dist/hooks/useHidden.d.ts +3 -0
- package/dist/hooks/useInitialiseGroupTable.d.ts +4 -0
- package/dist/hooks/useInitialiseRenderer.d.ts +3 -0
- package/dist/hooks/useInitialiseRepeatAnswers.d.ts +4 -0
- package/dist/hooks/useInitialiseRepeatGroups.d.ts +4 -0
- package/dist/hooks/useIntegerCalculatedExpression.d.ts +13 -0
- package/dist/hooks/useQueryClient.d.ts +3 -0
- package/dist/hooks/useRenderingExtensions.d.ts +13 -0
- package/dist/hooks/useResponsive.d.ts +2 -0
- package/dist/hooks/useStringCalculatedExpression.d.ts +12 -0
- package/dist/hooks/useTerminologyServerQuery.d.ts +11 -0
- package/dist/hooks/useValidationError.d.ts +3 -0
- package/dist/hooks/useValueSetCodings.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +10481 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +10526 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/answerExpression.interface.d.ts +5 -0
- package/dist/interfaces/calculatedExpression.interface.d.ts +4 -0
- package/dist/interfaces/choice.enum.d.ts +20 -0
- package/dist/interfaces/enableWhen.interface.d.ts +15 -0
- package/dist/interfaces/groupTable.interface.d.ts +5 -0
- package/dist/interfaces/populate.interface.d.ts +41 -0
- package/dist/interfaces/questionnaireStore.interface.d.ts +18 -0
- package/dist/interfaces/regex.interface.d.ts +4 -0
- package/dist/interfaces/renderProps.interface.d.ts +13 -0
- package/dist/interfaces/repeatGroup.interface.d.ts +9 -0
- package/dist/interfaces/repeatItem.interface.d.ts +5 -0
- package/dist/interfaces/tab.interface.d.ts +6 -0
- package/dist/interfaces/valueSet.interface.d.ts +5 -0
- package/dist/interfaces/variables.interface.d.ts +9 -0
- package/dist/setup-jest.d.ts +1 -0
- package/dist/stores/useConfigStore.d.ts +18 -0
- package/dist/stores/useQuestionnaireResponseStore.d.ts +14 -0
- package/dist/stores/useQuestionnaireStore.d.ts +34 -0
- package/dist/stories/FormRendererWrapper.stories.d.ts +11 -0
- package/dist/stories/SmartFormsRenderer.stories.d.ts +14 -0
- package/dist/utils/calculatedExpression.d.ts +14 -0
- package/dist/utils/choice.d.ts +44 -0
- package/dist/utils/debounce.d.ts +2 -0
- package/dist/utils/emptyResource.d.ts +3 -0
- package/dist/utils/enableWhen.d.ts +47 -0
- package/dist/utils/enableWhenExpression.d.ts +13 -0
- package/dist/utils/fhirpath.d.ts +19 -0
- package/dist/utils/initialiseForm.d.ts +20 -0
- package/dist/utils/itemControl.d.ts +108 -0
- package/dist/utils/mapItem.d.ts +18 -0
- package/dist/utils/openChoice.d.ts +22 -0
- package/dist/utils/parseInputs.d.ts +4 -0
- package/dist/utils/populate.d.ts +16 -0
- package/dist/utils/populateCallback.d.ts +6 -0
- package/dist/utils/populateContexts.d.ts +13 -0
- package/dist/utils/populateInputParams.d.ts +8 -0
- package/dist/utils/qItem.d.ts +32 -0
- package/dist/utils/qrItem.d.ts +42 -0
- package/dist/utils/questionnaireStoreUtils/addAdditionalVariables.d.ts +2 -0
- package/dist/utils/questionnaireStoreUtils/createQuestionaireModel.d.ts +3 -0
- package/dist/utils/questionnaireStoreUtils/extractContainedValueSets.d.ts +13 -0
- package/dist/utils/questionnaireStoreUtils/extractLaunchContext.d.ts +3 -0
- package/dist/utils/questionnaireStoreUtils/extractOtherExtensions.d.ts +34 -0
- package/dist/utils/questionnaireStoreUtils/extractTabs.d.ts +3 -0
- package/dist/utils/questionnaireStoreUtils/extractVariables.d.ts +15 -0
- package/dist/utils/questionnaireStoreUtils/resolveValueSets.d.ts +7 -0
- package/dist/utils/tabs.d.ts +75 -0
- package/dist/utils/valueSet.d.ts +21 -0
- package/package.json +71 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare enum QItemChoiceControl {
|
|
2
|
+
Radio = "radio",
|
|
3
|
+
Select = "select",
|
|
4
|
+
Autocomplete = "autocomplete",
|
|
5
|
+
Checkbox = "check-box"
|
|
6
|
+
}
|
|
7
|
+
export declare enum QItemOpenChoiceControl {
|
|
8
|
+
Select = "select",
|
|
9
|
+
Autocomplete = "autocomplete",
|
|
10
|
+
Checkbox = "check-box",
|
|
11
|
+
Radio = "radio"
|
|
12
|
+
}
|
|
13
|
+
export declare enum QItemChoiceOrientation {
|
|
14
|
+
Horizontal = "horizontal",
|
|
15
|
+
Vertical = "vertical"
|
|
16
|
+
}
|
|
17
|
+
export declare enum CheckBoxOptionType {
|
|
18
|
+
AnswerOption = "answerOption",
|
|
19
|
+
AnswerValueSet = "answerValueSet"
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { QuestionnaireItem, QuestionnaireItemEnableWhen, QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
2
|
+
export interface EnableWhenExpression {
|
|
3
|
+
expression: string;
|
|
4
|
+
isEnabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export type EnableWhenItems = Record<string, EnableWhenItemProperties>;
|
|
7
|
+
export interface EnableWhenItemProperties {
|
|
8
|
+
linked: EnableWhenLinkedItem[];
|
|
9
|
+
isEnabled: boolean;
|
|
10
|
+
enableBehavior?: QuestionnaireItem['enableBehavior'];
|
|
11
|
+
}
|
|
12
|
+
export interface EnableWhenLinkedItem {
|
|
13
|
+
enableWhen: QuestionnaireItemEnableWhen;
|
|
14
|
+
answer?: QuestionnaireResponseItemAnswer[];
|
|
15
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Coding, Expression, Extension, Reference } from 'fhir/r4';
|
|
2
|
+
export interface LaunchContext extends Extension {
|
|
3
|
+
url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext';
|
|
4
|
+
extension: LaunchContextExtensions;
|
|
5
|
+
}
|
|
6
|
+
type LaunchContextExtensions = [LaunchContextName, LaunchContextType] | [LaunchContextName, LaunchContextType, LaunchContextDescription];
|
|
7
|
+
type LaunchContextName = LaunchContextNameId | LaunchContextNameCoding;
|
|
8
|
+
interface LaunchContextNameId extends Extension {
|
|
9
|
+
url: 'name';
|
|
10
|
+
valueId: string;
|
|
11
|
+
}
|
|
12
|
+
interface LaunchContextNameCoding extends Extension {
|
|
13
|
+
url: 'name';
|
|
14
|
+
valueCoding: LaunchContextNameCodingValueCoding;
|
|
15
|
+
}
|
|
16
|
+
interface LaunchContextNameCodingValueCoding extends Coding {
|
|
17
|
+
code: 'patient' | 'encounter' | 'location' | 'user' | 'study';
|
|
18
|
+
}
|
|
19
|
+
interface LaunchContextType extends Extension {
|
|
20
|
+
url: 'type';
|
|
21
|
+
valueCode: FhirResourceString;
|
|
22
|
+
}
|
|
23
|
+
interface LaunchContextDescription extends Extension {
|
|
24
|
+
url: 'description';
|
|
25
|
+
valueString: string;
|
|
26
|
+
}
|
|
27
|
+
export type FhirResourceString = 'Account' | 'ActivityDefinition' | 'AdverseEvent' | 'AllergyIntolerance' | 'Appointment' | 'AppointmentResponse' | 'AuditEvent' | 'Basic' | 'Binary' | 'BiologicallyDerivedProduct' | 'BodyStructure' | 'Bundle' | 'CapabilityStatement' | 'CarePlan' | 'CareTeam' | 'CatalogEntry' | 'ChargeItem' | 'ChargeItemDefinition' | 'Claim' | 'ClaimResponse' | 'ClinicalImpression' | 'CodeSystem' | 'Communication' | 'CommunicationRequest' | 'CompartmentDefinition' | 'Composition' | 'ConceptMap' | 'Condition' | 'Consent' | 'Contract' | 'Coverage' | 'CoverageEligibilityRequest' | 'CoverageEligibilityResponse' | 'DetectedIssue' | 'Device' | 'DeviceDefinition' | 'DeviceMetric' | 'DeviceRequest' | 'DeviceUseStatement' | 'DiagnosticReport' | 'DocumentManifest' | 'DocumentReference' | 'EffectEvidenceSynthesis' | 'Encounter' | 'Endpoint' | 'EnrollmentRequest' | 'EnrollmentResponse' | 'EpisodeOfCare' | 'EventDefinition' | 'Evidence' | 'EvidenceVariable' | 'ExampleScenario' | 'ExplanationOfBenefit' | 'FamilyMemberHistory' | 'Flag' | 'Goal' | 'GraphDefinition' | 'Group' | 'GuidanceResponse' | 'HealthcareService' | 'ImagingStudy' | 'Immunization' | 'ImmunizationEvaluation' | 'ImmunizationRecommendation' | 'ImplementationGuide' | 'InsurancePlan' | 'Invoice' | 'Library' | 'Linkage' | 'List' | 'Location' | 'Measure' | 'MeasureReport' | 'Media' | 'Medication' | 'MedicationAdministration' | 'MedicationDispense' | 'MedicationKnowledge' | 'MedicationRequest' | 'MedicationStatement' | 'MedicinalProduct' | 'MedicinalProductAuthorization' | 'MedicinalProductContraindication' | 'MedicinalProductIndication' | 'MedicinalProductIngredient' | 'MedicinalProductInteraction' | 'MedicinalProductManufactured' | 'MedicinalProductPackaged' | 'MedicinalProductPharmaceutical' | 'MedicinalProductUndesirableEffect' | 'MessageDefinition' | 'MessageHeader' | 'MolecularSequence' | 'NamingSystem' | 'NutritionOrder' | 'Observation' | 'ObservationDefinition' | 'OperationDefinition' | 'OperationOutcome' | 'Organization' | 'OrganizationAffiliation' | 'Parameters' | 'Patient' | 'PaymentNotice' | 'PaymentReconciliation' | 'Person' | 'PlanDefinition' | 'Practitioner' | 'PractitionerRole' | 'Procedure' | 'Provenance' | 'Questionnaire' | 'QuestionnaireResponse' | 'RelatedPerson' | 'RequestGroup' | 'ResearchDefinition' | 'ResearchElementDefinition' | 'ResearchStudy' | 'ResearchSubject' | 'RiskAssessment' | 'RiskEvidenceSynthesis' | 'Schedule' | 'SearchParameter' | 'ServiceRequest' | 'Slot' | 'Specimen' | 'SpecimenDefinition' | 'StructureDefinition' | 'StructureMap' | 'Subscription' | 'Substance' | 'SubstanceNucleicAcid' | 'SubstancePolymer' | 'SubstanceProtein' | 'SubstanceReferenceInformation' | 'SubstanceSourceMaterial' | 'SubstanceSpecification' | 'SupplyDelivery' | 'SupplyRequest' | 'Task' | 'TerminologyCapabilities' | 'TestReport' | 'TestScript' | 'ValueSet' | 'VerificationResult' | 'VisionPrescription';
|
|
28
|
+
export interface SourceQuery extends Extension {
|
|
29
|
+
url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-sourceQueries';
|
|
30
|
+
valueReference: Reference;
|
|
31
|
+
}
|
|
32
|
+
export interface QuestionnaireLevelXFhirQueryVariable extends Extension {
|
|
33
|
+
url: 'http://hl7.org/fhir/StructureDefinition/variable';
|
|
34
|
+
valueExpression: XFhirQueryVariableExpression;
|
|
35
|
+
}
|
|
36
|
+
interface XFhirQueryVariableExpression extends Expression {
|
|
37
|
+
name: string;
|
|
38
|
+
language: 'application/x-fhir-query';
|
|
39
|
+
expression: string;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Tabs } from 'smart-forms-app/src/features/renderer/types/tab.interface';
|
|
2
|
+
import type { Variables } from './variables.interface';
|
|
3
|
+
import type { LaunchContext } from './populate.interface';
|
|
4
|
+
import type { EnableWhenExpression, EnableWhenItemProperties } from './enableWhen.interface';
|
|
5
|
+
import type { CalculatedExpression } from './calculatedExpression.interface';
|
|
6
|
+
import type { AnswerExpression } from './answerExpression.interface';
|
|
7
|
+
import type { Coding } from 'fhir/r4';
|
|
8
|
+
export interface QuestionnaireModel {
|
|
9
|
+
tabs: Tabs;
|
|
10
|
+
variables: Variables;
|
|
11
|
+
launchContexts: Record<string, LaunchContext>;
|
|
12
|
+
enableWhenItems: Record<string, EnableWhenItemProperties>;
|
|
13
|
+
enableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
14
|
+
calculatedExpressions: Record<string, CalculatedExpression>;
|
|
15
|
+
answerExpressions: Record<string, AnswerExpression>;
|
|
16
|
+
processedValueSetCodings: Record<string, Coding[]>;
|
|
17
|
+
processedValueSetUrls: Record<string, string>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { QrRepeatGroup } from './repeatGroup.interface.ts';
|
|
2
|
+
export interface PropsWithQrItemChangeHandler<QuestionnaireResponseItem> {
|
|
3
|
+
onQrItemChange: (qrItem: QuestionnaireResponseItem) => unknown;
|
|
4
|
+
}
|
|
5
|
+
export interface PropsWithQrRepeatGroupChangeHandler {
|
|
6
|
+
onQrRepeatGroupChange: (qrRepeatGroup: QrRepeatGroup) => unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface PropsWithIsRepeatedAttribute {
|
|
9
|
+
isRepeated: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface PropsWithIsTabledAttribute {
|
|
12
|
+
isTabled: boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Expression, FhirResource } from 'fhir/r4';
|
|
2
|
+
export interface Variables {
|
|
3
|
+
fhirPathVariables: Record<string, Expression[]>;
|
|
4
|
+
xFhirQueryVariables: Record<string, VariableXFhirQuery>;
|
|
5
|
+
}
|
|
6
|
+
export interface VariableXFhirQuery {
|
|
7
|
+
valueExpression: Expression;
|
|
8
|
+
result?: FhirResource;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Encounter, Patient, Practitioner, Questionnaire } from 'fhir/r4';
|
|
2
|
+
import type Client from 'fhirclient/lib/Client';
|
|
3
|
+
export interface ConfigState {
|
|
4
|
+
smartClient: Client | null;
|
|
5
|
+
patient: Patient | null;
|
|
6
|
+
user: Practitioner | null;
|
|
7
|
+
encounter: Encounter | null;
|
|
8
|
+
launchQuestionnaire: Questionnaire | null;
|
|
9
|
+
debugMode: boolean;
|
|
10
|
+
setSmartClient: (client: Client) => void;
|
|
11
|
+
setPatient: (patient: Patient) => void;
|
|
12
|
+
setUser: (user: Practitioner) => void;
|
|
13
|
+
setEncounter: (encounter: Encounter) => void;
|
|
14
|
+
setLaunchQuestionnaire: (launchQuestionnaire: Questionnaire | null) => void;
|
|
15
|
+
activateDebugMode: () => void;
|
|
16
|
+
}
|
|
17
|
+
declare const useConfigStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ConfigState>>;
|
|
18
|
+
export default useConfigStore;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { QuestionnaireResponse } from 'fhir/r4';
|
|
2
|
+
export interface UseQuestionnaireResponseStoreType {
|
|
3
|
+
sourceResponse: QuestionnaireResponse;
|
|
4
|
+
updatableResponse: QuestionnaireResponse;
|
|
5
|
+
hasChanges: boolean;
|
|
6
|
+
buildSourceResponse: (response: QuestionnaireResponse) => void;
|
|
7
|
+
populateResponse: (response: QuestionnaireResponse) => void;
|
|
8
|
+
updateResponse: (updatedResponse: QuestionnaireResponse) => void;
|
|
9
|
+
saveResponse: (savedResponse: QuestionnaireResponse) => void;
|
|
10
|
+
clearResponse: (clearedResponse: QuestionnaireResponse) => void;
|
|
11
|
+
destroySourceResponse: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare const useQuestionnaireResponseStore: import("zustand").UseBoundStore<import("zustand").StoreApi<UseQuestionnaireResponseStoreType>>;
|
|
14
|
+
export default useQuestionnaireResponseStore;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Coding, Questionnaire, QuestionnaireResponse, QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
2
|
+
import type { Variables } from '../interfaces/variables.interface';
|
|
3
|
+
import type { LaunchContext } from '../interfaces/populate.interface';
|
|
4
|
+
import type { CalculatedExpression } from '../interfaces/calculatedExpression.interface';
|
|
5
|
+
import type { EnableWhenExpression, EnableWhenItems } from '../interfaces/enableWhen.interface';
|
|
6
|
+
import type { AnswerExpression } from '../interfaces/answerExpression.interface';
|
|
7
|
+
import type { Tabs } from '../interfaces/tab.interface';
|
|
8
|
+
export interface UseQuestionnaireStoreType {
|
|
9
|
+
sourceQuestionnaire: Questionnaire;
|
|
10
|
+
tabs: Tabs;
|
|
11
|
+
currentTabIndex: number;
|
|
12
|
+
variables: Variables;
|
|
13
|
+
launchContexts: Record<string, LaunchContext>;
|
|
14
|
+
enableWhenItems: EnableWhenItems;
|
|
15
|
+
enableWhenLinkedQuestions: Record<string, string[]>;
|
|
16
|
+
enableWhenIsActivated: boolean;
|
|
17
|
+
enableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
18
|
+
calculatedExpressions: Record<string, CalculatedExpression>;
|
|
19
|
+
answerExpressions: Record<string, AnswerExpression>;
|
|
20
|
+
processedValueSetCodings: Record<string, Coding[]>;
|
|
21
|
+
processedValueSetUrls: Record<string, string>;
|
|
22
|
+
cachedValueSetCodings: Record<string, Coding[]>;
|
|
23
|
+
buildSourceQuestionnaire: (questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, additionalVariables?: Record<string, object>) => Promise<void>;
|
|
24
|
+
destroySourceQuestionnaire: () => void;
|
|
25
|
+
switchTab: (newTabIndex: number) => void;
|
|
26
|
+
markTabAsComplete: (tabLinkId: string) => void;
|
|
27
|
+
updateEnableWhenItem: (linkId: string, newAnswer: QuestionnaireResponseItemAnswer[]) => void;
|
|
28
|
+
toggleEnableWhenActivation: (isActivated: boolean) => void;
|
|
29
|
+
updateExpressions: (updatedResponse: QuestionnaireResponse) => void;
|
|
30
|
+
addCodingToCache: (valueSetUrl: string, codings: Coding[]) => void;
|
|
31
|
+
updatePopulatedProperties: (populatedResponse: QuestionnaireResponse) => QuestionnaireResponse;
|
|
32
|
+
}
|
|
33
|
+
declare const useQuestionnaireStore: import("zustand").UseBoundStore<import("zustand").StoreApi<UseQuestionnaireStoreType>>;
|
|
34
|
+
export default useQuestionnaireStore;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import type { SmartFormsRenderer } from '../components';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof SmartFormsRenderer;
|
|
6
|
+
tags: string[];
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof meta>;
|
|
10
|
+
export declare const ItemWithoutResponse: Story;
|
|
11
|
+
export declare const ItemWithResponse: Story;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import { SmartFormsRenderer } from '../components';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof SmartFormsRenderer;
|
|
6
|
+
tags: string[];
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof meta>;
|
|
10
|
+
export declare const Form715: Story;
|
|
11
|
+
export declare const Form715WithResponse: Story;
|
|
12
|
+
export declare const FormTestGrid: Story;
|
|
13
|
+
export declare const FormTestGridWithResponse: Story;
|
|
14
|
+
export declare const QTestGridWithResponseAddFhirPath: Story;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CalculatedExpression } from '../interfaces/calculatedExpression.interface';
|
|
2
|
+
import type { Expression, Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
3
|
+
interface EvaluateInitialCalculatedExpressionsParams {
|
|
4
|
+
initialResponse: QuestionnaireResponse;
|
|
5
|
+
calculatedExpressions: Record<string, CalculatedExpression>;
|
|
6
|
+
variablesFhirPath: Record<string, Expression[]>;
|
|
7
|
+
}
|
|
8
|
+
export declare function evaluateInitialCalculatedExpressions(params: EvaluateInitialCalculatedExpressionsParams): Record<string, CalculatedExpression>;
|
|
9
|
+
export declare function evaluateCalculatedExpressions(fhirPathContext: Record<string, any>, calculatedExpressions: Record<string, CalculatedExpression>): {
|
|
10
|
+
calculatedExpsIsUpdated: boolean;
|
|
11
|
+
updatedCalculatedExpressions: Record<string, CalculatedExpression>;
|
|
12
|
+
};
|
|
13
|
+
export declare function initialiseCalculatedExpressionValues(questionnaire: Questionnaire, populatedResponse: QuestionnaireResponse, calculatedExpressions: Record<string, CalculatedExpression>): QuestionnaireResponse;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Coding, QuestionnaireItem, QuestionnaireItemAnswerOption, QuestionnaireResponseItem, QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
2
|
+
import { QItemChoiceControl, QItemChoiceOrientation } from '../interfaces/choice.enum';
|
|
3
|
+
/**
|
|
4
|
+
* Get choice control type based on certain criteria in choice items
|
|
5
|
+
*
|
|
6
|
+
* @author Sean Fong
|
|
7
|
+
*/
|
|
8
|
+
export declare function getChoiceControlType(qItem: QuestionnaireItem): QItemChoiceControl;
|
|
9
|
+
/**
|
|
10
|
+
* Find and return corresponding answerOption based on selected answer in form
|
|
11
|
+
*
|
|
12
|
+
* @author Sean Fong
|
|
13
|
+
*/
|
|
14
|
+
export declare function findInAnswerOptions(answerOptions: QuestionnaireItemAnswerOption[], selected: string): QuestionnaireResponseItemAnswer | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Find and return corresponding coding from AnswerValyeSet based on selected answer in form
|
|
17
|
+
*
|
|
18
|
+
* @author Sean Fong
|
|
19
|
+
*/
|
|
20
|
+
export declare function findInAnswerValueSetCodings(codings: Coding[], selected: string): QuestionnaireResponseItemAnswer | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Find and return string value from selected answer
|
|
23
|
+
*
|
|
24
|
+
* @author Sean Fong
|
|
25
|
+
*/
|
|
26
|
+
export declare function getQrChoiceValue(qrChoice: QuestionnaireResponseItem, returnNull?: boolean): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* Update choice checkbox group answers based on checkbox changes
|
|
29
|
+
*
|
|
30
|
+
* @author Sean Fong
|
|
31
|
+
*/
|
|
32
|
+
export declare function updateQrCheckboxAnswers(changedValue: string, answers: QuestionnaireResponseItemAnswer[], answerOptions: QuestionnaireItemAnswerOption[], qrChoiceCheckbox: QuestionnaireResponseItem, isMultiSelection: boolean): QuestionnaireResponseItem | null;
|
|
33
|
+
/**
|
|
34
|
+
* Get choice orientation from its itemControl
|
|
35
|
+
*
|
|
36
|
+
* @author Sean Fong
|
|
37
|
+
*/
|
|
38
|
+
export declare function getChoiceOrientation(qItem: QuestionnaireItem): QItemChoiceOrientation;
|
|
39
|
+
/**
|
|
40
|
+
* Converts an array of codings to an array of valueCodings which can use the QuestionnaireItemAnswerOption type
|
|
41
|
+
*
|
|
42
|
+
* @author Sean Fong
|
|
43
|
+
*/
|
|
44
|
+
export declare function mapCodingsToOptions(codings: Coding[]): QuestionnaireItemAnswerOption[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { QuestionnaireItemEnableWhen, QuestionnaireResponse, QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
2
|
+
import type { EnableWhenItemProperties, EnableWhenItems } from '../interfaces/enableWhen.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Create a linkedQuestionsMap that contains linked items of enableWhen items
|
|
5
|
+
* mapped to an array containing all its respective enableWhen items' linkIds
|
|
6
|
+
* returns a key-value pair of <linkedItemId, [enableWhenItem1LinkId, enableWhenItem2LinkId, enableWhenItem3LinkId]>
|
|
7
|
+
*
|
|
8
|
+
* @author Sean Fong
|
|
9
|
+
*/
|
|
10
|
+
export declare function createEnableWhenLinkedQuestions(enableWhenItems: EnableWhenItems): Record<string, string[]>;
|
|
11
|
+
/**
|
|
12
|
+
* Performs switching for non-group enableWhenItems based on their item types.
|
|
13
|
+
*
|
|
14
|
+
* @author Sean Fong
|
|
15
|
+
*/
|
|
16
|
+
export declare function isEnabledAnswerTypeSwitcher(enableWhen: QuestionnaireItemEnableWhen, answer: QuestionnaireResponseItemAnswer): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Read initial answer values in questionnaireResponse
|
|
19
|
+
* return a map of initial values with key-value pair <linkedItemId, initial value>
|
|
20
|
+
*
|
|
21
|
+
* @author Sean Fong
|
|
22
|
+
*/
|
|
23
|
+
export declare function readInitialAnswers(questionnaireResponse: QuestionnaireResponse, linkedQuestionsMap: Record<string, string[]>): Record<string, QuestionnaireResponseItemAnswer[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Set initial answer values into enableWhenItems' answer attributes
|
|
26
|
+
* Update enabled status of each enableWhenItem simultaneously
|
|
27
|
+
*
|
|
28
|
+
* @author Sean Fong
|
|
29
|
+
*/
|
|
30
|
+
export declare function setInitialAnswers(initialAnswers: Record<string, QuestionnaireResponseItemAnswer[]>, items: EnableWhenItems, linkedQuestionsMap: Record<string, string[]>): EnableWhenItems;
|
|
31
|
+
/**
|
|
32
|
+
* Update answer of the target linkId in every related enableWhenItem's linked items
|
|
33
|
+
* Then update the enabled status of every related enableWhenItem
|
|
34
|
+
*
|
|
35
|
+
* @author Sean Fong
|
|
36
|
+
*/
|
|
37
|
+
export declare function updateItemAnswer(items: EnableWhenItems, linkedQuestions: string[], linkId: string, newAnswer: QuestionnaireResponseItemAnswer[]): EnableWhenItems;
|
|
38
|
+
/**
|
|
39
|
+
* Check if an enableWhenItem is enabled based on the answer of its linked items
|
|
40
|
+
*
|
|
41
|
+
* @author Sean Fong
|
|
42
|
+
*/
|
|
43
|
+
export declare function checkItemIsEnabled(enableWhenItemProperties: EnableWhenItemProperties): boolean;
|
|
44
|
+
export declare function assignPopulatedAnswersToEnableWhen(items: EnableWhenItems, questionnaireResponse: QuestionnaireResponse): {
|
|
45
|
+
initialisedItems: EnableWhenItems;
|
|
46
|
+
linkedQuestions: Record<string, string[]>;
|
|
47
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EnableWhenExpression } from '../interfaces/enableWhen.interface';
|
|
2
|
+
import type { Expression, QuestionnaireResponse } from 'fhir/r4';
|
|
3
|
+
interface EvaluateInitialEnableWhenExpressionsParams {
|
|
4
|
+
initialResponse: QuestionnaireResponse;
|
|
5
|
+
enableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
6
|
+
variablesFhirPath: Record<string, Expression[]>;
|
|
7
|
+
}
|
|
8
|
+
export declare function evaluateInitialEnableWhenExpressions(params: EvaluateInitialEnableWhenExpressionsParams): Record<string, EnableWhenExpression>;
|
|
9
|
+
export declare function evaluateEnableWhenExpressions(fhirPathContext: Record<string, any>, enableWhenExpressions: Record<string, EnableWhenExpression>): {
|
|
10
|
+
enableWhenExpsIsUpdated: boolean;
|
|
11
|
+
updatedEnableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Expression, QuestionnaireResponse, QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
|
+
import type { CalculatedExpression } from '../interfaces/calculatedExpression.interface';
|
|
3
|
+
import type { EnableWhenExpression } from '../interfaces/enableWhen.interface';
|
|
4
|
+
interface EvaluateUpdatedExpressionsParams {
|
|
5
|
+
updatedResponse: QuestionnaireResponse;
|
|
6
|
+
calculatedExpressions: Record<string, CalculatedExpression>;
|
|
7
|
+
enableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
8
|
+
variablesFhirPath: Record<string, Expression[]>;
|
|
9
|
+
}
|
|
10
|
+
export declare function evaluateUpdatedExpressions(params: EvaluateUpdatedExpressionsParams): {
|
|
11
|
+
isUpdated: boolean;
|
|
12
|
+
updatedEnableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
13
|
+
updatedCalculatedExpressions: Record<string, CalculatedExpression>;
|
|
14
|
+
};
|
|
15
|
+
export declare function createFhirPathContext(questionnaireResponse: QuestionnaireResponse, variablesFhirPath: Record<string, Expression[]>): Record<string, any>;
|
|
16
|
+
export declare function evaluateFhirPathRecursive(item: QuestionnaireResponseItem, variablesFhirPath: Record<string, Expression[]>, fhirPathContext: Record<string, any>): void;
|
|
17
|
+
export declare function evaluateItemFhirPath(item: QuestionnaireResponseItem, variablesFhirPath: Record<string, Expression[]>, fhirPathContext: Record<string, any>): void;
|
|
18
|
+
export declare function evaluateResourceLevelFhirPath(resource: QuestionnaireResponse, variablesFhirPath: Record<string, Expression[]>, fhirPathContext: Record<string, any>): void;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Expression, QuestionnaireResponse } from 'fhir/r4';
|
|
2
|
+
import type { EnableWhenExpression, EnableWhenItems } from '../interfaces/enableWhen.interface';
|
|
3
|
+
import type { Tabs } from '../interfaces/tab.interface';
|
|
4
|
+
import type { CalculatedExpression } from '../interfaces/calculatedExpression.interface';
|
|
5
|
+
interface initialFormFromResponseParams {
|
|
6
|
+
questionnaireResponse: QuestionnaireResponse;
|
|
7
|
+
enableWhenItems: EnableWhenItems;
|
|
8
|
+
enableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
9
|
+
calculatedExpressions: Record<string, CalculatedExpression>;
|
|
10
|
+
variablesFhirPath: Record<string, Expression[]>;
|
|
11
|
+
tabs: Tabs;
|
|
12
|
+
}
|
|
13
|
+
export declare function initialiseFormFromResponse(params: initialFormFromResponseParams): {
|
|
14
|
+
initialEnableWhenItems: EnableWhenItems;
|
|
15
|
+
initialEnableWhenLinkedQuestions: Record<string, string[]>;
|
|
16
|
+
initialEnableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
17
|
+
initialCalculatedExpressions: Record<string, CalculatedExpression>;
|
|
18
|
+
firstVisibleTab: number;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Expression, Extension, QuestionnaireItem, QuestionnaireResponse } from 'fhir/r4';
|
|
2
|
+
import type { RegexValidation } from '../interfaces/regex.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Check if the extension has an itemControl code equal to the given itemControlCode
|
|
5
|
+
*
|
|
6
|
+
* @author Sean Fong
|
|
7
|
+
*/
|
|
8
|
+
export declare function isSpecificItemControl(qItem: QuestionnaireItem, itemControlCode: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Check if the extension has an displayCategory code equal to the given displayCategory
|
|
11
|
+
*
|
|
12
|
+
* @author Sean Fong
|
|
13
|
+
*/
|
|
14
|
+
export declare function isSpecificDisplayCategory(qItem: QuestionnaireItem, itemControlCode: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Check if the extension has url for items that use shortText
|
|
17
|
+
*
|
|
18
|
+
* @author Sean Fong
|
|
19
|
+
*/
|
|
20
|
+
export declare function getShortText(qItem: QuestionnaireItem): string | null;
|
|
21
|
+
/**
|
|
22
|
+
* Check if the extension has url for hidden questions
|
|
23
|
+
*
|
|
24
|
+
* @author Sean Fong
|
|
25
|
+
*/
|
|
26
|
+
export declare function hasHiddenExtension(qItem: QuestionnaireItem): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Check if an answerExpression extension is present
|
|
29
|
+
*
|
|
30
|
+
* @author Sean Fong
|
|
31
|
+
*/
|
|
32
|
+
export declare function getAnswerExpression(qItem: QuestionnaireItem): Expression | null;
|
|
33
|
+
/**
|
|
34
|
+
* Check if the extension has url for items that use open label
|
|
35
|
+
*
|
|
36
|
+
* @author Sean Fong
|
|
37
|
+
*/
|
|
38
|
+
export declare function getOpenLabelText(qItem: QuestionnaireItem): string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Check if the decimal value has a quantity precision for the decimal value
|
|
41
|
+
*
|
|
42
|
+
* @author Sean Fong
|
|
43
|
+
*/
|
|
44
|
+
export declare function getDecimalPrecision(qItem: QuestionnaireItem): number | null;
|
|
45
|
+
/**
|
|
46
|
+
* Check if the extension has a url for xhtml rendering
|
|
47
|
+
*
|
|
48
|
+
* @author Sean Fong
|
|
49
|
+
*/
|
|
50
|
+
export declare function getXHtmlString(qItem: QuestionnaireItem): string | null;
|
|
51
|
+
export declare function getXHtmlStringFromExtension(extensions: Extension[]): string | null;
|
|
52
|
+
/**
|
|
53
|
+
* Check if the item label (text) has a valueMarkdown extension
|
|
54
|
+
*
|
|
55
|
+
* @author Sean Fong
|
|
56
|
+
*/
|
|
57
|
+
export declare function getMarkdownString(qItem: QuestionnaireItem): string | null;
|
|
58
|
+
/**
|
|
59
|
+
* Get questionnaire name from questionnaireResponse
|
|
60
|
+
* If questionnaireResponse does not have a name, fallback to questionnaireResponse questionnaireId
|
|
61
|
+
*
|
|
62
|
+
* @author Sean Fong
|
|
63
|
+
*/
|
|
64
|
+
export declare function getQuestionnaireNameFromResponse(questionnaireResponse: QuestionnaireResponse): string;
|
|
65
|
+
/**
|
|
66
|
+
* Get text display prompt for items with itemControlCode prompt and has a prompt childItem
|
|
67
|
+
*
|
|
68
|
+
* @author Sean Fong
|
|
69
|
+
*/
|
|
70
|
+
export declare function getTextDisplayPrompt(qItem: QuestionnaireItem): string;
|
|
71
|
+
/**
|
|
72
|
+
* Check if item is readonly
|
|
73
|
+
*
|
|
74
|
+
* @author Sean Fong
|
|
75
|
+
*/
|
|
76
|
+
export declare function getReadOnly(qItem: QuestionnaireItem): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Get decimal text display unit for items with itemControlCode unit and has a unit childItem
|
|
79
|
+
*
|
|
80
|
+
* @author Sean Fong
|
|
81
|
+
*/
|
|
82
|
+
export declare function getTextDisplayUnit(qItem: QuestionnaireItem): string;
|
|
83
|
+
/**
|
|
84
|
+
* Get text display instructions for items with itemControlCode instructions and has an instructions childItem
|
|
85
|
+
*
|
|
86
|
+
* @author Sean Fong
|
|
87
|
+
*/
|
|
88
|
+
export declare function getTextDisplayInstructions(qItem: QuestionnaireItem): string;
|
|
89
|
+
/**
|
|
90
|
+
* Get entry format if its extension is present
|
|
91
|
+
* i.e. DD-MM-YYYY for dates, HH:MM for times etc.
|
|
92
|
+
*
|
|
93
|
+
* @author Sean Fong
|
|
94
|
+
*/
|
|
95
|
+
export declare function getEntryFormat(qItem: QuestionnaireItem): string;
|
|
96
|
+
/**
|
|
97
|
+
* Get entry format if its extension is present
|
|
98
|
+
* i.e. DD-MM-YYYY for dates, HH:MM for times etc.
|
|
99
|
+
*
|
|
100
|
+
* @author Sean Fong
|
|
101
|
+
*/
|
|
102
|
+
export declare function getRegexValidation(qItem: QuestionnaireItem): RegexValidation | null;
|
|
103
|
+
/**
|
|
104
|
+
* Get maximum length of characters allowed if present
|
|
105
|
+
*
|
|
106
|
+
* @author Sean Fong
|
|
107
|
+
*/
|
|
108
|
+
export declare function getMaxLength(qItem: QuestionnaireItem): number | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
|
+
/**
|
|
3
|
+
* Generate an array of QuestionnaireResponseItems corresponding to its QuestionnaireItem indexes an array.
|
|
4
|
+
* QuestionnaireItems without a corresponding QuestionnaireResponseItem is set as undefined.
|
|
5
|
+
* i.e. QItems = [QItem0, QItem1, QItem2]. Only QItem0 and QItem2 have QrItems
|
|
6
|
+
* Generated array: [QrItem0, undefined, QrItem2]
|
|
7
|
+
*
|
|
8
|
+
* @author Sean Fong
|
|
9
|
+
*/
|
|
10
|
+
export declare function getQrItemsIndex(qItems: QuestionnaireItem[], qrItems: QuestionnaireResponseItem[], qItemsIndexMap: Record<string, number>): (QuestionnaireResponseItem | QuestionnaireResponseItem[])[];
|
|
11
|
+
/**
|
|
12
|
+
* Generate a dictionary of QuestionnaireItems linkIds mapped to their respective array indexes <linkId, QItemIndex>
|
|
13
|
+
* i.e. { ee2589d5: 0, f9aaa187: 1, 88cab112: 2 }
|
|
14
|
+
* where ee2589d5, f9aaa187 and 88cab112 are linkIds of QItem0, QItem1 and QItem2 respectively
|
|
15
|
+
*
|
|
16
|
+
* @author Sean Fong
|
|
17
|
+
*/
|
|
18
|
+
export declare function mapQItemsIndex(qGroup: QuestionnaireItem): Record<string, number>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Coding, QuestionnaireItem, QuestionnaireItemAnswerOption, QuestionnaireResponseItem, QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
2
|
+
import { CheckBoxOptionType, QItemOpenChoiceControl } from '../interfaces/choice.enum';
|
|
3
|
+
/**
|
|
4
|
+
* Update open-choice checkbox group answers based on checkbox changes
|
|
5
|
+
*
|
|
6
|
+
* @author Sean Fong
|
|
7
|
+
*/
|
|
8
|
+
export declare function updateQrOpenChoiceCheckboxAnswers(changedOptionAnswer: string | null, changedOpenLabelAnswer: string | null, answers: QuestionnaireResponseItemAnswer[], answerOptions: QuestionnaireItemAnswerOption[] | Coding[], qrChoiceCheckbox: QuestionnaireResponseItem, checkboxOptionType: CheckBoxOptionType, isMultiSelection: boolean): QuestionnaireResponseItem | null;
|
|
9
|
+
export declare function getOldOpenLabelAnswer(answers: QuestionnaireResponseItemAnswer[], options: QuestionnaireItemAnswerOption[]): QuestionnaireResponseItemAnswer | null;
|
|
10
|
+
/**
|
|
11
|
+
* Get openChoice control type from qItem
|
|
12
|
+
* defaults to select if no control code is provided
|
|
13
|
+
*
|
|
14
|
+
* @author Sean Fong
|
|
15
|
+
*/
|
|
16
|
+
export declare function getOpenChoiceControlType(qItem: QuestionnaireItem): QItemOpenChoiceControl;
|
|
17
|
+
/**
|
|
18
|
+
* Get string label from given answerOption
|
|
19
|
+
*
|
|
20
|
+
* @author Sean Fong
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAnswerOptionLabel(option: QuestionnaireItemAnswerOption | string): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function parseValidInteger(input: string): number;
|
|
2
|
+
export declare function parseValidNumericString(input: string): string;
|
|
3
|
+
export declare function parseDecimalStringWithPrecision(input: string, precision: number | null): string;
|
|
4
|
+
export declare function parseDecimalStringToFloat(input: string, precision: number): number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Encounter, Patient, Practitioner, Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
2
|
+
import type Client from 'fhirclient/lib/Client';
|
|
3
|
+
export interface PopulateFormParams {
|
|
4
|
+
populated: QuestionnaireResponse;
|
|
5
|
+
hasWarnings: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Pre-populate questionnaire from CMS patient data to form a populated questionnaireResponse
|
|
9
|
+
*
|
|
10
|
+
* @author Sean Fong
|
|
11
|
+
*/
|
|
12
|
+
export declare function populateQuestionnaire(questionnaire: Questionnaire, fhirClient: Client, patient: Patient, user: Practitioner, encounter: Encounter | null, populateForm: {
|
|
13
|
+
(params: PopulateFormParams): void;
|
|
14
|
+
}, exitSpinner: {
|
|
15
|
+
(): void;
|
|
16
|
+
}): Promise<void>;
|