diff --git a/.husky/pre-commit b/.husky/pre-commit index fa4f7e9a..82babdd8 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,5 @@ yarn run lint-staged yarn extract +yarn compile git add shared/src/locale diff --git a/shared/src/hooks/questionnaire-response-form-data.ts b/shared/src/hooks/questionnaire-response-form-data.ts index 6bca7633..9f80aa18 100644 --- a/shared/src/hooks/questionnaire-response-form-data.ts +++ b/shared/src/hooks/questionnaire-response-form-data.ts @@ -1,8 +1,3 @@ -import { useService } from 'fhir-react/lib/hooks/service'; -import { isFailure, isSuccess, RemoteDataResult, success } from 'fhir-react/lib/libs/remoteData'; -import { getReference, saveFHIRResource } from 'fhir-react/lib/services/fhir'; -import { mapSuccess, service } from 'fhir-react/lib/services/service'; -import { formatFHIRDateTime } from 'fhir-react/lib/utils/date'; import { QuestionnaireResponse as FHIRQuestionnaireResponse, Patient, @@ -19,6 +14,12 @@ import { removeDisabledAnswers, } from 'sdc-qrf'; +import { useService } from 'fhir-react/lib/hooks/service'; +import { isFailure, isSuccess, RemoteDataResult, success } from 'fhir-react/lib/libs/remoteData'; +import { getReference, saveFHIRResource } from 'fhir-react/lib/services/fhir'; +import { mapSuccess, service } from 'fhir-react/lib/services/service'; +import { formatFHIRDateTime } from 'fhir-react/lib/utils/date'; + import { QuestionnaireResponse as FCEQuestionnaireResponse, ParametersParameter as FCEParametersParameter, @@ -137,7 +138,7 @@ export async function loadQuestionnaireResponseFormData(props: QuestionnaireResp if (questionnaireLoader.type === 'id') { return service({ method: 'GET', - url: `/Questionnaire/${questionnaireLoader.questionnaireId}/$assemble`, + url: `/Questionnaire/${questionnaireLoader.questionnaireId}`, }); } @@ -199,23 +200,24 @@ export async function handleFormDataSave( }; const finalFHIRQuestionnaireResponse: FHIRQuestionnaireResponse = fromFirstClassExtension(finalFCEQuestionnaireResponse); + const fhirQuestionnaire: FHIRQuestionnaire = fromFirstClassExtension(questionnaire); - const constraintRemoteData = await service({ - url: '/QuestionnaireResponse/$constraint-check', - method: 'POST', - data: { - resourceType: 'Parameters', - parameter: [ - { name: 'Questionnaire', resource: fhirQuestionnaire }, - { name: 'QuestionnaireResponse', resource: finalFHIRQuestionnaireResponse }, - ...(launchContextParameters || []), - ], - }, - }); - if (isFailure(constraintRemoteData)) { - return constraintRemoteData; - } + // const constraintRemoteData = await service({ + // url: '/QuestionnaireResponse/$constraint-check', + // method: 'POST', + // data: { + // resourceType: 'Parameters', + // parameter: [ + // { name: 'Questionnaire', resource: fhirQuestionnaire }, + // { name: 'QuestionnaireResponse', resource: finalFHIRQuestionnaireResponse }, + // ...(launchContextParameters || []), + // ], + // }, + // }); + // if (isFailure(constraintRemoteData)) { + // return constraintRemoteData; + // } const saveQRRemoteData = await questionnaireResponseSaveService(finalFHIRQuestionnaireResponse); if (isFailure(saveQRRemoteData)) { @@ -224,7 +226,7 @@ export async function handleFormDataSave( const extractRemoteData = await service({ method: 'POST', - url: '/Questionnaire/$extract', + url: '/QuestionnaireResponse/$extract', data: { resourceType: 'Parameters', parameter: [ diff --git a/shared/src/locale/en/messages.po b/shared/src/locale/en/messages.po index 370587e8..2bc33122 100644 --- a/shared/src/locale/en/messages.po +++ b/shared/src/locale/en/messages.po @@ -13,7 +13,7 @@ msgstr "" "Language-Team: \n" "Plural-Forms: \n" -#: src/components/BaseQuestionnaireResponseForm/index.tsx:247 +#: src/components/BaseQuestionnaireResponseForm/index.tsx:248 msgid "{0}" msgstr "" @@ -22,7 +22,7 @@ msgstr "" #~ msgstr "" #: src/components/PatientEncounter/index.tsx:44 -#: src/containers/DocumentsList/index.tsx:69 +#: src/containers/DocumentsList/index.tsx:70 #: src/containers/EncounterList/index.tsx:71 #: src/containers/PatientList/index.tsx:93 #: src/containers/PractitionerList/index.tsx:103 @@ -30,23 +30,23 @@ msgstr "" msgid "Actions" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:78 +#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:79 msgid "Active" msgstr "" -#: src/containers/PatientDetails/PatientOverview/utils.tsx:248 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:249 msgid "Active Medications" msgstr "" -#: src/containers/PatientDetails/PatientOverview/utils.tsx:182 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:183 msgid "Activities" msgstr "" -#: src/containers/PatientDetails/PatientWearables/index.tsx:21 +#: src/containers/PatientDetails/PatientWearables/index.tsx:22 msgid "Activity" msgstr "" -#: src/containers/Scheduling/Availability/index.tsx:127 +#: src/containers/Scheduling/Availability/index.tsx:128 msgid "Add break" msgstr "" @@ -62,12 +62,12 @@ msgstr "" #~ msgid "Add New Practitioner" #~ msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:299 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:301 msgid "Add option" msgstr "" -#: src/components/ModalNewPatient/index.tsx:17 -#: src/components/ModalNewPatient/index.tsx:21 +#: src/components/ModalNewPatient/index.tsx:52 +#: src/components/ModalNewPatient/index.tsx:56 msgid "Add patient" msgstr "" @@ -84,23 +84,23 @@ msgstr "" #~ msgid "Add questionnaire item" #~ msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:80 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:82 msgid "Adjust Last Option Right" msgstr "" -#: src/containers/PatientDetails/PatientOverview/utils.tsx:69 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:70 msgid "Allergies" msgstr "" -#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:148 +#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:151 msgid "Amend" msgstr "" -#: src/containers/Scheduling/ScheduleCalendar/components/AppointmentDetailsModal/index.tsx:99 +#: src/containers/Scheduling/ScheduleCalendar/components/AppointmentDetailsModal/index.tsx:100 msgid "Appointment" msgstr "" -#: src/containers/Appointment/PublicAppointment.tsx:47 +#: src/containers/Appointment/PublicAppointment.tsx:49 msgid "Appointment booking" msgstr "" @@ -109,25 +109,25 @@ msgstr "" #~ msgid "Appointment date" #~ msgstr "" -#: src/containers/Scheduling/ScheduleCalendar/index.tsx:125 +#: src/containers/Scheduling/ScheduleCalendar/index.tsx:126 msgid "Appointment successfully added" msgstr "" -#: src/containers/Scheduling/ScheduleCalendar/index.tsx:108 +#: src/containers/Scheduling/ScheduleCalendar/index.tsx:109 msgid "Appointment successfully rescheduled" msgstr "" -#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:143 +#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:146 msgid "Are you sure you want to amend the document?" msgstr "" -#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:166 +#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:169 msgid "Are you sure you want to delete the document?" msgstr "" #: src/containers/PractitionerDetails/PractitionerHeader/index.tsx:41 #: src/containers/PractitionerDetails/PractitionerHeader/index.tsx:73 -#: src/containers/Scheduling/Availability/index.tsx:54 +#: src/containers/Scheduling/Availability/index.tsx:55 msgid "Availability" msgstr "" @@ -139,7 +139,7 @@ msgstr "" #~ msgid "Blood pressure" #~ msgstr "" -#: src/containers/Scheduling/Availability/index.tsx:184 +#: src/containers/Scheduling/Availability/index.tsx:185 msgid "Break" msgstr "" @@ -147,13 +147,13 @@ msgstr "" msgid "Build your form" msgstr "" -#: src/containers/PatientDetails/PatientWearables/index.tsx:45 +#: src/containers/PatientDetails/PatientWearables/index.tsx:46 msgid "Calories" msgstr "" -#: src/components/BaseQuestionnaireResponseForm/index.tsx:237 -#: src/containers/DocumentsList/ChooseDocumentToCreateModal/index.tsx:48 -#: src/containers/Scheduling/Availability/index.tsx:70 +#: src/components/BaseQuestionnaireResponseForm/index.tsx:238 +#: src/containers/DocumentsList/ChooseDocumentToCreateModal/index.tsx:49 +#: src/containers/Scheduling/Availability/index.tsx:71 msgid "Cancel" msgstr "" @@ -161,12 +161,12 @@ msgstr "" msgid "Child" msgstr "" -#: src/containers/PractitionerDetails/PractitionerOverview/index.tsx:84 +#: src/containers/PractitionerDetails/PractitionerOverview/index.tsx:85 msgid "Clinician successfully updated" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:168 -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:505 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:170 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:507 msgid "Code" msgstr "" @@ -174,11 +174,11 @@ msgstr "" #~ msgid "Col" #~ msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:56 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:58 msgid "Col (default)" msgstr "" -#: src/containers/EncounterDetails/index.tsx:88 +#: src/containers/EncounterDetails/index.tsx:89 msgid "Complete encounter" msgstr "" @@ -192,33 +192,33 @@ msgstr "" msgid "Completed" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:485 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:487 msgid "Concepts:" msgstr "" -#: src/containers/PatientDetails/PatientOverview/utils.tsx:107 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:108 msgid "Conditions" msgstr "" -#: src/containers/PatientDetails/PatientOverview/utils.tsx:143 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:144 msgid "Consents" msgstr "" -#: src/containers/EncounterDetails/index.tsx:62 -#: src/containers/EncounterDetails/index.tsx:67 +#: src/containers/EncounterDetails/index.tsx:63 +#: src/containers/EncounterDetails/index.tsx:68 msgid "Consultation" msgstr "" -#: src/containers/DocumentsList/ChooseDocumentToCreateModal/index.tsx:76 +#: src/containers/DocumentsList/ChooseDocumentToCreateModal/index.tsx:77 msgid "Create" msgstr "" -#: src/containers/EncounterDetails/index.tsx:79 +#: src/containers/EncounterDetails/index.tsx:80 #: src/containers/PatientDetails/PatientDocuments/index.tsx:25 msgid "Create document" msgstr "" -#: src/components/ModalNewEncounter/index.tsx:23 +#: src/components/ModalNewEncounter/index.tsx:47 msgid "Create Encounter" msgstr "" @@ -226,33 +226,34 @@ msgstr "" msgid "Create practitioner" msgstr "" -#: src/containers/PatientDetails/DocumentHistory/index.tsx:54 +#: src/containers/PatientDetails/DocumentHistory/index.tsx:55 msgid "Created" msgstr "" -#: src/containers/DocumentsList/index.tsx:56 +#: src/containers/DocumentsList/index.tsx:57 msgid "Creation date" msgstr "" #: src/components/PatientEncounter/index.tsx:37 #: src/containers/EncounterList/index.tsx:64 -#: src/containers/PatientDetails/PatientOverview/utils.tsx:88 -#: src/containers/PatientDetails/PatientOverview/utils.tsx:126 -#: src/containers/PatientDetails/PatientOverview/utils.tsx:163 -#: src/containers/PatientDetails/PatientOverview/utils.tsx:233 -#: src/containers/PatientDetails/PatientOverview/utils.tsx:299 -#: src/containers/PatientDetails/PatientResources/utils.tsx:95 -#: src/containers/PatientDetails/PatientResources/utils.tsx:132 -#: src/containers/PatientDetails/PatientResources/utils.tsx:171 -#: src/containers/PatientDetails/PatientResources/utils.tsx:208 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:89 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:127 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:164 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:234 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:300 +#: src/containers/PatientDetails/PatientResources/utils.tsx:97 +#: src/containers/PatientDetails/PatientResources/utils.tsx:134 +#: src/containers/PatientDetails/PatientResources/utils.tsx:173 +#: src/containers/PatientDetails/PatientResources/utils.tsx:210 +#: src/containers/PatientDetails/PatientResources/utils.tsx:251 msgid "Date" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:53 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:55 msgid "Date & time slot" msgstr "" -#: src/containers/Scheduling/ScheduleCalendar/index.tsx:71 +#: src/containers/Scheduling/ScheduleCalendar/index.tsx:72 msgid "Day" msgstr "" @@ -260,11 +261,11 @@ msgstr "" msgid "days" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:52 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:54 msgid "Default" msgstr "" -#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:171 +#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:174 #: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/index.tsx:139 msgid "Delete" msgstr "" @@ -277,15 +278,15 @@ msgstr "" msgid "Describe requirements to a questionnaire" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:473 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:475 msgid "Description:" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:499 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:501 msgid "Display" msgstr "" -#: src/containers/EncounterQR/index.tsx:94 +#: src/containers/EncounterQR/index.tsx:95 msgid "Document is saved" msgstr "" @@ -298,16 +299,16 @@ msgstr "" msgid "Documents" msgstr "" -#: src/containers/PatientDetails/PatientOverview/utils.tsx:268 -#: src/containers/PatientDetails/PatientResources/utils.tsx:51 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:269 +#: src/containers/PatientDetails/PatientResources/utils.tsx:53 msgid "Dosage" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:77 +#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:78 msgid "Draft" msgstr "" -#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:50 +#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:53 msgid "Draft successfully deleted" msgstr "" @@ -315,15 +316,15 @@ msgstr "" #~ msgid "Drag items into the field" #~ msgstr "" -#: src/containers/PatientDetails/PatientWearables/index.tsx:27 +#: src/containers/PatientDetails/PatientWearables/index.tsx:28 msgid "Duration (min)" msgstr "" -#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:179 +#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:182 #: src/containers/PatientDetails/PatientOverview/index.tsx:135 #: src/containers/PatientList/index.tsx:117 -#: src/containers/PractitionerDetails/PractitionerOverview/index.tsx:59 -#: src/containers/Scheduling/ScheduleCalendar/components/AppointmentDetailsModal/index.tsx:82 +#: src/containers/PractitionerDetails/PractitionerOverview/index.tsx:60 +#: src/containers/Scheduling/ScheduleCalendar/components/AppointmentDetailsModal/index.tsx:83 msgid "Edit" msgstr "" @@ -340,26 +341,26 @@ msgstr "" msgid "Edit patient" msgstr "" -#: src/containers/PractitionerDetails/PractitionerOverview/index.tsx:56 +#: src/containers/PractitionerDetails/PractitionerOverview/index.tsx:57 msgid "Edit practitioner data" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:64 +#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:65 msgid "Encounter" msgstr "" -#: src/containers/EncounterDetails/index.tsx:86 +#: src/containers/EncounterDetails/index.tsx:87 msgid "Encounter completed" msgstr "" #: src/components/BaseLayout/Sidebar/SidebarTop/index.tsx:36 #: src/components/PatientEncounter/index.tsx:73 -#: src/containers/EncounterList/index.tsx:103 +#: src/containers/EncounterList/index.tsx:105 #: src/containers/PatientDetails/PatientContentHeader/index.tsx:21 msgid "Encounters" msgstr "" -#: src/containers/PatientDetails/PatientWearables/index.tsx:39 +#: src/containers/PatientDetails/PatientWearables/index.tsx:40 msgid "End" msgstr "" @@ -367,7 +368,7 @@ msgstr "" msgid "End date" msgstr "" -#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:56 +#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:59 msgid "Error deleting a draft" msgstr "" @@ -404,31 +405,31 @@ msgstr "" #~ msgstr "" #: src/containers/PatientDetails/PatientOverview/index.tsx:102 -#: src/containers/PractitionerDetails/PractitionerOverview/index.tsx:53 +#: src/containers/PractitionerDetails/PractitionerOverview/index.tsx:54 msgid "General Information" msgstr "" -#: src/containers/Scheduling/ScheduleCalendar/components/AppointmentDetailsModal/index.tsx:69 +#: src/containers/Scheduling/ScheduleCalendar/components/AppointmentDetailsModal/index.tsx:70 msgid "Go to the encounter" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:133 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:135 msgid "Help text" msgstr "" -#: src/containers/QuestionnaireBuilder/Builder/index.tsx:122 +#: src/containers/QuestionnaireBuilder/Builder/index.tsx:123 msgid "Here will be your questionnaire" msgstr "" -#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:157 +#: src/containers/PatientDetails/PatientDocumentDetails/index.tsx:160 msgid "History" msgstr "" -#: src/containers/PatientDetails/DocumentHistory/index.tsx:29 +#: src/containers/PatientDetails/DocumentHistory/index.tsx:30 msgid "History of changes" msgstr "" -#: src/containers/PatientDetails/PatientOverview/utils.tsx:214 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:215 msgid "Immunization" msgstr "" @@ -444,11 +445,11 @@ msgstr "" msgid "Infant" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:32 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:34 msgid "Inline choice" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:242 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:244 msgid "Inline options?" msgstr "" @@ -480,7 +481,7 @@ msgstr "" msgid "Logout" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:92 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:94 msgid "Macro text" msgstr "" @@ -506,16 +507,16 @@ msgstr "" #~ msgid "msg.QuestionnaireNamePlaceholder" #~ msgstr "Name" -#: src/containers/PatientDetails/PatientOverview/utils.tsx:77 -#: src/containers/PatientDetails/PatientOverview/utils.tsx:115 -#: src/containers/PatientDetails/PatientOverview/utils.tsx:151 -#: src/containers/PatientDetails/PatientOverview/utils.tsx:222 -#: src/containers/PatientDetails/PatientOverview/utils.tsx:257 -#: src/containers/PatientDetails/PatientResources/utils.tsx:40 -#: src/containers/PatientDetails/PatientResources/utils.tsx:84 -#: src/containers/PatientDetails/PatientResources/utils.tsx:121 -#: src/containers/PatientDetails/PatientResources/utils.tsx:160 -#: src/containers/PatientDetails/PatientResources/utils.tsx:196 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:78 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:116 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:152 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:223 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:258 +#: src/containers/PatientDetails/PatientResources/utils.tsx:42 +#: src/containers/PatientDetails/PatientResources/utils.tsx:86 +#: src/containers/PatientDetails/PatientResources/utils.tsx:123 +#: src/containers/PatientDetails/PatientResources/utils.tsx:162 +#: src/containers/PatientDetails/PatientResources/utils.tsx:198 #: src/containers/PatientList/index.tsx:70 #: src/containers/PractitionerList/index.tsx:90 msgid "Name" @@ -530,12 +531,16 @@ msgstr "Name" #~ msgid "NCAT, PERRL, normal conjunctivae, nonicteric sclerae, bilateral EAC/TM clear, no nasal discharge, OP clear, moist mucous membranes" #~ msgstr "" +#: src/utils/questionnaire.ts:47 +msgid "No" +msgstr "" + #: src/components/EncountersTable/index.tsx:30 -#: src/containers/PatientDetails/PatientResources/ResourceTable.tsx:59 -#: src/containers/PatientDetails/PatientWearables/index.tsx:65 +#: src/containers/PatientDetails/PatientResources/ResourceTable.tsx:61 +#: src/containers/PatientDetails/PatientWearables/index.tsx:66 #: src/containers/PatientList/index.tsx:62 #: src/containers/PractitionerList/index.tsx:83 -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:491 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:493 #: src/containers/QuestionnaireList/index.tsx:102 msgid "No data" msgstr "" @@ -572,7 +577,7 @@ msgstr "" msgid "NotChild" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:44 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:46 msgid "Number (default)" msgstr "" @@ -580,7 +585,7 @@ msgstr "" #~ msgid "On the next page, please, use the following credentials" #~ msgstr "" -#: src/containers/DocumentsList/index.tsx:79 +#: src/containers/DocumentsList/index.tsx:80 #: src/containers/EncounterList/index.tsx:82 #: src/containers/PatientList/index.tsx:109 #: src/containers/PractitionerList/index.tsx:118 @@ -588,14 +593,14 @@ msgstr "" msgid "Open" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:159 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:161 msgid "Option {0}" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:179 -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:187 -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:206 -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:226 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:181 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:189 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:208 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:228 msgid "Option {index}" msgstr "" @@ -613,7 +618,7 @@ msgstr "" #~ msgstr "" #: src/containers/EncounterList/index.tsx:46 -#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:65 +#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:66 msgid "Patient" msgstr "" @@ -622,7 +627,7 @@ msgstr "" msgid "Patient saved" msgstr "" -#: src/components/ModalNewPatient/index.tsx:31 +#: src/components/ModalNewPatient/index.tsx:66 msgid "Patient successfully created" msgstr "" @@ -640,7 +645,7 @@ msgstr "" #~ msgid "Phone number" #~ msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:37 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:39 msgid "Phone widget" msgstr "" @@ -650,9 +655,9 @@ msgstr "" #: src/components/PatientEncounter/index.tsx:23 #: src/containers/EncounterList/index.tsx:52 -#: src/containers/PatientDetails/PatientOverview/utils.tsx:171 -#: src/containers/PatientDetails/PatientOverview/utils.tsx:291 -#: src/containers/PatientDetails/PatientResources/utils.tsx:216 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:172 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:292 +#: src/containers/PatientDetails/PatientResources/utils.tsx:218 msgid "Practitioner" msgstr "" @@ -674,11 +679,11 @@ msgstr "" #~ msgid "Pulses intact with normal cap refill, no LE pitting edema or calf tenderness" #~ msgstr "" -#: src/containers/PatientQuestionnaire/index.tsx:80 +#: src/containers/PatientQuestionnaire/index.tsx:81 msgid "Questionnaire" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:46 +#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:47 msgid "Questionnaire properties" msgstr "" @@ -687,7 +692,7 @@ msgstr "" #~ msgstr "" #: src/components/BaseLayout/Sidebar/SidebarTop/index.tsx:39 -#: src/containers/DocumentsList/index.tsx:44 +#: src/containers/DocumentsList/index.tsx:45 #: src/containers/QuestionnaireList/index.tsx:80 msgid "Questionnaires" msgstr "" @@ -696,7 +701,7 @@ msgstr "" msgid "Repeats" msgstr "" -#: src/components/ModalNewEncounter/index.tsx:24 +#: src/components/ModalNewEncounter/index.tsx:48 msgid "Request Appointment" msgstr "" @@ -716,7 +721,7 @@ msgstr "" msgid "Resources" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:59 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:61 msgid "Row" msgstr "" @@ -725,8 +730,8 @@ msgstr "" #~ msgstr "" #: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/index.tsx:129 -#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:86 -#: src/containers/Scheduling/Availability/index.tsx:73 +#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:87 +#: src/containers/Scheduling/Availability/index.tsx:74 msgid "Save" msgstr "" @@ -735,7 +740,7 @@ msgstr "" msgid "Save questionnaire" msgstr "" -#: src/containers/Scheduling/ScheduleCalendar/index.tsx:44 +#: src/containers/Scheduling/ScheduleCalendar/index.tsx:45 msgid "Schedule calendar" msgstr "" @@ -764,11 +769,11 @@ msgstr "" msgid "See all medications" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:424 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:426 msgid "See ValueSet details" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:31 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:33 msgid "Select (default)" msgstr "" @@ -776,7 +781,7 @@ msgstr "" #~ msgid "Send" #~ msgstr "" -#: src/containers/PatientDetails/PatientOverview/utils.tsx:295 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:296 msgid "Service" msgstr "" @@ -788,11 +793,11 @@ msgstr "" #~ msgid "Sex" #~ msgstr "" -#: src/containers/DocumentsList/ChooseDocumentToCreateModal/index.tsx:68 +#: src/containers/DocumentsList/ChooseDocumentToCreateModal/index.tsx:69 msgid "Share link" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:45 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:47 msgid "Slider" msgstr "" @@ -804,7 +809,7 @@ msgstr "" #~ msgid "Soft and non-tender with no guarding or rebound; +BS normoactive, no tympany on auscultation" #~ msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:33 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:35 msgid "Solid radio button" msgstr "" @@ -820,7 +825,7 @@ msgstr "" msgid "SSN" msgstr "" -#: src/containers/PatientDetails/PatientWearables/index.tsx:33 +#: src/containers/PatientDetails/PatientWearables/index.tsx:34 msgid "Start" msgstr "" @@ -829,35 +834,35 @@ msgid "Start date" msgstr "" #: src/containers/PatientDetails/PatientOverview/index.tsx:209 -#: src/containers/Scheduling/ScheduleCalendar/components/AppointmentDetailsModal/index.tsx:93 +#: src/containers/Scheduling/ScheduleCalendar/components/AppointmentDetailsModal/index.tsx:94 msgid "Start the encounter" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:105 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:107 msgid "Start value" msgstr "" #: src/components/PatientEncounter/index.tsx:29 -#: src/containers/DocumentsList/index.tsx:63 +#: src/containers/DocumentsList/index.tsx:64 #: src/containers/EncounterList/index.tsx:58 -#: src/containers/PatientDetails/PatientResources/utils.tsx:57 -#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:73 +#: src/containers/PatientDetails/PatientResources/utils.tsx:59 +#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:74 msgid "Status" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:119 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:121 msgid "Step" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:126 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:128 msgid "Stop label" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:112 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:114 msgid "Stop value" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:58 +#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:59 msgid "Subject Type" msgstr "" @@ -869,7 +874,7 @@ msgstr "" #~ msgid "Supple, normal ROM, no lymphadenopathy/masses, nontender" #~ msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:250 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:252 msgid "System" msgstr "" @@ -877,12 +882,12 @@ msgstr "" msgid "Text" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:36 -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:40 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:38 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:42 msgid "Text (default)" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:41 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:43 msgid "Text with macro" msgstr "" @@ -890,40 +895,47 @@ msgstr "" #~ msgid "The chest wall is symmetric, without deformity, and is atraumatic in appearance" #~ msgstr "" -#: src/containers/DocumentsList/ChooseDocumentToCreateModal/index.tsx:63 +#: src/containers/DocumentsList/ChooseDocumentToCreateModal/index.tsx:64 msgid "The link was copied to clipboard" msgstr "" -#: src/containers/QuestionnaireBuilder/Builder/index.tsx:49 +#: src/containers/QuestionnaireBuilder/Builder/index.tsx:50 msgid "The process of generating or updating a questionnaire may require some time to complete" msgstr "" -#: src/containers/DocumentsList/index.tsx:107 +#: src/containers/DocumentsList/index.tsx:108 msgid "There are no documents yet" msgstr "" -#: src/containers/PatientDetails/PatientOverview/utils.tsx:303 -#: src/containers/Scheduling/Availability/index.tsx:136 +#: src/containers/PatientDetails/PatientOverview/utils.tsx:304 +#: src/containers/Scheduling/Availability/index.tsx:137 msgid "Time" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:50 +#: src/containers/PatientDetails/PatientResources/utils.tsx:243 +#: src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx:51 msgid "Title" msgstr "" -#: src/containers/Scheduling/ScheduleCalendar/index.tsx:69 +#: src/containers/Scheduling/ScheduleCalendar/index.tsx:70 msgid "Today" msgstr "" +#: src/containers/DocumentsList/hooks.ts:35 +#: src/containers/DocumentsList/hooks.ts:45 +#: src/containers/PatientDetails/PatientDocumentDetails/ExternalDocumentView/index.tsx:55 +msgid "Unknown" +msgstr "" + #: src/containers/PatientDetails/PatientOverview/index.tsx:41 msgid "Upcoming appointment" msgstr "" -#: src/containers/PatientDetails/DocumentHistory/index.tsx:55 +#: src/containers/PatientDetails/DocumentHistory/index.tsx:56 msgid "Updated" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:478 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:480 msgid "Url:" msgstr "" @@ -931,28 +943,32 @@ msgstr "" #~ msgid "Username" #~ msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:422 +#: src/containers/PatientDetails/PatientResources/utils.tsx:259 +msgid "Value" +msgstr "" + +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:424 msgid "ValueSet details" msgstr "" -#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:396 +#: src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx:398 msgid "ValueSet url" msgstr "" #: src/containers/EncounterList/index.tsx:91 -msgid "Video call" -msgstr "" +#~ msgid "Video call" +#~ msgstr "" #: web/src/containers/PatientDetails/PatientDocument/PhysicalExam/index.tsx:37 #~ msgid "Warm, dry, and intact. No rashes, dermatoses, petechiae, or lesions" #~ msgstr "" #: src/containers/PatientDetails/PatientContentHeader/index.tsx:23 -#: src/containers/PatientDetails/PatientWearables/index.tsx:55 +#: src/containers/PatientDetails/PatientWearables/index.tsx:56 msgid "Wearables" msgstr "" -#: src/containers/Scheduling/ScheduleCalendar/index.tsx:70 +#: src/containers/Scheduling/ScheduleCalendar/index.tsx:71 msgid "Week" msgstr "" @@ -968,6 +984,10 @@ msgstr "" #~ msgid "Well nourished, well developed, awake and alert, resting comfortably in no acute distress, cooperative on exam" #~ msgstr "" +#: src/utils/questionnaire.ts:47 +msgid "Yes" +msgstr "" + #: shared/src/utils/date.ts:108 msgid "yr" msgstr "" diff --git a/shared/src/utils/converter/fhirToFce/questionnaire/index.ts b/shared/src/utils/converter/fhirToFce/questionnaire/index.ts index 140dc027..6b2a2745 100644 --- a/shared/src/utils/converter/fhirToFce/questionnaire/index.ts +++ b/shared/src/utils/converter/fhirToFce/questionnaire/index.ts @@ -3,13 +3,13 @@ import cloneDeep from 'lodash/cloneDeep'; import { Questionnaire as FCEQuestionnaire } from 'shared/src/contrib/aidbox'; -import { checkFhirQuestionnaireProfile, trimUndefined } from '../utils'; import { processExtensions } from './processExtensions'; import { processItems } from './processItems'; import { processMeta } from './processMeta'; +import { trimUndefined } from '../utils'; export function convertQuestionnaire(fhirQuestionnaire: FHIRQuestionnaire): FCEQuestionnaire { - checkFhirQuestionnaireProfile(fhirQuestionnaire); + // checkFhirQuestionnaireProfile(fhirQuestionnaire); fhirQuestionnaire = cloneDeep(fhirQuestionnaire); const meta = processMeta(fhirQuestionnaire); const item = processItems(fhirQuestionnaire); diff --git a/shared/src/utils/converter/fhirToFce/questionnaire/processItems.ts b/shared/src/utils/converter/fhirToFce/questionnaire/processItems.ts index c358ac12..ed458698 100644 --- a/shared/src/utils/converter/fhirToFce/questionnaire/processItems.ts +++ b/shared/src/utils/converter/fhirToFce/questionnaire/processItems.ts @@ -63,7 +63,7 @@ function processEnableWhenItem(item: FHIRQuestionnaireItemEnableWhen): FCEQuesti } function processEnableWhenAnswerOption(item: FHIRQuestionnaireItemEnableWhen) { - let answer: FCEQuestionnaireItemEnableWhenAnswer = {}; + const answer: FCEQuestionnaireItemEnableWhenAnswer = {}; switch (true) { case 'answerBoolean' in item: diff --git a/shared/src/utils/converter/fhirToFce/utils.ts b/shared/src/utils/converter/fhirToFce/utils.ts index e8896dec..f248ded6 100644 --- a/shared/src/utils/converter/fhirToFce/utils.ts +++ b/shared/src/utils/converter/fhirToFce/utils.ts @@ -3,8 +3,8 @@ import { Questionnaire as FHIRQuestionnaire } from 'fhir/r4b'; export function checkFhirQuestionnaireProfile(fhirQuestionnaire: FHIRQuestionnaire): void { if ( !( - (fhirQuestionnaire.meta?.profile?.length ?? 0) === 1 && - fhirQuestionnaire.meta?.profile?.[0] === 'https://beda.software/beda-emr-questionnaire' + (fhirQuestionnaire.meta?.profile?.length ?? 0) === 1 + && fhirQuestionnaire.meta?.profile?.[0] === 'https://beda.software/beda-emr-questionnaire' ) ) { throw new Error('Only beda emr questionanire supported'); diff --git a/src/__tests__/fce.integration.test.ts b/src/__tests__/fce.integration.test.ts index 72b1dfb2..14492eab 100644 --- a/src/__tests__/fce.integration.test.ts +++ b/src/__tests__/fce.integration.test.ts @@ -1,12 +1,13 @@ import { readdirSync } from 'fs'; import { parse as parsePath } from 'path'; -import { getFHIRResource } from 'fhir-react/lib/services/fhir'; import { Questionnaire as FHIRQuestionnaire } from 'fhir/r4b'; import { getFHIRResource as getFCEResource } from 'aidbox-react/lib/services/fhir'; import { ensure } from 'aidbox-react/lib/utils/tests'; +import { getFHIRResource } from 'fhir-react/lib/services/fhir'; + import { Questionnaire as FCEQuestionnaire } from 'shared/src/contrib/aidbox'; import { toFirstClassExtension, fromFirstClassExtension } from 'shared/src/utils/converter'; import { sortExtensionsList } from 'shared/src/utils/converter/__tests__/fce.test'; diff --git a/src/__tests__/validate-resources.test.ts b/src/__tests__/validate-resources.test.ts index d62ccd26..1e57faf5 100644 --- a/src/__tests__/validate-resources.test.ts +++ b/src/__tests__/validate-resources.test.ts @@ -1,10 +1,11 @@ import { readdirSync } from 'fs'; import { parse as parsePath } from 'path'; +import { OperationOutcome, Questionnaire } from 'fhir/r4b'; + import { getFHIRResource } from 'fhir-react/lib/services/fhir'; import { service } from 'fhir-react/lib/services/service'; import { ensure } from 'fhir-react/lib/utils/tests'; -import { OperationOutcome, Questionnaire } from 'fhir/r4b'; import { loginAdminUser } from 'src/setupTests'; diff --git a/src/__tests__/zen.test.ts b/src/__tests__/zen.test.ts index d14aadeb..b622b5c8 100644 --- a/src/__tests__/zen.test.ts +++ b/src/__tests__/zen.test.ts @@ -1,5 +1,4 @@ -import { service } from 'aidbox-react/lib/services/service'; -import { mapSuccess } from 'aidbox-react/lib/services/service'; +import { service , mapSuccess } from 'aidbox-react/lib/services/service'; import { ensure } from 'aidbox-react/lib/utils/tests'; import { loginAdminUser } from 'src/setupTests'; diff --git a/src/components/BaseLayout/BaseLayout.module.scss b/src/components/BaseLayout/BaseLayout.module.scss index 532c08b9..8e9d50ac 100644 --- a/src/components/BaseLayout/BaseLayout.module.scss +++ b/src/components/BaseLayout/BaseLayout.module.scss @@ -21,7 +21,7 @@ right: 0; left: 248px; height: 64px; - z-index: 2; + z-index: 3; transition: left 0.2s; &Collapsed { diff --git a/src/components/BaseQuestionnaireResponseForm/controls.tsx b/src/components/BaseQuestionnaireResponseForm/controls.tsx index 2a3ac084..1f0b60b6 100644 --- a/src/components/BaseQuestionnaireResponseForm/controls.tsx +++ b/src/components/BaseQuestionnaireResponseForm/controls.tsx @@ -5,7 +5,6 @@ import { QuestionItemComponentMapping, } from 'sdc-qrf/lib/types'; -import { TextWithMacroFill } from '../TextWithMacroFill'; import { Col, Group, @@ -26,6 +25,7 @@ import { } from './widgets'; import { Display } from './widgets/display'; import { QuestionReference } from './widgets/reference'; +import { TextWithMacroFill } from '../TextWithMacroFill'; export const itemComponents: QuestionItemComponentMapping = { text: QuestionText, diff --git a/src/components/BaseQuestionnaireResponseForm/hooks.ts b/src/components/BaseQuestionnaireResponseForm/hooks.ts index 00279541..c09b6660 100644 --- a/src/components/BaseQuestionnaireResponseForm/hooks.ts +++ b/src/components/BaseQuestionnaireResponseForm/hooks.ts @@ -27,7 +27,7 @@ export function useFieldController(fieldName: any, questionItem: QuestionnaireIt const onMultiChange = useCallback( (option: any) => { if (repeats) { - let arrayValue = (field.value ?? []) as any[]; + const arrayValue = (field.value ?? []) as any[]; const valueIndex = arrayValue.findIndex((v) => _.isEqual(v?.value, option.value)); if (valueIndex === -1) { diff --git a/src/components/BaseQuestionnaireResponseForm/index.tsx b/src/components/BaseQuestionnaireResponseForm/index.tsx index 9e18e3cc..c87623bb 100644 --- a/src/components/BaseQuestionnaireResponseForm/index.tsx +++ b/src/components/BaseQuestionnaireResponseForm/index.tsx @@ -2,7 +2,6 @@ import { yupResolver } from '@hookform/resolvers/yup'; import { Trans } from '@lingui/macro'; import { Button } from 'antd'; import classNames from 'classnames'; -import { isSuccess, loading, RemoteData } from 'fhir-react/lib/libs/remoteData'; import { QuestionnaireResponse } from 'fhir/r4b'; import _ from 'lodash'; import React, { ComponentType, useCallback, useEffect, useMemo, useRef, useState } from 'react'; @@ -23,6 +22,8 @@ import { } from 'sdc-qrf'; import * as yup from 'yup'; +import { isSuccess, loading, RemoteData } from 'fhir-react/lib/libs/remoteData'; + import 'react-phone-input-2/lib/style.css'; import { saveQuestionnaireResponseDraft } from 'src/components/QuestionnaireResponseForm'; diff --git a/src/components/BaseQuestionnaireResponseForm/readonly-widgets/TimeRangePickerControl.tsx b/src/components/BaseQuestionnaireResponseForm/readonly-widgets/TimeRangePickerControl.tsx index 952607a3..8ad2c852 100644 --- a/src/components/BaseQuestionnaireResponseForm/readonly-widgets/TimeRangePickerControl.tsx +++ b/src/components/BaseQuestionnaireResponseForm/readonly-widgets/TimeRangePickerControl.tsx @@ -4,8 +4,8 @@ import { GroupItemProps } from 'sdc-qrf'; import { getDisplay } from 'src/utils/questionnaire'; -import { useTimeRangePickerControl } from '../widgets/TimeRangePickerControl/hooks'; import s from './ReadonlyWidgets.module.scss'; +import { useTimeRangePickerControl } from '../widgets/TimeRangePickerControl/hooks'; export function TimeRangePickerControl(props: GroupItemProps) { const { questionItem } = props; diff --git a/src/components/BaseQuestionnaireResponseForm/readonly-widgets/reference.tsx b/src/components/BaseQuestionnaireResponseForm/readonly-widgets/reference.tsx index fcc87f47..f101aba2 100644 --- a/src/components/BaseQuestionnaireResponseForm/readonly-widgets/reference.tsx +++ b/src/components/BaseQuestionnaireResponseForm/readonly-widgets/reference.tsx @@ -4,8 +4,8 @@ import { Resource } from 'shared/src/contrib/aidbox'; import { getArrayDisplay, getDisplay } from 'src/utils/questionnaire'; -import { AnswerReferenceProps, useAnswerReference } from '../widgets/reference'; import s from './ReadonlyWidgets.module.scss'; +import { AnswerReferenceProps, useAnswerReference } from '../widgets/reference'; function QuestionReferenceUnsafe( props: AnswerReferenceProps, diff --git a/src/components/BaseQuestionnaireResponseForm/widgets/BloodPressure/index.tsx b/src/components/BaseQuestionnaireResponseForm/widgets/BloodPressure/index.tsx index 01540528..35e28966 100644 --- a/src/components/BaseQuestionnaireResponseForm/widgets/BloodPressure/index.tsx +++ b/src/components/BaseQuestionnaireResponseForm/widgets/BloodPressure/index.tsx @@ -2,8 +2,7 @@ import { Form, InputNumber, InputNumberProps } from 'antd'; import Title from 'antd/lib/typography/Title'; import { GroupItemProps } from 'sdc-qrf'; -import { Coding } from 'shared/src/contrib/aidbox'; -import { QuestionnaireItem } from 'shared/src/contrib/aidbox'; +import { Coding , QuestionnaireItem } from 'shared/src/contrib/aidbox'; import { useFieldController } from 'src/components/BaseQuestionnaireResponseForm/hooks'; diff --git a/src/components/BaseQuestionnaireResponseForm/widgets/DateTimeSlotPicker/index.tsx b/src/components/BaseQuestionnaireResponseForm/widgets/DateTimeSlotPicker/index.tsx index 58095cba..4402f82a 100644 --- a/src/components/BaseQuestionnaireResponseForm/widgets/DateTimeSlotPicker/index.tsx +++ b/src/components/BaseQuestionnaireResponseForm/widgets/DateTimeSlotPicker/index.tsx @@ -1,9 +1,4 @@ import { Form } from 'antd'; -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; -import { useService } from 'fhir-react/lib/hooks/service'; -import { extractBundleResources, getAllFHIRResources, getFHIRResource } from 'fhir-react/lib/services/fhir'; -import { mapSuccess, resolveMap } from 'fhir-react/lib/services/service'; -import { formatFHIRDate, formatFHIRDateTime, parseFHIRDateTime } from 'fhir-react/lib/utils/date'; import { Reference, Appointment, PractitionerRole } from 'fhir/r4b'; import _ from 'lodash'; import moment from 'moment'; @@ -11,14 +6,20 @@ import { useEffect, useState } from 'react'; import { useFormContext } from 'react-hook-form'; import { QuestionItemProps } from 'sdc-qrf'; +import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; +import { useService } from 'fhir-react/lib/hooks/service'; +import { extractBundleResources, getAllFHIRResources, getFHIRResource } from 'fhir-react/lib/services/fhir'; +import { mapSuccess, resolveMap } from 'fhir-react/lib/services/service'; +import { formatFHIRDate, formatFHIRDateTime, parseFHIRDateTime } from 'fhir-react/lib/utils/date'; + import { humanDateTime } from 'shared/src/utils/date'; import { DatePicker } from 'src/components/DatePicker'; import { Spinner } from 'src/components/Spinner'; import { useCalendarOptions } from 'src/containers/Scheduling/ScheduleCalendar/hooks/useCalendarOptions'; -import { useFieldController } from '../../hooks'; import { getTimeSlots } from './utils'; +import { useFieldController } from '../../hooks'; interface AvailableDatePickerProps extends QuestionItemProps { practitionerRolePath: Array; @@ -154,7 +155,7 @@ function AvailableDateControl(props: AvailableDatePickerProps & { practitionerRo showNow={false} showToday={false} format={humanDateTime} - minuteStep={5 as 5} + minuteStep={5 as const} onChange={(date) => onDateChange( date, timeSlots as TimeSlots, diff --git a/src/components/BaseQuestionnaireResponseForm/widgets/DateTimeSlotPicker/utils.ts b/src/components/BaseQuestionnaireResponseForm/widgets/DateTimeSlotPicker/utils.ts index 5d1623cd..38b2655b 100644 --- a/src/components/BaseQuestionnaireResponseForm/widgets/DateTimeSlotPicker/utils.ts +++ b/src/components/BaseQuestionnaireResponseForm/widgets/DateTimeSlotPicker/utils.ts @@ -1,4 +1,3 @@ -import { FHIRDateFormat, formatFHIRDateTime, parseFHIRDateTime } from 'fhir-react/lib/utils/date'; import { Appointment, PractitionerRole, @@ -7,6 +6,8 @@ import { import _ from 'lodash'; import moment from 'moment'; +import { FHIRDateFormat, formatFHIRDateTime, parseFHIRDateTime } from 'fhir-react/lib/utils/date'; + import { days } from 'src/containers/Scheduling/available-time'; function praseSlotDuration(slotDuration: string) { @@ -16,9 +17,9 @@ function praseSlotDuration(slotDuration: string) { } function getPeriodTimeSlots(start: moment.Moment, end: moment.Moment, slotDuration: string) { - let startTime = start; - let endTime = end; - let timeStops: string[] = []; + const startTime = start; + const endTime = end; + const timeStops: string[] = []; const { hours, minutes, seconds } = praseSlotDuration(slotDuration); while (startTime.isBefore(endTime)) { @@ -35,7 +36,7 @@ export function getAllTimeSlots( ) { // TODO: use number of weeks from settings or limited to maxDate const weeks = [0, 1, 2]; - let timeSlots: string[][] = []; + const timeSlots: string[][] = []; availableTime.forEach((availableTime) => { const { daysOfWeek, availableStartTime, availableEndTime } = availableTime; diff --git a/src/components/BaseQuestionnaireResponseForm/widgets/TimeRangePickerControl/__tests__/TimeRangePickerControl.test.ts b/src/components/BaseQuestionnaireResponseForm/widgets/TimeRangePickerControl/__tests__/TimeRangePickerControl.test.ts index 4ba6c6cb..06214a53 100644 --- a/src/components/BaseQuestionnaireResponseForm/widgets/TimeRangePickerControl/__tests__/TimeRangePickerControl.test.ts +++ b/src/components/BaseQuestionnaireResponseForm/widgets/TimeRangePickerControl/__tests__/TimeRangePickerControl.test.ts @@ -1,8 +1,9 @@ import { act, renderHook } from '@testing-library/react'; -import { FHIRTimeFormat } from 'fhir-react/lib/utils/date'; import moment from 'moment'; import { GroupItemProps } from 'sdc-qrf'; +import { FHIRTimeFormat } from 'fhir-react/lib/utils/date'; + import { useTimeRangePickerControl } from '../hooks'; const mockControllerFieldOnChange = jest.fn(); diff --git a/src/components/BaseQuestionnaireResponseForm/widgets/TimeRangePickerControl/hooks.ts b/src/components/BaseQuestionnaireResponseForm/widgets/TimeRangePickerControl/hooks.ts index d490a22d..b74e310f 100644 --- a/src/components/BaseQuestionnaireResponseForm/widgets/TimeRangePickerControl/hooks.ts +++ b/src/components/BaseQuestionnaireResponseForm/widgets/TimeRangePickerControl/hooks.ts @@ -1,7 +1,8 @@ -import { FHIRTimeFormat } from 'fhir-react/lib/utils/date'; import { useCallback } from 'react'; import { GroupItemProps } from 'sdc-qrf'; +import { FHIRTimeFormat } from 'fhir-react/lib/utils/date'; + import { useFieldController } from 'src/components/BaseQuestionnaireResponseForm/hooks'; import { RangeValue } from 'src/components/TimePicker/types'; diff --git a/src/components/BaseQuestionnaireResponseForm/widgets/choice.tsx b/src/components/BaseQuestionnaireResponseForm/widgets/choice.tsx index da05136d..f13c257c 100644 --- a/src/components/BaseQuestionnaireResponseForm/widgets/choice.tsx +++ b/src/components/BaseQuestionnaireResponseForm/widgets/choice.tsx @@ -1,7 +1,6 @@ import { Form } from 'antd'; import { mapSuccess } from 'fhir-react'; -import { debounce } from 'lodash'; -import _ from 'lodash'; +import _, { debounce } from 'lodash'; import { useCallback } from 'react'; import Select from 'react-select'; import AsyncSelect from 'react-select/async'; diff --git a/src/components/BaseQuestionnaireResponseForm/widgets/reference.tsx b/src/components/BaseQuestionnaireResponseForm/widgets/reference.tsx index 97ab46b3..8072cc72 100644 --- a/src/components/BaseQuestionnaireResponseForm/widgets/reference.tsx +++ b/src/components/BaseQuestionnaireResponseForm/widgets/reference.tsx @@ -1,13 +1,14 @@ import { Form } from 'antd'; -import { isSuccess } from 'fhir-react/lib/libs/remoteData'; -import { ResourcesMap } from 'fhir-react/lib/services/fhir'; -import { buildQueryParams } from 'fhir-react/lib/services/instance'; import fhirpath from 'fhirpath'; import _ from 'lodash'; import { ActionMeta, MultiValue, SingleValue } from 'react-select'; import AsyncSelect from 'react-select/async'; import { parseFhirQueryExpression, QuestionItemProps } from 'sdc-qrf'; +import { isSuccess } from 'fhir-react/lib/libs/remoteData'; +import { ResourcesMap } from 'fhir-react/lib/services/fhir'; +import { buildQueryParams } from 'fhir-react/lib/services/instance'; + import { QuestionnaireItemAnswerOption, QuestionnaireResponseItemAnswer, Resource } from 'shared/src/contrib/aidbox'; import { loadResourceOptions } from 'shared/src/services/questionnaire'; import { getAnswerCode, getAnswerDisplay } from 'shared/src/utils/questionnaire'; diff --git a/src/components/ModalNewEncounter/index.tsx b/src/components/ModalNewEncounter/index.tsx index 67024e75..987a73c7 100644 --- a/src/components/ModalNewEncounter/index.tsx +++ b/src/components/ModalNewEncounter/index.tsx @@ -1,7 +1,7 @@ import { PlusOutlined } from '@ant-design/icons'; import { t } from '@lingui/macro'; import { Button, notification } from 'antd'; -import { Patient } from 'fhir/r4b'; +import { Patient, QuestionnaireResponse } from 'fhir/r4b'; import { useMemo, useState } from 'react'; import { questionnaireIdLoader } from 'shared/src/hooks/questionnaire-response-form-data'; @@ -15,6 +15,30 @@ export interface ModalNewEncounterProps { reloadEncounter: () => void; } +const initialResponse: Partial = { + "resourceType": "QuestionnaireResponse", + "id": "example-response", + "questionnaire": "Questionnaire/496552", + "status": "completed", + "item": [ + { + "linkId": "patientId" + }, + { + "linkId": "patientName" + }, + { + "linkId": "practitioner-role" + }, + { + "linkId": "service" + }, + { + "linkId": "date" + } + ] +}; + export const ModalNewEncounter = ({ patient, reloadEncounter }: ModalNewEncounterProps) => { const [isModalVisible, setIsModalVisible] = useState(false); const title = useMemo( @@ -52,10 +76,11 @@ export const ModalNewEncounter = ({ patient, reloadEncounter }: ModalNewEncounte maskClosable={false} > setIsModalVisible(false)} + initialQuestionnaireResponse={initialResponse} /> diff --git a/src/components/ModalNewPatient/__test__/create-patient.test.tsx b/src/components/ModalNewPatient/__test__/create-patient.test.tsx index 2b244554..69e62b1f 100644 --- a/src/components/ModalNewPatient/__test__/create-patient.test.tsx +++ b/src/components/ModalNewPatient/__test__/create-patient.test.tsx @@ -1,7 +1,8 @@ import { act, renderHook } from '@testing-library/react'; +import { Patient, Questionnaire } from 'fhir/r4b'; + import { getFHIRResource, getFHIRResources } from 'fhir-react/lib/services/fhir'; import { ensure } from 'fhir-react/lib/utils/tests'; -import { Patient, Questionnaire } from 'fhir/r4b'; import { questionnaireIdLoader, diff --git a/src/components/ModalNewPatient/index.tsx b/src/components/ModalNewPatient/index.tsx index 563e2d57..9a3d796d 100644 --- a/src/components/ModalNewPatient/index.tsx +++ b/src/components/ModalNewPatient/index.tsx @@ -1,6 +1,7 @@ import { PlusOutlined } from '@ant-design/icons'; import { t, Trans } from '@lingui/macro'; import { Button, notification } from 'antd'; +import { QuestionnaireResponse } from 'fhir/r4b'; import { questionnaireIdLoader } from 'shared/src/hooks/questionnaire-response-form-data'; @@ -11,6 +12,40 @@ interface ModalNewPatientProps { onCreate: () => void; triggerButtonStyle?: React.CSSProperties; } + +const initialResponse: Partial = { + "resourceType": "QuestionnaireResponse", + "id": "example-response", + "questionnaire": "Questionnaire/496511", + "status": "completed", + "item": [ + { + "linkId": "patient-id", + }, + { + "linkId": "last-name" + }, + { + "linkId": "first-name" + }, + { + "linkId": "middle-name" + }, + { + "linkId": "birth-date" + }, + { + "linkId": "gender" + }, + { + "linkId": "ssn" + }, + { + "linkId": "mobile" + } + ] +}; + export const ModalNewPatient = (props: ModalNewPatientProps) => { return ( { > {({ closeModal }) => ( { closeModal(); notification.success({ message: t`Patient successfully created` }); props.onCreate(); }} onCancel={closeModal} + // initialQuestionnaireResponse={initialResponse} /> )} diff --git a/src/components/QuestionnaireListWidget/hooks.ts b/src/components/QuestionnaireListWidget/hooks.ts index c0cec7f8..2b51858e 100644 --- a/src/components/QuestionnaireListWidget/hooks.ts +++ b/src/components/QuestionnaireListWidget/hooks.ts @@ -1,8 +1,9 @@ +import { Questionnaire } from 'fhir/r4b'; + import { useService } from 'fhir-react/lib/hooks/service'; import { extractBundleResources, getFHIRResources } from 'fhir-react/lib/services/fhir'; import { SearchParams } from 'fhir-react/lib/services/search'; import { mapSuccess } from 'fhir-react/lib/services/service'; -import { Questionnaire } from 'fhir/r4b'; export function useQuestionnaireList(searchParams: SearchParams) { const [questionnaireListRD] = useService(async () => { diff --git a/src/components/QuestionnaireResponseForm/index.tsx b/src/components/QuestionnaireResponseForm/index.tsx index d0ef0136..dd4dd160 100644 --- a/src/components/QuestionnaireResponseForm/index.tsx +++ b/src/components/QuestionnaireResponseForm/index.tsx @@ -1,8 +1,4 @@ import { notification } from 'antd'; -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; -import { isFailure, isSuccess, RemoteDataResult } from 'fhir-react/lib/libs/remoteData'; -import { saveFHIRResource, updateFHIRResource } from 'fhir-react/lib/services/fhir'; -import { formatError } from 'fhir-react/lib/utils/error'; import { QuestionnaireResponse } from 'fhir/r4b'; import _ from 'lodash'; import { useMemo } from 'react'; @@ -13,6 +9,11 @@ import { mapFormToResponse, } from 'sdc-qrf'; +import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; +import { isFailure, isSuccess, RemoteDataResult } from 'fhir-react/lib/libs/remoteData'; +import { saveFHIRResource, updateFHIRResource } from 'fhir-react/lib/services/fhir'; +import { formatError } from 'fhir-react/lib/utils/error'; + import { QuestionnaireResponseFormData, QuestionnaireResponseFormProps, @@ -107,8 +108,8 @@ export function useQuestionnaireResponseForm(props: Props) { const memoizedProps = useMemo(() => props, [JSON.stringify(props)]); const { response, handleSave } = useQuestionnaireResponseFormData(memoizedProps); - const { onSuccess, onFailure, readOnly, initialQuestionnaireResponse, onCancel } = memoizedProps; + const { onSuccess, onFailure, readOnly, initialQuestionnaireResponse, onCancel } = memoizedProps; const onSubmit = async (formData: QuestionnaireResponseFormData) => { const modifiedFormData = _.merge({}, formData, { diff --git a/src/components/SearchBar/SearchBarColumn/DateColumn/hooks.ts b/src/components/SearchBar/SearchBarColumn/DateColumn/hooks.ts index 7080229c..9d49eef0 100644 --- a/src/components/SearchBar/SearchBarColumn/DateColumn/hooks.ts +++ b/src/components/SearchBar/SearchBarColumn/DateColumn/hooks.ts @@ -3,8 +3,8 @@ import { useCallback } from 'react'; import { DateColumnFilterValue } from 'src/components/SearchBar/types'; -import { SearchBarColumnDateTypeProps } from '../types'; import { RangePickerOnChange } from './types'; +import { SearchBarColumnDateTypeProps } from '../types'; export function useDateColumn(props: SearchBarColumnDateTypeProps) { const { onChange, columnFilterValue } = props; diff --git a/src/components/SearchBar/SearchBarColumn/DateColumn/types.ts b/src/components/SearchBar/SearchBarColumn/DateColumn/types.ts index 8dcff229..c2e504b6 100644 --- a/src/components/SearchBar/SearchBarColumn/DateColumn/types.ts +++ b/src/components/SearchBar/SearchBarColumn/DateColumn/types.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; import { RangePickerProps } from 'antd/lib/date-picker/generatePicker'; +import moment from 'moment'; export type RangePickerOnChange = Exclude['onChange'], undefined>; diff --git a/src/components/SearchBar/SearchBarColumn/StringColumn/index.tsx b/src/components/SearchBar/SearchBarColumn/StringColumn/index.tsx index c4bea511..7369a8f3 100644 --- a/src/components/SearchBar/SearchBarColumn/StringColumn/index.tsx +++ b/src/components/SearchBar/SearchBarColumn/StringColumn/index.tsx @@ -1,7 +1,7 @@ import { Col, Input } from 'antd'; -import { SearchBarColumnStringTypeProps } from '../types'; import { useStringColumn } from './hooks'; +import { SearchBarColumnStringTypeProps } from '../types'; export function StringColumn(props: SearchBarColumnStringTypeProps) { const { columnFilterValue } = props; diff --git a/src/components/SearchBar/__tests__/SearchBar.test.ts b/src/components/SearchBar/__tests__/SearchBar.test.ts index b67f5eba..a87cea27 100644 --- a/src/components/SearchBar/__tests__/SearchBar.test.ts +++ b/src/components/SearchBar/__tests__/SearchBar.test.ts @@ -1,5 +1,5 @@ -import moment from 'moment'; import { act, renderHook } from '@testing-library/react'; +import moment from 'moment'; import { useSearchBar } from '../hooks'; diff --git a/src/components/Table/index.tsx b/src/components/Table/index.tsx index cf7c7658..15ebab14 100644 --- a/src/components/Table/index.tsx +++ b/src/components/Table/index.tsx @@ -1,12 +1,20 @@ import { Table as ANTDTable } from 'antd'; -import { TableProps } from 'antd/lib/table'; +import { TableProps, TablePaginationConfig } from 'antd/lib/table'; import s from './Table.module.scss'; export function Table(props: TableProps) { return (
- className={s.table} bordered {...props} /> + + className={s.table} + bordered + {...props} + pagination={{ + ...(props.pagination || {}), + showSizeChanger: ((props.pagination as TablePaginationConfig)?.total as number) > 10, + }} + />
); } diff --git a/src/containers/App/utils.ts b/src/containers/App/utils.ts index 74e02382..b88faafd 100644 --- a/src/containers/App/utils.ts +++ b/src/containers/App/utils.ts @@ -1,3 +1,11 @@ +import { Patient, Practitioner } from 'fhir/r4b'; + +import * as aidboxReactRemoteData from 'aidbox-react/lib/libs/remoteData'; +import { + resetInstanceToken as resetAidboxInstanceToken, + setInstanceToken as setAidboxInstanceToken, +} from 'aidbox-react/lib/services/instance'; + import { isSuccess, success } from 'fhir-react/lib/libs/remoteData'; import { getFHIRResource } from 'fhir-react/lib/services/fhir'; import { @@ -5,13 +13,7 @@ import { setInstanceToken as setFHIRInstanceToken, } from 'fhir-react/lib/services/instance'; import { extractErrorCode, formatError } from 'fhir-react/lib/utils/error'; -import { Patient, Practitioner } from 'fhir/r4b'; -import * as aidboxReactRemoteData from 'aidbox-react/lib/libs/remoteData'; -import { - resetInstanceToken as resetAidboxInstanceToken, - setInstanceToken as setAidboxInstanceToken, -} from 'aidbox-react/lib/services/instance'; import { User } from 'shared/src/contrib/aidbox'; diff --git a/src/containers/Appointment/PublicAppointment.tsx b/src/containers/Appointment/PublicAppointment.tsx index 974af5dd..965e4aa0 100644 --- a/src/containers/Appointment/PublicAppointment.tsx +++ b/src/containers/Appointment/PublicAppointment.tsx @@ -1,12 +1,14 @@ import { Trans } from '@lingui/macro'; import { notification } from 'antd'; import Title from 'antd/lib/typography/Title'; -import { axiosInstance as axiosFHIRInstance } from 'fhir-react/lib/services/instance'; -import { uuid4 } from 'fhir-react/lib/utils/uuid'; import { useEffect, useState } from 'react'; import { axiosInstance as axiosAidboxInstance } from 'aidbox-react/lib/services/instance'; +import { axiosInstance as axiosFHIRInstance } from 'fhir-react/lib/services/instance'; +import { uuid4 } from 'fhir-react/lib/utils/uuid'; + + import { questionnaireIdLoader } from 'shared/src/hooks/questionnaire-response-form-data'; import { BasePageContent, BasePageHeader } from 'src/components/BaseLayout'; diff --git a/src/containers/DocumentsList/ChooseDocumentToCreateModal/index.tsx b/src/containers/DocumentsList/ChooseDocumentToCreateModal/index.tsx index 026f74fe..dd4f3863 100644 --- a/src/containers/DocumentsList/ChooseDocumentToCreateModal/index.tsx +++ b/src/containers/DocumentsList/ChooseDocumentToCreateModal/index.tsx @@ -1,14 +1,15 @@ import { t, Trans } from '@lingui/macro'; import { Button, ModalProps, notification, Radio, Space } from 'antd'; -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; -import { useService } from 'fhir-react/lib/hooks/service'; -import { extractBundleResources, getFHIRResources, WithId } from 'fhir-react/lib/services/fhir'; -import { mapSuccess } from 'fhir-react/lib/services/service'; import { Encounter, Patient, Questionnaire } from 'fhir/r4b'; import _ from 'lodash'; import { useCallback, useState } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; +import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; +import { useService } from 'fhir-react/lib/hooks/service'; +import { extractBundleResources, getFHIRResources, WithId } from 'fhir-react/lib/services/fhir'; +import { mapSuccess } from 'fhir-react/lib/services/service'; + import { Modal } from 'src/components/Modal'; import { Spinner } from 'src/components/Spinner'; diff --git a/src/containers/DocumentsList/hooks.ts b/src/containers/DocumentsList/hooks.ts index a6aae6fb..63ec7010 100644 --- a/src/containers/DocumentsList/hooks.ts +++ b/src/containers/DocumentsList/hooks.ts @@ -1,9 +1,11 @@ +import { t } from '@lingui/macro'; +import { Reference, Patient, Questionnaire, QuestionnaireResponse } from 'fhir/r4b'; + import { useService } from 'fhir-react/lib/hooks/service'; import { isSuccess } from 'fhir-react/lib/libs/remoteData'; import { extractBundleResources, getFHIRResources } from 'fhir-react/lib/services/fhir'; import { mapSuccess } from 'fhir-react/lib/services/service'; import { parseFHIRReference } from 'fhir-react/lib/utils/fhir'; -import { Reference, Patient, Questionnaire, QuestionnaireResponse } from 'fhir/r4b'; export function usePatientDocuments(patient: Patient, encounter?: Reference) { const [response] = useService(async () => { @@ -27,11 +29,24 @@ export function usePatientDocuments(patient: Patient, encounter?: Reference) { }); return mapSuccess(qResponse, (bundle) => { - let questionnaireNames: { [key: string]: string | undefined } = {}; + const questionnaireNames: { [key: string]: string } = {}; + const questionnaireNameById: { [key: string]: string } = {}; extractBundleResources(bundle).Questionnaire.forEach( - (q) => (questionnaireNames[q.id!] = q.title || q.name), + (q) => (questionnaireNameById[q.id!] = q.title || q.name || t`Unknown`), ); + qrResponseExtracted.data.QuestionnaireResponse.forEach((qr) => { + const remoteName = questionnaireNameById[qr.questionnaire!]; + if(remoteName) { + questionnaireNames[qr.id!] = remoteName; + } else { + const e = qr._questionnaire?.extension?.find(({url}) => url === 'http://hl7.org/fhir/StructureDefinition/display'); + if(e) { + questionnaireNames[qr.id!] = e.valueString ?? t`Unknown`; + } + } + }); + return { ...qrResponseExtracted.data, questionnaireNames, diff --git a/src/containers/DocumentsList/index.tsx b/src/containers/DocumentsList/index.tsx index 6b9e40e1..7b0361c9 100644 --- a/src/containers/DocumentsList/index.tsx +++ b/src/containers/DocumentsList/index.tsx @@ -1,12 +1,13 @@ import { Trans } from '@lingui/macro'; import { Button } from 'antd'; import { ColumnsType } from 'antd/lib/table'; -import { isLoading, isSuccess, RemoteData } from 'fhir-react/lib/libs/remoteData'; -import { WithId } from 'fhir-react/lib/services/fhir'; import { Encounter, Patient, QuestionnaireResponse } from 'fhir/r4b'; import { useMemo } from 'react'; import { useLocation, useNavigate, useParams } from 'react-router-dom'; +import { isLoading, isSuccess, RemoteData } from 'fhir-react/lib/libs/remoteData'; +import { WithId } from 'fhir-react/lib/services/fhir'; + import { Empty } from 'src/components/Empty'; import { StatusBadge } from 'src/components/EncounterStatusBadge'; import { SpinIndicator } from 'src/components/Spinner'; diff --git a/src/containers/EncounterDetails/hooks.ts b/src/containers/EncounterDetails/hooks.ts index 3b99dcd0..6c1b21e0 100644 --- a/src/containers/EncounterDetails/hooks.ts +++ b/src/containers/EncounterDetails/hooks.ts @@ -1,9 +1,10 @@ +import { Encounter, Patient, Practitioner, PractitionerRole } from 'fhir/r4b'; +import { useNavigate } from 'react-router-dom'; + import { useService } from 'fhir-react/lib/hooks/service'; import { extractBundleResources, getFHIRResources } from 'fhir-react/lib/services/fhir'; import { mapSuccess } from 'fhir-react/lib/services/service'; -import { Encounter, Patient, Practitioner, PractitionerRole } from 'fhir/r4b'; -import { useNavigate } from 'react-router-dom'; export function useEncounterDetails(encounterId: string) { diff --git a/src/containers/EncounterDetails/index.tsx b/src/containers/EncounterDetails/index.tsx index 9f1f3516..f6728256 100644 --- a/src/containers/EncounterDetails/index.tsx +++ b/src/containers/EncounterDetails/index.tsx @@ -2,15 +2,16 @@ import { CheckOutlined, PlusOutlined } from '@ant-design/icons'; import { t, Trans } from '@lingui/macro'; import { Button, notification } from 'antd'; import Title from 'antd/es/typography/Title'; +import { Encounter, Patient } from 'fhir/r4b'; +import { useCallback, useState } from 'react'; +import { useParams } from 'react-router-dom'; + import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; import { useService } from 'fhir-react/lib/hooks/service'; import { isSuccess } from 'fhir-react/lib/libs/remoteData'; import { getFHIRResource, saveFHIRResource } from 'fhir-react/lib/services/fhir'; import { formatFHIRDateTime } from 'fhir-react/lib/utils/date'; import { formatError } from 'fhir-react/lib/utils/error'; -import { Encounter, Patient } from 'fhir/r4b'; -import { useCallback, useState } from 'react'; -import { useParams } from 'react-router-dom'; import { Spinner } from 'src/components/Spinner'; import { DocumentsList } from 'src/containers/DocumentsList'; diff --git a/src/containers/EncounterList/__tests__/EncounterList.test.ts b/src/containers/EncounterList/__tests__/EncounterList.test.ts index 038f37f0..23987983 100644 --- a/src/containers/EncounterList/__tests__/EncounterList.test.ts +++ b/src/containers/EncounterList/__tests__/EncounterList.test.ts @@ -1,7 +1,8 @@ import { act, renderHook, waitFor } from '@testing-library/react'; +import moment from 'moment'; + import { isLoading, isSuccess } from 'fhir-react/lib/libs/remoteData'; import { getReference } from 'fhir-react/lib/services/fhir'; -import moment from 'moment'; import { useSearchBar } from 'src/components/SearchBar/hooks'; import { createEncounter, createPatient, createPractitionerRole, loginAdminUser } from 'src/setupTests'; diff --git a/src/containers/EncounterList/hooks.ts b/src/containers/EncounterList/hooks.ts index a242e1c6..cdde937f 100644 --- a/src/containers/EncounterList/hooks.ts +++ b/src/containers/EncounterList/hooks.ts @@ -1,12 +1,13 @@ import { TablePaginationConfig } from 'antd'; +import { Encounter, Patient, Practitioner, PractitionerRole } from 'fhir/r4b'; +import { useMemo } from 'react'; + import { RemoteData } from 'fhir-react/lib/libs/remoteData'; import { extractBundleResources } from 'fhir-react/lib/services/fhir'; import { SearchParams } from 'fhir-react/lib/services/search'; import { mapSuccess } from 'fhir-react/lib/services/service'; import { formatFHIRDateTime } from 'fhir-react/lib/utils/date'; import { parseFHIRReference } from 'fhir-react/lib/utils/fhir'; -import { Encounter, Patient, Practitioner, PractitionerRole } from 'fhir/r4b'; -import { useMemo } from 'react'; import { EncounterData } from 'src/components/EncountersTable/types'; import { usePagerExtended } from 'src/hooks/pager'; @@ -23,6 +24,7 @@ interface EncountersListData { current: number; pageSize: number; total: number | undefined; + showSizeChanger?: boolean; }; } diff --git a/src/containers/EncounterList/index.tsx b/src/containers/EncounterList/index.tsx index febf18d4..12a65319 100644 --- a/src/containers/EncounterList/index.tsx +++ b/src/containers/EncounterList/index.tsx @@ -71,7 +71,7 @@ export function EncounterList() { title: Actions, dataIndex: 'actions', key: 'action', - width: 180, + width: '10%', render: (_text: any, resource: EncounterData) => ( @@ -82,6 +82,7 @@ export function EncounterList() { Open + {/* Video call + */} ), }, diff --git a/src/containers/EncounterQR/index.tsx b/src/containers/EncounterQR/index.tsx index df8392c5..80f6b953 100644 --- a/src/containers/EncounterQR/index.tsx +++ b/src/containers/EncounterQR/index.tsx @@ -1,23 +1,24 @@ import { t } from '@lingui/macro'; import { Alert, notification } from 'antd'; import Title from 'antd/es/typography/Title'; +import { Questionnaire } from 'fhir/r4b'; +import { useParams } from 'react-router-dom'; + import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; import { useService } from 'fhir-react/lib/hooks/service'; import { getFHIRResource } from 'fhir-react/lib/services/fhir'; import { sequenceMap } from 'fhir-react/lib/services/service'; -import { Questionnaire } from 'fhir/r4b'; -import { useParams } from 'react-router-dom'; import { questionnaireIdLoader } from 'shared/src/hooks/questionnaire-response-form-data'; import { renderHumanName } from 'shared/src/utils/fhir'; import { Spinner } from 'src/components/Spinner'; +import s from './EncounterQR.module.scss'; import { BasePageContent, BasePageHeader } from '../../components/BaseLayout'; import { QuestionnaireResponseForm } from '../../components/QuestionnaireResponseForm'; import { formatHumanDate } from '../../utils/date'; import { useEncounterDetails } from '../EncounterDetails/hooks'; -import s from './EncounterQR.module.scss'; export function EncounterQR() { const { encounterId, questionnaireId } = useParams<{ diff --git a/src/containers/PatientDetails/DocumentHistory/hooks.ts b/src/containers/PatientDetails/DocumentHistory/hooks.ts index 94f81349..5e9b9985 100644 --- a/src/containers/PatientDetails/DocumentHistory/hooks.ts +++ b/src/containers/PatientDetails/DocumentHistory/hooks.ts @@ -1,10 +1,11 @@ +import { Questionnaire, QuestionnaireResponse } from 'fhir/r4b'; import { WithId } from 'fhir-react'; +import { useParams } from 'react-router-dom'; + import { useService } from 'fhir-react/lib/hooks/service'; import { isSuccess } from 'fhir-react/lib/libs/remoteData'; import { extractBundleResources, getFHIRResource } from 'fhir-react/lib/services/fhir'; import { mapSuccess, resolveMap } from 'fhir-react/lib/services/service'; -import { Questionnaire, QuestionnaireResponse } from 'fhir/r4b'; -import { useParams } from 'react-router-dom'; import { Provenance } from 'shared/src/contrib/aidbox'; import { fromFirstClassExtension, toFirstClassExtension } from 'shared/src/utils/converter'; diff --git a/src/containers/PatientDetails/DocumentHistory/index.tsx b/src/containers/PatientDetails/DocumentHistory/index.tsx index 901ea5c7..1657aae7 100644 --- a/src/containers/PatientDetails/DocumentHistory/index.tsx +++ b/src/containers/PatientDetails/DocumentHistory/index.tsx @@ -1,11 +1,12 @@ import { t, Trans } from '@lingui/macro'; import Title from 'antd/lib/typography/Title'; import classNames from 'classnames'; -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; -import { WithId } from 'fhir-react/lib/services/fhir'; import { QuestionnaireResponse, Questionnaire } from 'fhir/r4b'; import { useCallback, useMemo } from 'react'; +import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; +import { WithId } from 'fhir-react/lib/services/fhir'; + import { Provenance } from 'shared/src/contrib/aidbox'; import { formatHumanDateTime } from 'shared/src/utils/date'; diff --git a/src/containers/PatientDetails/PatientContentHeader/PatientContentHeader.module.scss b/src/containers/PatientDetails/PatientContentHeader/PatientContentHeader.module.scss index b697c2d9..4fc75644 100644 --- a/src/containers/PatientDetails/PatientContentHeader/PatientContentHeader.module.scss +++ b/src/containers/PatientDetails/PatientContentHeader/PatientContentHeader.module.scss @@ -4,6 +4,7 @@ background-color: var(--color-white); padding: 12px 0; padding-bottom: 0; + z-index: 2; } .breadcrumbs { diff --git a/src/containers/PatientDetails/PatientDocument/PatientDocumentHeader/index.tsx b/src/containers/PatientDetails/PatientDocument/PatientDocumentHeader/index.tsx index fee023ef..001447d7 100644 --- a/src/containers/PatientDetails/PatientDocument/PatientDocumentHeader/index.tsx +++ b/src/containers/PatientDetails/PatientDocument/PatientDocumentHeader/index.tsx @@ -1,11 +1,12 @@ import { SyncOutlined } from '@ant-design/icons'; import { Tag } from 'antd'; import Title from 'antd/lib/typography/Title'; -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; -import { RemoteData } from 'fhir-react/lib/libs/remoteData'; import { QuestionnaireResponse } from 'fhir/r4b'; import { QuestionnaireResponseFormData } from 'sdc-qrf'; +import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; +import { RemoteData } from 'fhir-react/lib/libs/remoteData'; + import s from '../PatientDocument.module.scss'; interface Props { diff --git a/src/containers/PatientDetails/PatientDocument/index.tsx b/src/containers/PatientDetails/PatientDocument/index.tsx index 05f6a489..27ccb083 100644 --- a/src/containers/PatientDetails/PatientDocument/index.tsx +++ b/src/containers/PatientDetails/PatientDocument/index.tsx @@ -1,10 +1,11 @@ -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; -import { isSuccess, notAsked, RemoteData } from 'fhir-react/lib/libs/remoteData'; -import { WithId } from 'fhir-react/lib/services/fhir'; import { Patient, Practitioner, QuestionnaireResponse } from 'fhir/r4b'; import { useEffect, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; +import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; +import { isSuccess, notAsked, RemoteData } from 'fhir-react/lib/libs/remoteData'; +import { WithId } from 'fhir-react/lib/services/fhir'; + import { BaseQuestionnaireResponseForm } from 'src/components/BaseQuestionnaireResponseForm'; import { AnxietyScore, DepressionScore } from 'src/components/BaseQuestionnaireResponseForm/readonly-widgets/score'; import { Spinner } from 'src/components/Spinner'; diff --git a/src/containers/PatientDetails/PatientDocument/usePatientDocument.ts b/src/containers/PatientDetails/PatientDocument/usePatientDocument.ts index 5d1f464e..03fc4913 100644 --- a/src/containers/PatientDetails/PatientDocument/usePatientDocument.ts +++ b/src/containers/PatientDetails/PatientDocument/usePatientDocument.ts @@ -1,11 +1,12 @@ +import { Encounter, Patient, Practitioner, Provenance, QuestionnaireResponse } from 'fhir/r4b'; import { RemoteDataResult } from 'fhir-react'; +import _ from 'lodash'; +import { useNavigate } from 'react-router-dom'; + import { useService } from 'fhir-react/lib/hooks/service'; import { failure, isSuccess, RemoteData, success } from 'fhir-react/lib/libs/remoteData'; import { getReference, WithId } from 'fhir-react/lib/services/fhir'; import { mapSuccess, resolveMap } from 'fhir-react/lib/services/service'; -import { Encounter, Patient, Practitioner, Provenance, QuestionnaireResponse } from 'fhir/r4b'; -import _ from 'lodash'; -import { useNavigate } from 'react-router-dom'; import { handleFormDataSave, @@ -111,6 +112,8 @@ export function usePatientDocument(props: Props): { const { questionnaireResponse, questionnaireId, onSuccess } = props; const navigate = useNavigate(); + // console.log(questionnaireResponse, questionnaireId, onSuccess); + const [response] = useService(async () => { let provenanceResponse: RemoteDataResult[]> = success([]); @@ -133,7 +136,7 @@ export function usePatientDocument(props: Props): { formData, onSuccess: onSuccess ? onSuccess : () => navigate(-1), }); - + return mapSuccess( await resolveMap({ formData: loadQuestionnaireResponseFormData(formInitialParams), diff --git a/src/containers/PatientDetails/PatientDocumentDetails/ExternalDocumentView/ExternalDocumentView.module.scss b/src/containers/PatientDetails/PatientDocumentDetails/ExternalDocumentView/ExternalDocumentView.module.scss new file mode 100644 index 00000000..7ae1ef97 --- /dev/null +++ b/src/containers/PatientDetails/PatientDocumentDetails/ExternalDocumentView/ExternalDocumentView.module.scss @@ -0,0 +1,56 @@ +.container { + display: flex; + justify-content: center; + + .content { + width: 540px; + background-color: var(--color-background); + border: 1px solid grey; + padding: 32px; + border-radius: 10px; + + .header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20px; + gap: 16px; + flex-wrap: wrap; + + .title { + margin: 0 !important; + } + } + + .question { + display: flex; + flex-direction: column; + padding: 9px 0; + border-bottom: 1px solid grey; + gap: 4px 16px; + margin: 0; + font-size: 14px; + line-height: 22px; + margin-bottom: 0 !important; + + &Row { + flex-direction: row; + justify-content: space-between; + } + + &Group { + font-size: 15px; + font-weight: bold; + } + + &:first-of-type { + border-top: 1px solid grey; + } + + .rowAnswer { + min-width: 40%; + max-width: 40%; + } + } + } +} diff --git a/src/containers/PatientDetails/PatientDocumentDetails/ExternalDocumentView/index.tsx b/src/containers/PatientDetails/PatientDocumentDetails/ExternalDocumentView/index.tsx new file mode 100644 index 00000000..52c403ce --- /dev/null +++ b/src/containers/PatientDetails/PatientDocumentDetails/ExternalDocumentView/index.tsx @@ -0,0 +1,102 @@ +import { t } from '@lingui/macro'; +import { QuestionnaireResponse as FHIRQuestionnaireResponse } from 'fhir/r4b'; +import _ from 'lodash'; + +import { + QuestionnaireResponse as FCEQuestionnaireResponse, + QuestionnaireResponseItem, +} from 'shared/src/contrib/aidbox'; +import { toFirstClassExtension } from 'shared/src/utils/converter'; + +import { getDisplay } from 'src/utils/questionnaire'; + +import s from './ExternalDocumentView.module.scss'; + +interface Props { + questionnaireResponse: FHIRQuestionnaireResponse; +} + +interface Answer { + linkId: string; + text?: string; + answer?: string | number; +} + +function getAnswers(qr: FCEQuestionnaireResponse) { + const collectAnswers = (qrItem: QuestionnaireResponseItem[]): Answer[] => + _.chain(qrItem) + .map((item) => { + const answer = { linkId: item.linkId, text: item.text }; + + if (item.item) { + return [answer, ...collectAnswers(item.item)]; + } + + if (item.answer) { + return { + ...answer, + answer: item.answer.map((a) => getDisplay(a.value)).join(', '), + }; + } + + return answer; + }) + .flattenDeep() + .value(); + + return collectAnswers(qr.item || []); +} + +export function ExternalDocumentView(props: Props) { + const { questionnaireResponse } = props; + const e = questionnaireResponse._questionnaire?.extension?.find( + ({ url }) => url === 'http://hl7.org/fhir/StructureDefinition/display', + ); + const title = e?.valueString ?? t`Unknown`; + const answers = getAnswers(toFirstClassExtension(questionnaireResponse)); + + return ( +
+
+
+

{title}

+
+
+ {answers.map((answer) => { + if (answer.text && !answer.answer) { + return ( +
+ {answer.text} +
+ ); + } + if (answer.text || answer.answer) { + const isLongText = `${answer.text}${answer.answer}`.length > 60; + + if (isLongText) { + return ( +
+
+ {answer.text} +
+
{answer.answer}
+
+ ); + } + + return ( +
+
+ {answer.text} +
+
{answer.answer}
+
+ ); + } + return null; + })} +
+
+
+ ); +} diff --git a/src/containers/PatientDetails/PatientDocumentDetails/index.tsx b/src/containers/PatientDetails/PatientDocumentDetails/index.tsx index e7bb6a26..1255be94 100644 --- a/src/containers/PatientDetails/PatientDocumentDetails/index.tsx +++ b/src/containers/PatientDetails/PatientDocumentDetails/index.tsx @@ -1,6 +1,12 @@ import { t, Trans } from '@lingui/macro'; import { Button, notification } from 'antd'; import Title from 'antd/lib/typography/Title'; +import { Encounter, Patient, Practitioner, Provenance, QuestionnaireResponse } from 'fhir/r4b'; +import _ from 'lodash'; +import { ReactElement } from 'react'; +import { NavigateFunction, Outlet, Route, Routes, useLocation, useNavigate, useParams } from 'react-router-dom'; +import { QuestionnaireResponseFormData } from 'sdc-qrf'; + import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; import { useService } from 'fhir-react/lib/hooks/service'; import { failure, isFailure, isSuccess } from 'fhir-react/lib/libs/remoteData'; @@ -12,10 +18,6 @@ import { WithId, } from 'fhir-react/lib/services/fhir'; import { mapSuccess } from 'fhir-react/lib/services/service'; -import { Encounter, Patient, Practitioner, Provenance, QuestionnaireResponse } from 'fhir/r4b'; -import { ReactElement } from 'react'; -import { NavigateFunction, Outlet, Route, Routes, useLocation, useNavigate, useParams } from 'react-router-dom'; -import { QuestionnaireResponseFormData } from 'sdc-qrf'; import { ReadonlyQuestionnaireResponseForm } from 'src/components/BaseQuestionnaireResponseForm/ReadonlyQuestionnaireResponseForm'; import { BloodPressureReadOnly } from 'src/components/BaseQuestionnaireResponseForm/widgets'; @@ -30,6 +32,7 @@ import { import { usePatientHeaderLocationTitle } from 'src/containers/PatientDetails/PatientHeader/hooks'; import { selectCurrentUserRoleResource } from 'src/utils/role'; +import { ExternalDocumentView } from './ExternalDocumentView'; import s from './PatientDocumentDetails.module.scss'; interface Props { @@ -191,6 +194,10 @@ function PatientDocumentDetailsReadonly(props: { ); } +function isExternalQuestionnaire(qr: QuestionnaireResponse): boolean { + return _.startsWith(qr.questionnaire, 'http'); +} + function PatientDocumentDetailsFormData(props: { questionnaireResponse: WithId; patient: WithId; @@ -219,51 +226,57 @@ export function PatientDocumentDetails(props: Props) { return (
{error}
}> - {({ questionnaireResponse, encounter }) => ( - - {({ formData, provenance }) => ( - - - - - } - > - { + if (isExternalQuestionnaire(questionnaireResponse)) { + return ; + } else { + return ( + + {({ formData, provenance }) => ( + + + + + } + > + + } /> - } - /> - navigate(-2)} - author={author} + navigate(-2)} + author={author} + /> + } /> - } - /> - } /> - - - )} - - )} + } /> + + + )} + + ); + } + }}
); } diff --git a/src/containers/PatientDetails/PatientOverview/hooks.ts b/src/containers/PatientDetails/PatientOverview/hooks.ts index 5655acb1..62f10240 100644 --- a/src/containers/PatientDetails/PatientOverview/hooks.ts +++ b/src/containers/PatientDetails/PatientOverview/hooks.ts @@ -1,9 +1,3 @@ -import { formatFHIRDate } from 'fhir-react'; -import { useService } from 'fhir-react/lib/hooks/service'; -import { isSuccess } from 'fhir-react/lib/libs/remoteData'; -import { extractBundleResources, getAllFHIRResources, getFHIRResources } from 'fhir-react/lib/services/fhir'; -import { mapSuccess, resolveMap } from 'fhir-react/lib/services/service'; -import { formatFHIRDateTime } from 'fhir-react/lib/utils/date'; import { AllergyIntolerance, Appointment, @@ -16,9 +10,16 @@ import { Condition, Consent, } from 'fhir/r4b'; +import { formatFHIRDate } from 'fhir-react'; import _ from 'lodash'; import moment from 'moment'; +import { useService } from 'fhir-react/lib/hooks/service'; +import { isSuccess } from 'fhir-react/lib/libs/remoteData'; +import { extractBundleResources, getAllFHIRResources, getFHIRResources } from 'fhir-react/lib/services/fhir'; +import { mapSuccess, resolveMap } from 'fhir-react/lib/services/service'; +import { formatFHIRDateTime } from 'fhir-react/lib/utils/date'; + import { formatHumanDate, getPersonAge } from 'src/utils/date'; import { @@ -55,7 +56,7 @@ export function usePatientOverview(props: Props) { const bmi = isSuccess(bmiRD) ? bmiRD.data[0]?.valueQuantity?.value : undefined; - let patientDetails = [ + const patientDetails = [ { title: 'Birth date', value: patient.birthDate diff --git a/src/containers/PatientDetails/PatientOverview/utils.tsx b/src/containers/PatientDetails/PatientOverview/utils.tsx index 8546d332..c31cfe28 100644 --- a/src/containers/PatientDetails/PatientOverview/utils.tsx +++ b/src/containers/PatientDetails/PatientOverview/utils.tsx @@ -1,8 +1,5 @@ import { AlertOutlined, ExperimentOutlined, HeartOutlined, TeamOutlined, ThunderboltOutlined } from '@ant-design/icons'; import { t } from '@lingui/macro'; -import { formatFHIRDate } from 'fhir-react'; -import { extractBundleResources, WithId } from 'fhir-react/lib/services/fhir'; -import { parseFHIRDateTime } from 'fhir-react/lib/utils/date'; import { Resource, AllergyIntolerance, @@ -16,10 +13,14 @@ import { Consent, Observation, } from 'fhir/r4b'; +import { formatFHIRDate } from 'fhir-react'; import _ from 'lodash'; import moment from 'moment'; import { Link, useLocation } from 'react-router-dom'; +import { extractBundleResources, WithId } from 'fhir-react/lib/services/fhir'; +import { parseFHIRDateTime } from 'fhir-react/lib/utils/date'; + import { extractExtension, fromFHIRReference } from 'shared/src/utils/converter'; import { PatientActivitySummary } from 'src/containers/PatientDetails/PatientActivitySummary'; diff --git a/src/containers/PatientDetails/PatientResources/ResourceTable.tsx b/src/containers/PatientDetails/PatientResources/ResourceTable.tsx index a97ab236..868fdecc 100644 --- a/src/containers/PatientDetails/PatientResources/ResourceTable.tsx +++ b/src/containers/PatientDetails/PatientResources/ResourceTable.tsx @@ -1,10 +1,12 @@ import { Trans } from '@lingui/macro'; import { Empty } from 'antd'; +import { Provenance, Resource } from 'fhir/r4b'; +import { ReactNode } from 'react'; + import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; import { extractBundleResources } from 'fhir-react/lib/services/fhir'; import { SearchParams } from 'fhir-react/lib/services/search'; -import { Provenance, Resource } from 'fhir/r4b'; -import { ReactNode } from 'react'; + import { Spinner } from 'src/components/Spinner'; import { Table } from 'src/components/Table'; diff --git a/src/containers/PatientDetails/PatientResources/index.tsx b/src/containers/PatientDetails/PatientResources/index.tsx index a43fb3af..856a2767 100644 --- a/src/containers/PatientDetails/PatientResources/index.tsx +++ b/src/containers/PatientDetails/PatientResources/index.tsx @@ -1,9 +1,10 @@ import { Select } from 'antd'; -import { WithId } from 'fhir-react/lib/services/fhir'; import { Patient } from 'fhir/r4b'; import { useState } from 'react'; import { useParams } from 'react-router-dom'; +import { WithId } from 'fhir-react/lib/services/fhir'; + import { Option } from './ResourceTable'; import { getOptions } from './utils'; diff --git a/src/containers/PatientDetails/PatientResources/utils.tsx b/src/containers/PatientDetails/PatientResources/utils.tsx index 8eaa7d9e..30999927 100644 --- a/src/containers/PatientDetails/PatientResources/utils.tsx +++ b/src/containers/PatientDetails/PatientResources/utils.tsx @@ -1,17 +1,19 @@ import { t } from '@lingui/macro'; -import { WithId } from 'fhir-react/lib/services/fhir'; import { AllergyIntolerance, Condition, Consent, Immunization, MedicationStatement, + Observation, Patient, Provenance, Resource, } from 'fhir/r4b'; import { Link, useLocation } from 'react-router-dom'; +import { WithId } from 'fhir-react/lib/services/fhir'; + import { extractExtension, fromFHIRReference } from 'shared/src/utils/converter'; import { formatHumanDate } from 'src/utils/date'; @@ -220,6 +222,68 @@ export function getOptions(patient: WithId): Option[] { }, ], }, + { + value: 'observations', + label: 'Observations', + renderTable: (option: Option) => ( + + key={`resource-table-${option.value}`} + resourceType="Observation" + params={{ + patient: patient.id, + status: 'final', + _sort: ['-_lastUpdated'], + _revinclude: ['Provenance:target'], + }} + option={option} + /> + ), + getTableColumns: (provenanceList: Provenance[] = []) => [ + { + title: t`Title`, + key: 'title', + render: (resource: Observation) => ( + + ), + width: 200, + }, + { + title: t`Date`, + key: 'date', + render: (r: Observation) => { + return r.issued ? formatHumanDate(r.issued) : null; + }, + width: 200, + }, + { + title: t`Value`, + key: 'actor', + render: (r: Observation) => { + if(r.valueQuantity) { + return `${r.valueQuantity.value} ${r.valueQuantity.unit}`; + } else if (r.component) { + return ( + <> + {r.component.map((c) => [ + ...[c.code.coding?.[0]?.display], + ...[`${c.valueQuantity?.value} ${c.valueQuantity?.unit}`] + ].join(': '), + ).map((v) => ( +
{v}
+ ))} + + ) + } else if (r.valueCodeableConcept) { + return ( + r.valueCodeableConcept.text || r.valueCodeableConcept.coding?.[0]?.display + ); + } + return null; + }, + width: 200, + }, + ] + } ]; } diff --git a/src/containers/PatientDetails/PatientWearables/hooks.ts b/src/containers/PatientDetails/PatientWearables/hooks.ts index 784cea73..f7d8d0f4 100644 --- a/src/containers/PatientDetails/PatientWearables/hooks.ts +++ b/src/containers/PatientDetails/PatientWearables/hooks.ts @@ -1,9 +1,9 @@ +import { Consent, Patient, Practitioner } from 'fhir/r4b'; + import { useService } from 'fhir-react/lib/hooks/service'; import { failure, isFailure, success } from 'fhir-react/lib/libs/remoteData'; -import { WithId, getFHIRResources } from 'fhir-react/lib/services/fhir'; -import { extractBundleResources } from 'fhir-react/lib/services/fhir'; +import { WithId, getFHIRResources , extractBundleResources } from 'fhir-react/lib/services/fhir'; import { mapSuccess } from 'fhir-react/lib/services/service'; -import { Consent, Patient, Practitioner } from 'fhir/r4b'; import config from 'shared/src/config'; diff --git a/src/containers/PatientDetails/PatientWearables/index.tsx b/src/containers/PatientDetails/PatientWearables/index.tsx index 6e3e4afc..e835a4c9 100644 --- a/src/containers/PatientDetails/PatientWearables/index.tsx +++ b/src/containers/PatientDetails/PatientWearables/index.tsx @@ -1,10 +1,11 @@ import { t } from '@lingui/macro'; import { Empty, Result } from 'antd'; import { ColumnsType } from 'antd/lib/table'; +import { Patient } from 'fhir/r4b'; import { WithId } from 'fhir-react'; + import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; import { isLoading, isSuccess } from 'fhir-react/lib/libs/remoteData'; -import { Patient } from 'fhir/r4b'; import { SpinIndicator } from 'src/components/Spinner'; import { Table } from 'src/components/Table'; diff --git a/src/containers/PatientDetails/hooks.ts b/src/containers/PatientDetails/hooks.ts index 793424f6..1dc06c97 100644 --- a/src/containers/PatientDetails/hooks.ts +++ b/src/containers/PatientDetails/hooks.ts @@ -1,6 +1,7 @@ +import { Patient } from 'fhir/r4b'; + import { useService } from 'fhir-react/lib/hooks/service'; import { getFHIRResource } from 'fhir-react/lib/services/fhir'; -import { Patient } from 'fhir/r4b'; export function usePatientResource(config: { id: string }) { return useService(async () => diff --git a/src/containers/PatientList/__tests__/PatientsList.test.ts b/src/containers/PatientList/__tests__/PatientsList.test.ts index eaed3253..4b43e79c 100644 --- a/src/containers/PatientList/__tests__/PatientsList.test.ts +++ b/src/containers/PatientList/__tests__/PatientsList.test.ts @@ -1,4 +1,5 @@ import { act, renderHook, waitFor } from '@testing-library/react'; + import { isLoading, isSuccess } from 'fhir-react/lib/libs/remoteData'; import { useSearchBar } from 'src/components/SearchBar/hooks'; diff --git a/src/containers/PatientList/hooks.ts b/src/containers/PatientList/hooks.ts index bd21d60c..87156c75 100644 --- a/src/containers/PatientList/hooks.ts +++ b/src/containers/PatientList/hooks.ts @@ -1,6 +1,7 @@ +import { Patient } from 'fhir/r4b'; + import { extractBundleResources } from 'fhir-react/lib/services/fhir'; import { mapSuccess } from 'fhir-react/lib/services/service'; -import { Patient } from 'fhir/r4b'; import { StringTypeColumnFilterValue } from 'src/components/SearchBar/types'; import { usePagerExtended } from 'src/hooks/pager'; diff --git a/src/containers/PatientList/index.tsx b/src/containers/PatientList/index.tsx index 063b8112..5d15326c 100644 --- a/src/containers/PatientList/index.tsx +++ b/src/containers/PatientList/index.tsx @@ -120,7 +120,7 @@ export function PatientList() { > {({ closeModal }) => ( { notification.success({ diff --git a/src/containers/PatientQuestionnaire/index.tsx b/src/containers/PatientQuestionnaire/index.tsx index 7f9c9e88..8749d7d9 100644 --- a/src/containers/PatientQuestionnaire/index.tsx +++ b/src/containers/PatientQuestionnaire/index.tsx @@ -1,16 +1,17 @@ import { Trans } from '@lingui/macro'; import Title from 'antd/lib/typography/Title'; -import { WithId } from 'fhir-react'; -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; -import { useService } from 'fhir-react/lib/hooks/service'; -import { getFHIRResource } from 'fhir-react/lib/services/fhir'; -import { axiosInstance as axiosFHIRInstance } from 'fhir-react/lib/services/instance'; import { Patient } from 'fhir/r4b'; +import { WithId } from 'fhir-react'; import { useEffect, useMemo, useState } from 'react'; import { useLocation } from 'react-router-dom'; import { axiosInstance as axiosAidboxInstance } from 'aidbox-react/lib/services/instance'; +import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; +import { useService } from 'fhir-react/lib/hooks/service'; +import { getFHIRResource } from 'fhir-react/lib/services/fhir'; +import { axiosInstance as axiosFHIRInstance } from 'fhir-react/lib/services/instance'; + import { BasePageContent, BasePageHeader } from 'src/components/BaseLayout'; import { Spinner } from 'src/components/Spinner'; import { getToken } from 'src/services/auth'; @@ -75,13 +76,13 @@ export function PatientQuestionnaire() { return ( <> - - + <BasePageHeader style={{ paddingTop: 16, paddingBottom: 16 }}> + <Title style={{ fontSize: 24, marginBottom: 0 }}> <Trans>Questionnaire</Trans> - + {isLoading ? ( ) : ( diff --git a/src/containers/PractitionerDetails/PractitionerOverview/index.tsx b/src/containers/PractitionerDetails/PractitionerOverview/index.tsx index d58b2ad2..c447ce4f 100644 --- a/src/containers/PractitionerDetails/PractitionerOverview/index.tsx +++ b/src/containers/PractitionerDetails/PractitionerOverview/index.tsx @@ -1,9 +1,10 @@ import { ContactsOutlined } from '@ant-design/icons'; import { t, Trans } from '@lingui/macro'; import { Button, notification } from 'antd'; -import { WithId } from 'fhir-react/lib/services/fhir'; import { Practitioner, PractitionerRole } from 'fhir/r4b'; +import { WithId } from 'fhir-react/lib/services/fhir'; + import { questionnaireIdLoader } from 'shared/src/hooks/questionnaire-response-form-data'; import { DashboardCard } from 'src/components/DashboardCard'; @@ -21,7 +22,7 @@ interface Props { function usePractitionerOverview(props: Props) { const { practitioner, practitionerRole } = props; - let details = [ + const details = [ { title: 'First name', value: practitioner.name?.[0]?.given?.[0], diff --git a/src/containers/PractitionerList/__tests__/PractitionerList.test.ts b/src/containers/PractitionerList/__tests__/PractitionerList.test.ts index 0b402353..cea35627 100644 --- a/src/containers/PractitionerList/__tests__/PractitionerList.test.ts +++ b/src/containers/PractitionerList/__tests__/PractitionerList.test.ts @@ -1,4 +1,5 @@ import { act, renderHook, waitFor } from '@testing-library/react'; + import { isLoading, isSuccess } from 'fhir-react/lib/libs/remoteData'; import { useSearchBar } from 'src/components/SearchBar/hooks'; diff --git a/src/containers/PractitionerList/hooks.ts b/src/containers/PractitionerList/hooks.ts index 52b33d67..4999d93a 100644 --- a/src/containers/PractitionerList/hooks.ts +++ b/src/containers/PractitionerList/hooks.ts @@ -1,10 +1,11 @@ +import { Practitioner, PractitionerRole } from 'fhir/r4b'; import { WithId } from 'fhir-react'; + import { useService } from 'fhir-react/lib/hooks/service'; import { isSuccess, success } from 'fhir-react/lib/libs/remoteData'; import { extractBundleResources, getFHIRResources } from 'fhir-react/lib/services/fhir'; import { mapSuccess } from 'fhir-react/lib/services/service'; import { parseFHIRReference } from 'fhir-react/lib/utils/fhir'; -import { Practitioner, PractitionerRole } from 'fhir/r4b'; import { renderHumanName } from 'shared/src/utils/fhir'; diff --git a/src/containers/QuestionnaireBuilder/Builder/BuilderField.tsx b/src/containers/QuestionnaireBuilder/Builder/BuilderField.tsx index 5639c249..af65eef8 100644 --- a/src/containers/QuestionnaireBuilder/Builder/BuilderField.tsx +++ b/src/containers/QuestionnaireBuilder/Builder/BuilderField.tsx @@ -3,9 +3,9 @@ import { Button } from 'antd'; import classNames from 'classnames'; import { QuestionItemProps } from 'sdc-qrf'; -import { OnItemDrag } from '../hooks'; import s from './Builder.module.scss'; import { FieldSource, FieldTarget } from './DragAndDrop'; +import { OnItemDrag } from '../hooks'; interface Props { children: React.ReactNode; diff --git a/src/containers/QuestionnaireBuilder/Builder/BuilderGroup.tsx b/src/containers/QuestionnaireBuilder/Builder/BuilderGroup.tsx index 9651fb42..041d60e5 100644 --- a/src/containers/QuestionnaireBuilder/Builder/BuilderGroup.tsx +++ b/src/containers/QuestionnaireBuilder/Builder/BuilderGroup.tsx @@ -3,9 +3,9 @@ import { Button } from 'antd'; import classNames from 'classnames'; import { GroupItemProps } from 'sdc-qrf'; -import { OnItemDrag } from '../hooks'; import s from './Builder.module.scss'; import { FieldSource, FieldTarget } from './DragAndDrop'; +import { OnItemDrag } from '../hooks'; interface Props { children: React.ReactNode; diff --git a/src/containers/QuestionnaireBuilder/Builder/DragAndDrop.tsx b/src/containers/QuestionnaireBuilder/Builder/DragAndDrop.tsx index df49688c..104ec2c3 100644 --- a/src/containers/QuestionnaireBuilder/Builder/DragAndDrop.tsx +++ b/src/containers/QuestionnaireBuilder/Builder/DragAndDrop.tsx @@ -3,9 +3,9 @@ import { useContext } from 'react'; import { useDrag, useDrop } from 'react-dnd'; import { GroupItemProps, QuestionItemProps } from 'sdc-qrf'; +import s from './Builder.module.scss'; import { FieldSourceContext } from '../context'; import { OnItemDrag } from '../hooks'; -import s from './Builder.module.scss'; interface FieldSourceProps { children: React.ReactNode; diff --git a/src/containers/QuestionnaireBuilder/Builder/index.tsx b/src/containers/QuestionnaireBuilder/Builder/index.tsx index e9a74e20..1e249d6e 100644 --- a/src/containers/QuestionnaireBuilder/Builder/index.tsx +++ b/src/containers/QuestionnaireBuilder/Builder/index.tsx @@ -1,22 +1,23 @@ import { t } from '@lingui/macro'; import { Alert, Typography } from 'antd'; import { RemoteData } from 'fhir-react'; -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; import { useState } from 'react'; import { DndProvider } from 'react-dnd'; import { HTML5Backend } from 'react-dnd-html5-backend'; import { GroupItemProps, QuestionItemProps } from 'sdc-qrf'; +import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; + import { toQuestionnaireResponseFormData } from 'shared/src/hooks/questionnaire-response-form-data'; import { BaseQuestionnaireResponseForm } from 'src/components/BaseQuestionnaireResponseForm'; import { Spinner } from 'src/components/Spinner'; +import { BuilderField } from './BuilderField'; +import { BuilderGroup } from './BuilderGroup'; import { FieldSourceContext } from '../context'; import { OnItemDrag } from '../hooks'; import s from '../QuestionnaireBuilder.module.scss'; -import { BuilderField } from './BuilderField'; -import { BuilderGroup } from './BuilderGroup'; const { Title } = Typography; diff --git a/src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx b/src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx index dbe159f9..c8604c1a 100644 --- a/src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx +++ b/src/containers/QuestionnaireBuilder/QuestionnaireItemSettings/controls.tsx @@ -1,13 +1,8 @@ import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons'; import { Trans, t } from '@lingui/macro'; import { Button, Checkbox, Empty, Form, Input } from 'antd'; -import { parseFHIRTime } from 'fhir-react'; -import { useService } from 'fhir-react/lib/hooks/service'; -import { isLoading, isSuccess } from 'fhir-react/lib/libs/remoteData'; -import { WithId, extractBundleResources, getFHIRResources } from 'fhir-react/lib/services/fhir'; -import { mapSuccess } from 'fhir-react/lib/services/service'; -import { formatFHIRDate, formatFHIRTime, parseFHIRDate } from 'fhir-react/lib/utils/date'; import { Coding, ValueSet } from 'fhir/r4b'; +import { parseFHIRTime } from 'fhir-react'; import _ from 'lodash'; import { useMemo, useState } from 'react'; import { useFormContext } from 'react-hook-form'; @@ -15,6 +10,13 @@ import AsyncSelect from 'react-select/async'; import { service } from 'aidbox-react/lib/services/service'; +import { useService } from 'fhir-react/lib/hooks/service'; +import { isLoading, isSuccess } from 'fhir-react/lib/libs/remoteData'; +import { WithId, extractBundleResources, getFHIRResources } from 'fhir-react/lib/services/fhir'; +import { mapSuccess } from 'fhir-react/lib/services/service'; +import { formatFHIRDate, formatFHIRTime, parseFHIRDate } from 'fhir-react/lib/utils/date'; + + import { QuestionnaireItemAnswerOption } from 'shared/src/contrib/aidbox'; import { humanDate, humanTime } from 'shared/src/utils/date'; @@ -348,7 +350,7 @@ export function useValueSetField() { }); if (isSuccess(response)) { - let valueSetMap = {}; + const valueSetMap = {}; response.data.forEach((v) => (valueSetMap[`ValueSet/${v.id}`] = v)); setOptionsData(valueSetMap); return response.data || []; diff --git a/src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx b/src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx index 93cb514b..98116cd5 100644 --- a/src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx +++ b/src/containers/QuestionnaireBuilder/QuestionnaireSaveForm/index.tsx @@ -2,13 +2,14 @@ import { yupResolver } from '@hookform/resolvers/yup'; import { Trans, t } from '@lingui/macro'; import { Button, Form, Input, Select } from 'antd'; import Title from 'antd/lib/typography/Title'; -import { RemoteDataResult, isSuccess } from 'fhir-react/lib/libs/remoteData'; -import { WithId } from 'fhir-react/lib/services/fhir'; import { Questionnaire } from 'fhir/r4b'; import { useMemo } from 'react'; import { FormProvider, UseControllerReturn, useController, useForm, useFormContext } from 'react-hook-form'; import * as yup from 'yup'; +import { RemoteDataResult, isSuccess } from 'fhir-react/lib/libs/remoteData'; +import { WithId } from 'fhir-react/lib/services/fhir'; + interface QuestionnaireSaveFormProps { questionnaire: Questionnaire; onSave: (questionnaire: Questionnaire) => Promise>>; diff --git a/src/containers/QuestionnaireBuilder/hooks.ts b/src/containers/QuestionnaireBuilder/hooks.ts index 3e6fc3fe..4a1980c2 100644 --- a/src/containers/QuestionnaireBuilder/hooks.ts +++ b/src/containers/QuestionnaireBuilder/hooks.ts @@ -1,14 +1,15 @@ import { notification } from 'antd'; -import { notAsked, RemoteData } from 'fhir-react'; -import { isFailure, isSuccess, loading, success } from 'fhir-react/lib/libs/remoteData'; -import { getFHIRResource, saveFHIRResource } from 'fhir-react/lib/services/fhir'; -import { formatError } from 'fhir-react/lib/utils/error'; import { Questionnaire as FHIRQuestionnaire, QuestionnaireItem as FHIRQuestionnaireItem } from 'fhir/r4b'; +import { notAsked, RemoteData } from 'fhir-react'; import _ from 'lodash'; import { useCallback, useEffect, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import { GroupItemProps, QuestionItemProps } from 'sdc-qrf'; +import { isFailure, isSuccess, loading, success } from 'fhir-react/lib/libs/remoteData'; +import { getFHIRResource, saveFHIRResource } from 'fhir-react/lib/services/fhir'; +import { formatError } from 'fhir-react/lib/utils/error'; + import { fromFirstClassExtension, toFirstClassExtension } from 'shared/src/utils/converter'; import { generateQuestionnaire } from 'src/services/questionnaire-builder'; diff --git a/src/containers/QuestionnaireList/__tests__/QuestionnaireList.test.ts b/src/containers/QuestionnaireList/__tests__/QuestionnaireList.test.ts index f1084cfb..add4a2d2 100644 --- a/src/containers/QuestionnaireList/__tests__/QuestionnaireList.test.ts +++ b/src/containers/QuestionnaireList/__tests__/QuestionnaireList.test.ts @@ -1,4 +1,5 @@ import { act, renderHook, waitFor } from '@testing-library/react'; + import { isLoading, isSuccess } from 'fhir-react/lib/libs/remoteData'; import { useSearchBar } from 'src/components/SearchBar/hooks'; diff --git a/src/containers/QuestionnaireList/hooks.ts b/src/containers/QuestionnaireList/hooks.ts index 5a14c77b..78c74a9e 100644 --- a/src/containers/QuestionnaireList/hooks.ts +++ b/src/containers/QuestionnaireList/hooks.ts @@ -1,6 +1,7 @@ +import { Questionnaire } from 'fhir/r4b'; + import { extractBundleResources } from 'fhir-react/lib/services/fhir'; import { mapSuccess } from 'fhir-react/lib/services/service'; -import { Questionnaire } from 'fhir/r4b'; import { StringTypeColumnFilterValue } from 'src/components/SearchBar/types'; import { usePagerExtended } from 'src/hooks/pager'; diff --git a/src/containers/Scheduling/Availability/index.tsx b/src/containers/Scheduling/Availability/index.tsx index e9ba45e6..ccaf1c0f 100644 --- a/src/containers/Scheduling/Availability/index.tsx +++ b/src/containers/Scheduling/Availability/index.tsx @@ -2,20 +2,21 @@ import { DeleteOutlined, PlusOutlined } from '@ant-design/icons'; import { Trans } from '@lingui/macro'; import { Button, Checkbox, Col, notification, Row } from 'antd'; import Title from 'antd/es/typography/Title'; -import { isSuccess } from 'fhir-react/lib/libs/remoteData'; -import { saveFHIRResource, WithId } from 'fhir-react/lib/services/fhir'; -import { formatError } from 'fhir-react/lib/utils/error'; import { PractitionerRole } from 'fhir/r4b'; import moment from 'moment'; import React from 'react'; +import { isSuccess } from 'fhir-react/lib/libs/remoteData'; +import { saveFHIRResource, WithId } from 'fhir-react/lib/services/fhir'; +import { formatError } from 'fhir-react/lib/utils/error'; + import { formatFHIRTime } from 'shared/src/utils/date'; import { RangeTimePicker } from 'src/components/TimePicker'; -import { DaySchedule, daysMapping, toAvailableTime } from '../available-time'; import s from './Availability.module.scss'; import { useAvailability } from './hooks'; +import { DaySchedule, daysMapping, toAvailableTime } from '../available-time'; interface Props { practitionerRole: PractitionerRole; diff --git a/src/containers/Scheduling/ScheduleCalendar/components/AppointmentDetailsModal/index.tsx b/src/containers/Scheduling/ScheduleCalendar/components/AppointmentDetailsModal/index.tsx index c20d67f5..16619bf9 100644 --- a/src/containers/Scheduling/ScheduleCalendar/components/AppointmentDetailsModal/index.tsx +++ b/src/containers/Scheduling/ScheduleCalendar/components/AppointmentDetailsModal/index.tsx @@ -1,12 +1,13 @@ import { t, Trans } from '@lingui/macro'; import { Button } from 'antd'; +import { Appointment, Encounter, PractitionerRole } from 'fhir/r4b'; + import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; import { useService } from 'fhir-react/lib/hooks/service'; import { isSuccess } from 'fhir-react/lib/libs/remoteData'; import { extractBundleResources, getFHIRResources } from 'fhir-react/lib/services/fhir'; import { mapSuccess } from 'fhir-react/lib/services/service'; import { parseFHIRReference } from 'fhir-react/lib/utils/fhir'; -import { Appointment, Encounter, PractitionerRole } from 'fhir/r4b'; import { ReadonlyQuestionnaireResponseForm } from 'src/components/BaseQuestionnaireResponseForm/ReadonlyQuestionnaireResponseForm'; import { Modal } from 'src/components/Modal'; diff --git a/src/containers/Scheduling/ScheduleCalendar/components/EditAppointmentModal/index.tsx b/src/containers/Scheduling/ScheduleCalendar/components/EditAppointmentModal/index.tsx index 24146583..0bdffdeb 100644 --- a/src/containers/Scheduling/ScheduleCalendar/components/EditAppointmentModal/index.tsx +++ b/src/containers/Scheduling/ScheduleCalendar/components/EditAppointmentModal/index.tsx @@ -1,6 +1,7 @@ -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; import { PractitionerRole } from 'fhir/r4b'; +import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; + import { inMemorySaveService } from 'shared/src/hooks/questionnaire-response-form-data'; import { BaseQuestionnaireResponseForm } from 'src/components/BaseQuestionnaireResponseForm'; diff --git a/src/containers/Scheduling/ScheduleCalendar/components/NewAppointmentModal/index.tsx b/src/containers/Scheduling/ScheduleCalendar/components/NewAppointmentModal/index.tsx index 769a7ba4..0055f603 100644 --- a/src/containers/Scheduling/ScheduleCalendar/components/NewAppointmentModal/index.tsx +++ b/src/containers/Scheduling/ScheduleCalendar/components/NewAppointmentModal/index.tsx @@ -1,6 +1,7 @@ -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; import { PractitionerRole } from 'fhir/r4b'; +import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; + import { inMemorySaveService } from 'shared/src/hooks/questionnaire-response-form-data'; import { formatFHIRDateTime } from 'shared/src/utils/date'; diff --git a/src/containers/Scheduling/ScheduleCalendar/hooks/useScheduleCalendar.ts b/src/containers/Scheduling/ScheduleCalendar/hooks/useScheduleCalendar.ts index e9cf71d4..0a3ad788 100644 --- a/src/containers/Scheduling/ScheduleCalendar/hooks/useScheduleCalendar.ts +++ b/src/containers/Scheduling/ScheduleCalendar/hooks/useScheduleCalendar.ts @@ -1,4 +1,8 @@ +import { Appointment, Patient, PractitionerRole } from 'fhir/r4b'; +import moment from 'moment'; +import React from 'react'; + import { useService } from 'fhir-react/lib/hooks/service'; import { extractBundleResources, @@ -8,9 +12,6 @@ import { getReference, } from 'fhir-react/lib/services/fhir'; import { mapSuccess, sequenceMap } from 'fhir-react/lib/services/service'; -import { Appointment, Patient, PractitionerRole } from 'fhir/r4b'; -import moment from 'moment'; -import React from 'react'; import { extractAppointmentPatient } from 'shared/src/utils/appointment'; import { formatFHIRDateTime } from 'shared/src/utils/date'; diff --git a/src/containers/Scheduling/ScheduleCalendar/index.tsx b/src/containers/Scheduling/ScheduleCalendar/index.tsx index 7e7d20de..f826e919 100644 --- a/src/containers/Scheduling/ScheduleCalendar/index.tsx +++ b/src/containers/Scheduling/ScheduleCalendar/index.tsx @@ -6,9 +6,10 @@ import timeGridPlugin from '@fullcalendar/timegrid'; import { t, Trans } from '@lingui/macro'; import { notification } from 'antd'; import Title from 'antd/es/typography/Title'; -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; import { PractitionerRole } from 'fhir/r4b'; +import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; + import { AppointmentDetailsModal } from './components/AppointmentDetailsModal'; import { EditAppointmentModal } from './components/EditAppointmentModal'; import { NewAppointmentModal } from './components/NewAppointmentModal'; diff --git a/src/containers/Scheduling/available-time.ts b/src/containers/Scheduling/available-time.ts index c3638370..258bc322 100644 --- a/src/containers/Scheduling/available-time.ts +++ b/src/containers/Scheduling/available-time.ts @@ -46,7 +46,7 @@ export function fromAvailableTime(availableTimes: PractitionerRoleAvailableTime[ a.start!.localeCompare(b.start!), ); - let breaks: ScheduleBreak[] = []; + const breaks: ScheduleBreak[] = []; if (sortedDayAvailableTimes.length > 1) { for (let i = 0; i < sortedDayAvailableTimes.length - 1; i++) { const periodStart = sortedDayAvailableTimes[i]?.end; diff --git a/src/containers/VideoCall/index.tsx b/src/containers/VideoCall/index.tsx index 33494457..4f40a213 100644 --- a/src/containers/VideoCall/index.tsx +++ b/src/containers/VideoCall/index.tsx @@ -29,9 +29,9 @@ export function VideoCall() { return ( <> - + - Video call + Video call diff --git a/src/hooks/pager.ts b/src/hooks/pager.ts index 323a296c..ab05ae71 100644 --- a/src/hooks/pager.ts +++ b/src/hooks/pager.ts @@ -1,9 +1,10 @@ import { TablePaginationConfig } from 'antd'; +import { Resource } from 'fhir/r4b'; +import { useState } from 'react'; + import { usePager } from 'fhir-react/lib/hooks/pager'; import { isSuccess } from 'fhir-react/lib/libs/remoteData'; import { SearchParams } from 'fhir-react/lib/services/search'; -import { Resource } from 'fhir/r4b'; -import { useState } from 'react'; export function usePagerExtended( resourceType: string, diff --git a/src/main.tsx b/src/main.tsx index ce78ba11..5e294924 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -10,7 +10,6 @@ import { dynamicActivate, getCurrentLocale } from 'shared/src/services/i18n'; import 'antd/dist/reset.css'; import 'src/styles/index.scss'; -import 'shared/src/services/i18n'; import { App } from 'src/containers/App'; diff --git a/src/serviceWorker.ts b/src/serviceWorker.ts index be16813a..d84281b4 100644 --- a/src/serviceWorker.ts +++ b/src/serviceWorker.ts @@ -21,8 +21,8 @@ const isLocalhost = Boolean( ); type Config = { - onSuccess?: (registration: ServiceWorkerRegistration) => void; // eslint-disable-line - onUpdate?: (registration: ServiceWorkerRegistration) => void; // eslint-disable-line + onSuccess?: (registration: ServiceWorkerRegistration) => void; + onUpdate?: (registration: ServiceWorkerRegistration) => void; }; export function register(config?: Config) { diff --git a/src/services/auth.ts b/src/services/auth.ts index c2dab221..3058c850 100644 --- a/src/services/auth.ts +++ b/src/services/auth.ts @@ -1,10 +1,11 @@ -import { setInstanceToken as setFHIRInstanceToken } from 'fhir-react/lib/services/instance'; import { decodeJwt } from 'jose'; import { setInstanceToken as setAidboxInstanceToken } from 'aidbox-react/lib/services/instance'; import { service } from 'aidbox-react/lib/services/service'; import { Token } from 'aidbox-react/lib/services/token'; +import { setInstanceToken as setFHIRInstanceToken } from 'fhir-react/lib/services/instance'; + import config from 'shared/src/config'; import { User } from 'shared/src/contrib/aidbox'; diff --git a/src/services/history.ts b/src/services/history.ts index c5acca09..ffee3a2c 100644 --- a/src/services/history.ts +++ b/src/services/history.ts @@ -1,8 +1,9 @@ -import { service } from 'fhir-react/lib/services/service'; import { Resource, Bundle, Reference } from 'fhir/r4b'; import { createBrowserHistory } from 'history'; +import { service } from 'fhir-react/lib/services/service'; + export const history = createBrowserHistory(); export async function loadResourceHistory( diff --git a/src/setupTests.ts b/src/setupTests.ts index b06e8bee..bd5c9b2e 100644 --- a/src/setupTests.ts +++ b/src/setupTests.ts @@ -4,13 +4,6 @@ // learn more: https://github.com/testing-library/jest-dom import '@testing-library/jest-dom/extend-expect'; -import { createFHIRResource, getReference, saveFHIRResource } from 'fhir-react/lib/services/fhir'; -import { - resetInstanceToken as resetFHIRInstanceToken, - setInstanceBaseURL as setFHIRInstanceBaseURL, - setInstanceToken as setFHIRInstanceToken, -} from 'fhir-react/lib/services/instance'; -import { ensure } from 'fhir-react/lib/utils/tests'; import { Encounter, Patient, Practitioner, PractitionerRole, Reference, Resource } from 'fhir/r4b'; import { saveFHIRResource as aidboxSaveFHIRResource } from 'aidbox-react/lib/services/fhir'; @@ -23,6 +16,14 @@ import { import { formatFHIRDateTime } from 'aidbox-react/lib/utils/date'; import { withRootAccess, LoginService, getToken } from 'aidbox-react/lib/utils/tests'; +import { createFHIRResource, getReference, saveFHIRResource } from 'fhir-react/lib/services/fhir'; +import { + resetInstanceToken as resetFHIRInstanceToken, + setInstanceBaseURL as setFHIRInstanceBaseURL, + setInstanceToken as setFHIRInstanceToken, +} from 'fhir-react/lib/services/instance'; +import { ensure } from 'fhir-react/lib/utils/tests'; + import { User } from 'shared/src/contrib/aidbox'; import { login as loginService } from 'src/services/auth'; diff --git a/src/sharedState/index.ts b/src/sharedState/index.ts index 226a15d1..8b87dc4c 100644 --- a/src/sharedState/index.ts +++ b/src/sharedState/index.ts @@ -1,6 +1,7 @@ +import { Patient, Practitioner } from 'fhir/r4b'; + import { createSharedState } from 'fhir-react/lib/hooks/shared-state'; import { WithId } from 'fhir-react/lib/services/fhir'; -import { Patient, Practitioner } from 'fhir/r4b'; import { User } from 'shared/src/contrib/aidbox'; diff --git a/src/styles/theme/palette.ts b/src/styles/theme/palette.ts index 414e5339..cb8a301e 100644 --- a/src/styles/theme/palette.ts +++ b/src/styles/theme/palette.ts @@ -11,9 +11,9 @@ function getColorVariable(colorVariable: string) { } const brandColors = { - primary: (getColorVariable('--color-primary') || ANTDColors.blue.primary) as string, - secondary: (getColorVariable('--color-secondary') || ANTDColors.red.primary) as string, - background: (getColorVariable('--color-background') || ANTDColors.blue[0]) as string, + primary: getColorVariable('--color-primary') as string || '#0170B9', + secondary: getColorVariable('--color-secondary') as string || '#CF2E2E', + background: getColorVariable('--color-background') as string || '#FAFCFF', }; const semanticColors = { diff --git a/src/utils/date.ts b/src/utils/date.ts index 018b2cd3..06962455 100644 --- a/src/utils/date.ts +++ b/src/utils/date.ts @@ -5,10 +5,11 @@ import { format, parseISO, } from 'date-fns'; -import { parseFHIRDateTime } from 'fhir-react/lib/utils/date'; import { Period } from 'fhir/r4b'; import _ from 'lodash'; +import { parseFHIRDateTime } from 'fhir-react/lib/utils/date'; + const DATE_TIME_FORMAT = 'dd/MM/yyyy HH:mm'; const DATE_FORMAT = 'dd/MM/yyyy'; const TIME_FORMAT = 'hh:mm'; diff --git a/src/utils/questionnaire.ts b/src/utils/questionnaire.ts index 95c6d498..7f94dfc5 100644 --- a/src/utils/questionnaire.ts +++ b/src/utils/questionnaire.ts @@ -1,3 +1,4 @@ +import { t } from '@lingui/macro'; import * as yup from 'yup'; import { @@ -38,6 +39,14 @@ export function getDisplay(value?: QuestionnaireResponseItemAnswerValue): string return value.integer; } + if (value.decimal) { + return value.decimal; + } + + if (value.boolean) { + return value.boolean ? t`Yes` : t`No`; + } + if (value.Reference && value.Reference.display) { return value.Reference.display; } diff --git a/src/utils/role.ts b/src/utils/role.ts index a7d1a362..7206b137 100644 --- a/src/utils/role.ts +++ b/src/utils/role.ts @@ -1,5 +1,5 @@ -import { WithId } from 'fhir-react'; import { Patient as PatientResource, Practitioner } from 'fhir/r4b'; +import { WithId } from 'fhir-react'; import { User } from 'shared/src/contrib/aidbox';