From 598a44b4447b3d129caef1ec985f68562cac0f83 Mon Sep 17 00:00:00 2001 From: Joyce Quach Date: Tue, 2 Apr 2024 18:04:13 -0400 Subject: [PATCH] Fix typos and remove unused imports while updating VS Code Workspace spell check ignore list --- index.html | 2 +- src/components/App.jsx | 2 +- src/components/Dashboard/Dashboard.jsx | 2 +- src/components/Dashboard/FormElement.jsx | 2 +- .../Dashboard/ListSelections/EmptySection.jsx | 2 +- .../ListSelections/MedicationsSection.jsx | 4 +--- .../ListSelections/PatientTaskSection.jsx | 2 +- src/components/DisplayBox/displayBox.css | 9 +++++---- .../InProgressFormBox/InProgressFormBox.jsx | 3 +-- .../InProgressFormBoxStyle.css | 14 +++++++------- .../PatientSearchBar/PatientSearchBar.jsx | 14 +++++++------- src/components/RequestBox/RequestBox.jsx | 6 +++--- src/components/RequestDashboard/Home.jsx | 12 ++++-------- .../RequestDashboard/PatientSection.jsx | 5 ++--- .../RequestDashboard/TasksSection.jsx | 7 +++---- src/components/RequestDashboard/styles.jsx | 2 +- src/components/SMARTBox/EHRLaunchBox.jsx | 1 - src/components/SMARTBox/PatientBox.jsx | 12 ++++++------ src/containers/Gateway/Gateway.jsx | 12 ++---------- src/containers/Gateway/styles.jsx | 2 +- src/containers/Index.jsx | 5 ++--- src/containers/Launch.jsx | 3 +-- src/containers/PatientPortal.jsx | 2 +- src/containers/RequestBuilder.jsx | 14 ++++---------- src/containers/register/RegisterPage.jsx | 2 +- src/containers/styles/theme.jsx | 4 ++-- src/index.css | 3 --- src/index.jsx | 1 - src/util/auth.js | 2 +- src/util/fhir.js | 19 ------------------- 30 files changed, 61 insertions(+), 109 deletions(-) diff --git a/index.html b/index.html index dd8f4ce7..7a5b4493 100644 --- a/index.html +++ b/index.html @@ -35,7 +35,7 @@ This HTML file is a template. If you open it directly in the browser, you will see an empty page. - You can add webfonts, meta tags, or analytics to this file. + You can add web fonts, meta tags, or analytics to this file. The build step will place the bundled scripts into the tag. To begin the development, run `npm start` or `yarn start`. diff --git a/src/components/App.jsx b/src/components/App.jsx index 6415e703..f26f03dc 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -14,7 +14,7 @@ const isGhPages = process.env.VITE_GH_PAGES === 'true'; const Router = isGhPages ? HashRouter : BrowserRouter; const redirect = isGhPages ? '/request-generator/#/index' : '/index'; const App = () => { - const [state, dispatch] = React.useContext(SettingsContext); + const [, dispatch] = React.useContext(SettingsContext); useEffect(() => { dispatch({ type: actionTypes.updateSetting, diff --git a/src/components/Dashboard/Dashboard.jsx b/src/components/Dashboard/Dashboard.jsx index 8d7d43c1..05f626a9 100644 --- a/src/components/Dashboard/Dashboard.jsx +++ b/src/components/Dashboard/Dashboard.jsx @@ -1,4 +1,4 @@ -import React, { memo, useState, useEffect } from 'react'; +import { memo, useState, useEffect } from 'react'; import useStyles from './styles'; import Box from '@mui/material/Box'; import Drawer from '@mui/material/Drawer'; diff --git a/src/components/Dashboard/FormElement.jsx b/src/components/Dashboard/FormElement.jsx index e72f0257..660b0f32 100644 --- a/src/components/Dashboard/FormElement.jsx +++ b/src/components/Dashboard/FormElement.jsx @@ -1,4 +1,4 @@ -import React, { memo } from 'react'; +import { memo } from 'react'; import { retrieveLaunchContext } from '../../util/util'; import { Paper } from '@mui/material'; import useStyles from './styles.jsx'; diff --git a/src/components/Dashboard/ListSelections/EmptySection.jsx b/src/components/Dashboard/ListSelections/EmptySection.jsx index b9dd66ca..64cd4c20 100644 --- a/src/components/Dashboard/ListSelections/EmptySection.jsx +++ b/src/components/Dashboard/ListSelections/EmptySection.jsx @@ -1,4 +1,4 @@ -import React, { memo } from 'react'; +import { memo } from 'react'; import useStyles from '../styles'; const EmptySection = () => { diff --git a/src/components/Dashboard/ListSelections/MedicationsSection.jsx b/src/components/Dashboard/ListSelections/MedicationsSection.jsx index 146b72fe..e80e1ab2 100644 --- a/src/components/Dashboard/ListSelections/MedicationsSection.jsx +++ b/src/components/Dashboard/ListSelections/MedicationsSection.jsx @@ -1,9 +1,7 @@ -import React, { memo, useState, useEffect } from 'react'; +import { memo, useState, useEffect } from 'react'; import { Paper, Typography } from '@mui/material'; -import FormControlLabel from '@mui/material/FormControlLabel'; import useStyles from '../styles'; import { MedicationStatus } from '../../MedicationStatus/MedicationStatus'; -import axios from 'axios'; const MedicationsSection = props => { const classes = useStyles(); diff --git a/src/components/Dashboard/ListSelections/PatientTaskSection.jsx b/src/components/Dashboard/ListSelections/PatientTaskSection.jsx index 6448edc6..029adfc0 100644 --- a/src/components/Dashboard/ListSelections/PatientTaskSection.jsx +++ b/src/components/Dashboard/ListSelections/PatientTaskSection.jsx @@ -1,4 +1,4 @@ -import React, { memo, useState, useEffect, Fragment } from 'react'; +import { memo } from 'react'; import useStyles from '../styles'; import TasksSection from '../../RequestDashboard/TasksSection'; diff --git a/src/components/DisplayBox/displayBox.css b/src/components/DisplayBox/displayBox.css index 52c69297..35713134 100644 --- a/src/components/DisplayBox/displayBox.css +++ b/src/components/DisplayBox/displayBox.css @@ -1,4 +1,5 @@ -td, th{ - padding:0px 4px; - border:1px solid; -} \ No newline at end of file +td, +th { + padding: 0px 4px; + border: 1px solid; +} diff --git a/src/components/RequestBox/InProgressFormBox/InProgressFormBox.jsx b/src/components/RequestBox/InProgressFormBox/InProgressFormBox.jsx index 53aa8341..0255144d 100644 --- a/src/components/RequestBox/InProgressFormBox/InProgressFormBox.jsx +++ b/src/components/RequestBox/InProgressFormBox/InProgressFormBox.jsx @@ -1,10 +1,9 @@ import { Box, Button, Typography, ButtonGroup } from '@mui/material'; -import React from 'react'; import './InProgressFormBoxStyle.css'; const InProgressFormBox = props => { return props.qrResponse?.questionnaire ? ( - + In Progress Form diff --git a/src/components/RequestBox/InProgressFormBox/InProgressFormBoxStyle.css b/src/components/RequestBox/InProgressFormBox/InProgressFormBoxStyle.css index ceea9016..b41e79cc 100644 --- a/src/components/RequestBox/InProgressFormBox/InProgressFormBoxStyle.css +++ b/src/components/RequestBox/InProgressFormBox/InProgressFormBoxStyle.css @@ -1,7 +1,7 @@ -.inprogress-container { - background-color:#f8f8f8; - border: 1px solid black; - border-radius: 5px; - padding:20px; - margin:20px 0 20px 0; -} \ No newline at end of file +.in-progress-container { + background-color: #f8f8f8; + border: 1px solid black; + border-radius: 5px; + padding: 20px; + margin: 20px 0 20px 0; +} diff --git a/src/components/RequestBox/PatientSearchBar/PatientSearchBar.jsx b/src/components/RequestBox/PatientSearchBar/PatientSearchBar.jsx index cf9b0987..37a1d88d 100644 --- a/src/components/RequestBox/PatientSearchBar/PatientSearchBar.jsx +++ b/src/components/RequestBox/PatientSearchBar/PatientSearchBar.jsx @@ -1,5 +1,5 @@ import { Autocomplete, Box, TextField, IconButton } from '@mui/material'; -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import { PrefetchTemplate } from '../../../PrefetchTemplate'; import { defaultValues } from '../../../util/data'; @@ -26,12 +26,12 @@ const PatientSearchBar = props => { return ''; } - function getFilteredLength(searchstring, listOfPatients) { + function getFilteredLength(searchString, listOfPatients) { const filteredListOfPatients = listOfPatients[0].filter(element => { - if (searchstring === '') { + if (searchString === '') { return element; } else { - return element.name.toLowerCase().includes(searchstring); + return element.name.toLowerCase().includes(searchString); } }); @@ -63,12 +63,12 @@ const PatientSearchBar = props => { ); } - function displayFilteredPatientList(searchstring, listOfPatients) { + function displayFilteredPatientList(searchString, listOfPatients) { const filteredListOfPatients = listOfPatients.filter(element => { - if (searchstring === '') { + if (searchString === '') { return element; } else { - return element.name.toLowerCase().includes(searchstring); + return element.name.toLowerCase().includes(searchString); } }); return ( diff --git a/src/components/RequestBox/RequestBox.jsx b/src/components/RequestBox/RequestBox.jsx index 2adb9927..4765b337 100644 --- a/src/components/RequestBox/RequestBox.jsx +++ b/src/components/RequestBox/RequestBox.jsx @@ -1,6 +1,6 @@ import { Button, ButtonGroup, Grid } from '@mui/material'; import _ from 'lodash'; -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import buildNewRxRequest from '../../util/buildScript.2017071.js'; import MuiAlert from '@mui/material/Alert'; import Snackbar from '@mui/material/Snackbar'; @@ -54,7 +54,7 @@ const RequestBox = props => { submitInfo(prepPrefetch(), null, patient, 'patient-view'); }; - const submitOrderSelect = () => { + const _submitOrderSelect = () => { if (!_.isEmpty(request)) { submitInfo(prepPrefetch(), request, patient, 'order-select'); } @@ -240,7 +240,7 @@ const RequestBox = props => { }, body: serializer.serializeToString(newRx) }) - .then(response => { + .then(() => { console.log('Successfully sent NewRx to PIMS'); // create the MedicationDispense diff --git a/src/components/RequestDashboard/Home.jsx b/src/components/RequestDashboard/Home.jsx index a1b0a231..788cacd7 100644 --- a/src/components/RequestDashboard/Home.jsx +++ b/src/components/RequestDashboard/Home.jsx @@ -1,4 +1,4 @@ -import React, { memo, useState } from 'react'; +import { memo, useState } from 'react'; import { Button, Grid, Tooltip } from '@mui/material'; import PersonIcon from '@mui/icons-material/Person'; import AssignmentIcon from '@mui/icons-material/Assignment'; @@ -6,7 +6,6 @@ import SettingsIcon from '@mui/icons-material/Settings'; import useStyles from './styles'; import PatientSection from './PatientSection'; -import { SettingsContext } from '../../containers/ContextProvider/SettingsProvider'; import SettingsSection from './SettingsSection'; import TasksSection from './TasksSection'; @@ -16,7 +15,6 @@ const Home = props => { const taskButton = 'View Tasks'; const settingsButton = 'Settings'; const [section, setSection] = useState(''); - const [state, dispatch] = React.useContext(SettingsContext); const openSection = buttonId => { setSection(buttonId); @@ -79,12 +77,10 @@ const Home = props => { // render content of each view, makes other content invisible so it doesn't rerender every time const renderSectionView = () => { - let renderSection =
Loading...
; - if (section) { - let patientRenderClass = section === patientButton ? '' : classes.disappear; - let taskRenderClass = section === taskButton ? '' : classes.disappear; - let settingsRenderClass = section === settingsButton ? '' : classes.disappear; + const patientRenderClass = section === patientButton ? '' : classes.disappear; + const taskRenderClass = section === taskButton ? '' : classes.disappear; + const settingsRenderClass = section === settingsButton ? '' : classes.disappear; return (
diff --git a/src/components/RequestDashboard/PatientSection.jsx b/src/components/RequestDashboard/PatientSection.jsx index d407de2b..21512725 100644 --- a/src/components/RequestDashboard/PatientSection.jsx +++ b/src/components/RequestDashboard/PatientSection.jsx @@ -1,11 +1,10 @@ -import React, { memo } from 'react'; +import { memo, useContext } from 'react'; -import useStyles from './styles'; import RequestBuilder from '../../containers/RequestBuilder'; import { SettingsContext } from '../../containers/ContextProvider/SettingsProvider'; const PatientSection = props => { - const [state, dispatch] = React.useContext(SettingsContext); + const [state, dispatch] = useContext(SettingsContext); return (
{state.startup ? ( diff --git a/src/components/RequestDashboard/TasksSection.jsx b/src/components/RequestDashboard/TasksSection.jsx index 8df63d86..317a4375 100644 --- a/src/components/RequestDashboard/TasksSection.jsx +++ b/src/components/RequestDashboard/TasksSection.jsx @@ -40,7 +40,7 @@ const taskStatus = Object.freeze({ const TasksSection = props => { const classes = useStyles(); const [tasks, setTasks] = useState([]); - const [state, dispatch] = React.useContext(SettingsContext); + const [state] = React.useContext(SettingsContext); const [value, setValue] = useState(0); const [open, setOpen] = useState(false); const [taskToDelete, setTaskToDelete] = useState(''); @@ -191,7 +191,7 @@ const TasksSection = props => { retrieveLaunchContext(smartLink, patient, props.client.state).then(result => { updateTaskStatus(lTask, 'in-progress'); lTask.status = 'in-progress'; - props.client.update(washTask(lTask)).then(e => { + props.client.update(washTask(lTask)).then(_e => { fetchTasks(); }); window.open(result.url, '_blank'); @@ -416,8 +416,7 @@ const TasksSection = props => { const renderPortalView = () => { const patientTasks = tasks.filter(t => t.owner?.id === state.patient?.id); - - return <>{renderTasks(patientTasks)}; + return renderTasks(patientTasks); }; return ( diff --git a/src/components/RequestDashboard/styles.jsx b/src/components/RequestDashboard/styles.jsx index 00c52a63..4a85cf57 100644 --- a/src/components/RequestDashboard/styles.jsx +++ b/src/components/RequestDashboard/styles.jsx @@ -1,6 +1,6 @@ import { makeStyles } from '@mui/styles'; export default makeStyles( - theme => ({ + () => ({ disappear: { display: 'none' }, diff --git a/src/components/SMARTBox/EHRLaunchBox.jsx b/src/components/SMARTBox/EHRLaunchBox.jsx index c23751f3..7f22b8d2 100644 --- a/src/components/SMARTBox/EHRLaunchBox.jsx +++ b/src/components/SMARTBox/EHRLaunchBox.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import './smart.css'; import env from 'env-var'; diff --git a/src/components/SMARTBox/PatientBox.jsx b/src/components/SMARTBox/PatientBox.jsx index fea2e08c..d2007355 100644 --- a/src/components/SMARTBox/PatientBox.jsx +++ b/src/components/SMARTBox/PatientBox.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import { getAge, getDrugCodeFromMedicationRequest } from '../../util/fhir'; import './smart.css'; import { Button } from '@mui/material'; @@ -30,7 +30,7 @@ const PatientBox = props => { numInProgressForms: 0, name: 'N/A', fullName: 'N/A', - formatBirthdate: '', + formatBirthDate: '', options: [], responseOptions: [] }); @@ -495,12 +495,12 @@ const PatientBox = props => { ); }; - const makeQuestionnaireTable = (columns, options, type, patient) => { + const makeQuestionnaireTable = (columns, options, type, _patient) => { return ( @@ -548,7 +548,7 @@ const PatientBox = props => { if (patient.birthDate) { setState(prevState => ({ ...prevState, - formatBirthdate: new Date(patient.birthDate).toDateString() + formatBirthDate: new Date(patient.birthDate).toDateString() })); } }; @@ -568,7 +568,7 @@ const PatientBox = props => { {patient.gender.charAt(0).toUpperCase() + patient.gender.slice(1)}
- DoB/Age: {state.formatBirthdate} ( + DoB/Age: {state.formatBirthDate} ( {getAge(patient.birthDate)} years old)
diff --git a/src/containers/Gateway/Gateway.jsx b/src/containers/Gateway/Gateway.jsx index b09da650..53a6e967 100644 --- a/src/containers/Gateway/Gateway.jsx +++ b/src/containers/Gateway/Gateway.jsx @@ -1,15 +1,7 @@ -import React, { memo, useState, useEffect } from 'react'; +import { memo, useState } from 'react'; import FHIR from 'fhirclient'; import env from 'env-var'; -import { - Button, - FormControl, - FormHelperText, - IconButton, - TextField, - Accordion, - AccordionDetails -} from '@mui/material'; +import { Button, FormControl, TextField } from '@mui/material'; import Stack from '@mui/material/Stack'; import Autocomplete from '@mui/material/Autocomplete'; import useStyles from './styles'; diff --git a/src/containers/Gateway/styles.jsx b/src/containers/Gateway/styles.jsx index ae2b96db..22453bf8 100644 --- a/src/containers/Gateway/styles.jsx +++ b/src/containers/Gateway/styles.jsx @@ -1,6 +1,6 @@ import { makeStyles } from '@mui/styles'; export default makeStyles( - theme => ({ + () => ({ '@global': { body: { backgroundColor: '#fafafa' diff --git a/src/containers/Index.jsx b/src/containers/Index.jsx index 0bf71379..a94b327f 100644 --- a/src/containers/Index.jsx +++ b/src/containers/Index.jsx @@ -1,9 +1,8 @@ -import React, { useState, useEffect } from 'react'; +import { useState, useEffect } from 'react'; import FHIR from 'fhirclient'; -import env from 'env-var'; import Home from '../components/RequestDashboard/Home'; -const Index = props => { +const Index = () => { const [client, setClient] = useState(null); useEffect(() => { diff --git a/src/containers/Launch.jsx b/src/containers/Launch.jsx index 1de90a7e..5e8db748 100644 --- a/src/containers/Launch.jsx +++ b/src/containers/Launch.jsx @@ -1,7 +1,7 @@ import env from 'env-var'; import queryString from 'querystring'; import FHIR from 'fhirclient'; -import React, { memo, useEffect, useState } from 'react'; +import { memo, useEffect, useState } from 'react'; import RegisterPage from './register/RegisterPage'; const Launch = props => { @@ -25,7 +25,6 @@ const Launch = props => { localStorage.setItem('clients', JSON.stringify(clients)); } } - const urlSearchString = window.location.search; const params = queryString.parse((window.location.hash || '').replace(/\/?#\/?launch\?/, '')); const iss = params.iss; console.log('iss: ' + iss); diff --git a/src/containers/PatientPortal.jsx b/src/containers/PatientPortal.jsx index 131ba6e1..e940d56e 100644 --- a/src/containers/PatientPortal.jsx +++ b/src/containers/PatientPortal.jsx @@ -16,7 +16,7 @@ const PatientPortal = () => { const [token, setToken] = useState(null); const [client, setClient] = useState(null); const [patientName, setPatientName] = useState(null); - const [state, dispatch] = React.useContext(SettingsContext); + const [, dispatch] = React.useContext(SettingsContext); useEffect(() => { if (token) { diff --git a/src/containers/RequestBuilder.jsx b/src/containers/RequestBuilder.jsx index 1d41e01e..60bdb5a8 100644 --- a/src/containers/RequestBuilder.jsx +++ b/src/containers/RequestBuilder.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import { useContext, useState, useEffect } from 'react'; import { Button, Box, Grid, IconButton } from '@mui/material'; import PersonIcon from '@mui/icons-material/Person'; import RefreshIcon from '@mui/icons-material/Refresh'; @@ -24,7 +24,7 @@ import { SettingsContext } from './ContextProvider/SettingsProvider.jsx'; const RequestBuilder = props => { const { client } = props; - const [globalState, dispatch] = React.useContext(SettingsContext); + const [globalState, dispatch] = useContext(SettingsContext); const [state, setState] = useState({ loading: false, patient: {}, @@ -40,7 +40,7 @@ const RequestBuilder = props => { token: null, client: client, medicationDispense: null, - lastCheckedMedicationTime: null, + lastCheckedMedicationTime: null }); const displayRequestBox = !!globalState.patient?.id; @@ -48,7 +48,6 @@ const RequestBuilder = props => { return Object.keys(state.request).length === 0; }; - const disableGetMedicationStatus = isOrderNotSelected() || state.loading; const disableGetEtasu = isOrderNotSelected() || state.loading; const getMedicationStatus = () => { @@ -71,8 +70,6 @@ const RequestBuilder = props => { ); }; - - useEffect(() => { if (state.client) { // Call patients on load of page @@ -304,10 +301,7 @@ const RequestBuilder = props => { {!disableGetEtasu && ( - + )} {!disableGetMedicationStatus && ( diff --git a/src/containers/register/RegisterPage.jsx b/src/containers/register/RegisterPage.jsx index a38d4327..95d7469e 100644 --- a/src/containers/register/RegisterPage.jsx +++ b/src/containers/register/RegisterPage.jsx @@ -10,7 +10,7 @@ import { TextField, Typography } from '@mui/material'; -import React, { useState } from 'react'; +import { useState } from 'react'; import './RegisterPageStyle.css'; export default function RegisterPage(props) { diff --git a/src/containers/styles/theme.jsx b/src/containers/styles/theme.jsx index 00c1c359..0c82b2fd 100644 --- a/src/containers/styles/theme.jsx +++ b/src/containers/styles/theme.jsx @@ -23,8 +23,8 @@ const colors = { green: '#2fa874', maroon: '#a83048', purple: '#8b72d6', - turqoise: '#37c0ae', - turqoiseLight: '#e6f7f5' + turquoise: '#37c0ae', + turquoiseLight: '#e6f7f5' }; const paletteBase = { diff --git a/src/index.css b/src/index.css index 5c0b331e..caf53ce6 100644 --- a/src/index.css +++ b/src/index.css @@ -148,12 +148,10 @@ input:not(:focus):not([value='']):valid ~ .floating-label { margin-left: 5px; } .onOff { - /* border-color: #E34531; */ border-color: #c5c5c5; } .onOffActive { - /* border-color: #5CB85C; */ border-color: #222222; } @@ -177,7 +175,6 @@ input:not(:focus):not([value='']):valid ~ .floating-label { opacity: 1; } .invisible { - /* display:none; */ opacity: 0; } .spinner { diff --git a/src/index.jsx b/src/index.jsx index 2eea30c3..491a9220 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './components/App'; diff --git a/src/util/auth.js b/src/util/auth.js index 7ba6007b..6c2df049 100644 --- a/src/util/auth.js +++ b/src/util/auth.js @@ -1,5 +1,5 @@ import privKey from '../keys/crdPrivateKey.js'; -import KJUR, { KEYUTIL } from 'jsrsasign'; +import KJUR from 'jsrsasign'; import { v4 as uuidv4 } from 'uuid'; import env from 'env-var'; diff --git a/src/util/fhir.js b/src/util/fhir.js index 3fdcb31d..7c4a1c37 100644 --- a/src/util/fhir.js +++ b/src/util/fhir.js @@ -1,21 +1,3 @@ -function fhir(resource, ehrUrl, patient, auth) { - const headers = { - 'Content-Type': 'application/json' - }; - if (patient) { - fetch(`${ehrUrl}${resource}?subject=Patient/${patient}`, { - method: 'GET', - headers: headers - }) - .then(response => { - return response.json(); - }) - .then(json => { - console.log(json); - }); - } -} - function getAge(dateString) { var today = new Date(); var birthDate = new Date(dateString); @@ -91,7 +73,6 @@ function createMedicationFromMedicationRequest(medicationRequest) { } export { - fhir, getAge, getDrugCodeableConceptFromMedicationRequest, getDrugCodeFromMedicationRequest,