-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Closes #169] Generate patient fields from metadata shared between se…
…rver and client (#185) * Create Metadata class to store field metadata Move patient field setup into metadata/patient.js. * Move metadata into src/metadata CRA annoyingly refuses to import anything from outside that folder. * Add getters/setters to Ringdown based on field metadata from patient Also generate PropTypes from field metadata. Use a shared DeliveryStatus in Ringdown.js instead of defining a copy. Move deliveryStatus.js to src/constants/DeliveryStatus.js. Rename Metadata.js to ModelMetadata.js. Add FieldMetadata.js and convertToSequelizeField.js. * Prettier nonsense * Add new fields to patient metadata Add PatientFields and Ringdown changes from 169-ems-update-form branch. Fix default value for status indicator. * Add migration for new fields in patient database Pass table and model names to ModelMetadata constructor. * Tweak names in migration Pass the type instead of the whole field object. Prettier and eslint nonsense. * Refactor ModelMetadata Use getFieldHash() for getting the prop types as well, passing in convertToPropType. * Fix server tests to handle new fields * Add ranges to fields in metadata/patient.js * Create Form component to provide context to fields Provide ringdown data and onChange handler to form fields via the Form context. Create Field component to generate checkboxes, numeric inputs, and text areas based on the metadata type. Add label and unit strings to the patient metadata. Tweak restraint label. * Move Field component into FormField.js Add form to wrap children and receive props in Form component. Remove unnecessary fragment wrapper on PatientFields. Fix degree symbol on temp. * Add propTypes to Form.js Update prettier to 2.7.1. Force Prettier to ignore parts of some files and allow it uglify others. * Clean up after rebasing on master * Fix wrapping in O2 label and field Make "optional" align right in the Header elemens by removing an extra div. * Move Urgency field up into Incident info section Refactor and simplify creation of validationData in Ringdown.js. Update section labels in ringdown form. Fix Form.children prop type. * Add patientDelivery metadata In ModelMetadata, always add the created and updated fields to the model, so they don't have to get included over and over. * Add metadata for ambulance, emergencyMedicalServiceCall, and emergencyMedicalServiceCallAmbulance * Make sure defaultValue included in Sequelize attributes, fix tests for new defaultValue default for booleans * Add metadata for hospital * Add metadata for hospitalUser * Add metadata for organization and patientDeliveryUpdate * Add metadata for user Add support in convertToSequelizeField() for sequelize getters/setters, validate key and virtual type fields. * Add defaultValue for timezone in organization to fix tests Simplify convertToSequelizeField. * Unify enumValues and virtualArgs as typeArgs * Refactor ands simplify ModelMetadata Add toString method to FieldMetadata. * Move metadata and constants into /src/shared * Move shared classes and utils to /src/shared * Create payload sub-objects and defaults programmatically Add metadata/index.js. Change createValidationData() to setValidationData(),. Get rid of ambulance and emsCall getters defined in class. * Set defaultValue to '' for fields used in comboboxes * Add the field getters/setters to the Ringdown prototype Don't add them to every instance individually. * Make migration a static standalone script * Include treatmentNotes and glasgowComaScale fields in ringdown details Co-authored-by: Francis Li <[email protected]>
- Loading branch information
1 parent
808062e
commit 684de07
Showing
47 changed files
with
1,421 additions
and
1,436 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
migrations/20220721055200-add-gcs-treatments-to-patient.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
async up(queryInterface, Sequelize) { | ||
await queryInterface.sequelize.transaction(async (transaction) => { | ||
await queryInterface.addColumn('patient', 'treatmentnotes', Sequelize.TEXT, { transaction }); | ||
await queryInterface.addColumn('patient', 'glasgowcomascale', Sequelize.INTEGER, { transaction }); | ||
}); | ||
}, | ||
|
||
async down(queryInterface) { | ||
await queryInterface.sequelize.transaction(async (transaction) => { | ||
await queryInterface.removeColumn('patient', 'glasgowcomascale', { transaction }); | ||
await queryInterface.removeColumn('patient', 'treatmentnotes', { transaction }); | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.