# Reorder Clinical Record Sections Project
## Section Selekta
### Places used:
1. Consult - public/modules/clinical/consult/_formExisting.php
* Standard view
* By Item
* By Group
* Combined view
2. Complete History - public/modules/clinical/consult/_formExisting.php
* Standard view
* Combined view
3. Contact
* Related Records - public/modules/contacts/contact/relatedRecords.php
### Config
The current config expects:
* SelektaClass:
* Options - Clinical, Combined
* Depends on screen Clinical record or Cobined view
* NoUpdate:
* Options - bool
* If true it will update the user config settings
* Groups:
* Ordered by order index (same order a written when entered)
* Each group contains:
* Title - Name
* SubGroups:
* Items in the group
* Contains jax call for the Section
### Conclusion
Section Selekta:
* Any Changes to Consults will be reflected in Complete History
* By group and by item view are couppled
* Use the same config
* Complete view and Standard view are not coupled
* Use seperate configs
What can be done:
* Reodering items within each group
* Groups can be renamed and customised
* Seperate reordering between Complete and Standard view
What can't be done:
* Reordering items outside of each group
* Seperate reordering between By Item and By Group view
### Places that use Clinical Record Odering
Order is determined by a list accessed by Consult::getFilterableSections() and Consult::getSortedFilterableSections()
Combined view
* Uses filterablesections then loops over to create sections
Admin > Clinical Settings
* filterablesections
Dashboard > My Dashboard
* uses getSortedFilterableSections
* Sub-Record dropdown uses list to display contents in dropdown
Dashboard > My Dashboard > New User task popup > Select yes
* uses getSortedFilterableSections
* Sub-Record dropdown uses list to display contents in dropdown
### Change flow on effects
Changing the order of the elements in Consult::getFilterableSections() will change:
* Combined view
* Clinical Settings
Consult::getSortedFilterableSections() does a alphabetical sort
* Will stay the same
### Conclusion
This functionality could easily be extracted or extended to account for the user reordering
### Using a dropdown in react
Poyua is in contact with Quickwinz to confirm they have made changes to the dropdown
* Have spoken to Jeff and we should be able to implement this easily
* Will need extended for double click to open record
* Wrap it in an event handler -> onDoubbleClick
### Saving the React Reorder Component in Framework
Jaime and Tim are working on a ticket with this currently - will update then
Convo with Jaime revealed two different approaches:
* Saving using controllers in framework:
* Pros:
* Less effort
* Cons
* Building redundancy
* Most functionality is already in framwork (confirm this)
* Bad practice to mix React and Framework
* Saving using the V3 api:
* Pros:
* Future proof
* Seperation of conerns
* Cons:
* More effort
* Rebuilding existing functionality
# Solutions
### Least work - 2 sprints
Only allow reordering between groups
* Pros:
* Very Quick
* Section Sekelta does not need to be altered
* Already an example on how to pass in and build a config (Combined view)
* Extend/Rebuild config order is simple
* Cons:
* Can not extend - if we want to to by item in the future all this work is wasted
* Will need to be rebuilt in future
* End up in a similar position to Wellness
* High chance of regressions
customisation of those groups would be minimal extra effort
### More work - 3 sprints
Allow reordering of by item and by group view
Majour Requirement - Rebuilding Section Selekta in React
By item phase one -> by group phase 2
* Pros:
* Reduced Regressions from Clinical
* Currently old code causing a lot
* Future proof
* Customer gets consistency between sections
* Group customisation isn't an afterthought
* Chaned / entended easily
* Cons:
* Rebuilding Section Selekta take time
* Need to factor in Contact - Related record screen
### Most Work - 3 sprints
Allowing reordering for by item, by group and combined view
Pros:
* Minimal extra work from option two
Cons:
* Adds clutter to admin
* Only reorder the button view so not much value
Breakdown