Clusters form
Synopsis
Form to test clusters of symptoms/diagnosis
Route URL
#/clusters
#/clusters/return/expert
Old form in legacy FMX application
cluster.pas in the old application.
GUI
- Top Left:
- Circle image (Name: imgSelectData). On Click: execute action SelectData
- text label (Name: lblSelectData): initial text "Full data"
-
Top middle: Label (name: "lblTitle") with text "KABISA Clusters"
-
3 columns: see below.
On form show, execute action Start
Column 1:
- label (name: lblSearchHint, text: "Type some letters for quick searching").
- grid (name: grdCandidateSymptoms), 1 column. On keypress: execute FilterSymptom action. On double click: execute action SelectSymptom. title (name: lblAvailableArguments) 'Available arguments'
- Label (name: lblSearchSymptom, initially empty).
- button (name: btnSelectSymptom, text: 'Select'). On click execute action SelectSymptom
- button (name: btnOK, text: 'OK'). On click execute action UndoAnimation, initially invisible and disabled.
Column 2:
- grid (name grdSelectedSymptoms), 1 columnseci
- button (name: btnDeleteSymptom, text: 'Remove item'). On click execute action RemoveSymptom
- button (name: btnRestart, text: 'Restart'). On click execute action Restart
Column 3:
- grid (name: grdDiagnose) 1 column
- On click/select row, execute action SelectDiagnose
- button (name: btnExit, text: 'Exit'). On click execute action Exit
Actions
Start
- Set variable Full to True.
- set variable searchterm to empty string.
- create empty array LinkedDiagnose of Diagnosis objects + Counter.
- create empty array CandidateDiagnose of Diagnosis objects (corresponds to old temp table diagnosid)
- create empty array SelectedSymptoms of symptom objects (corresponds to old listbox1 contents)
- create empty array CandidateSymptoms of symptom objects (corresponds to syno_id2)
- Continue with Restart action.
Restart
- Set lblSearchHint to visible
- if divSolution is visible, hide it.
- Show values from synonyms.Lang.name in grid 1, set data-symId to Symptom.id. The list of symptoms is selected depending on value of the Full variable:
- If full is True then all symptoms are shown
- If full is False then only symptoms where ttype<=3 are shown.
- Clear array CandidateDiagnose
- Clear array CandidateSymptoms
- Show all symptoms in grdCandidateSymptoms
- Clear grid grdDiagnose
- Clear grid grdSelectedSymptoms
- Revert both arrow images so they point to the left (west)
- Enable btnSelectSymptom
- Make btnOK invisible and disable it.
SelectData
- Toggle full from True to false or vice versa.
- Show full or half circle in imgSelectData
- Continue with Restart action.
SelectSymptom
- Set SelID to the selected Symptom.id in grdCandidateSymptoms (data-symId)
- Select all Association objects where symId equals the selID
- Set CntSelected to (number of elements in SelectedSymptoms + 1)
- Set CandidateDiagnose to the list of Diagnose objects that:
- Are linked to the selected symptoms
- Occur exactly CntSelected times.
- If the CandidateDiagnose list is not empty:
- Save CandidateSymptoms in tempSymptoms (old syno_id list)
- Create a list of symptom objects that:
- Is linked to a diagnose in CandidateDiagnose
- Is not equal to selID
- Is not part of the excludes list of Symptom SelId
- Is not part of implies list of Symptom SelID
- Is not yet part of the tempSymptoms list (this is the operation of the test6 stored procedure in the old program)
- Show the new list CandidateSymptoms in grdCandidateSymptoms
- Add symptom selID to SelectedSymptoms
- Show list SelectedSymptoms in grdSelectedSymptoms
- Show list CandidateDiagnose in grdDiagnose
- Reset the searchterm variable empty string.
FilterSymptom
- Add selected letter to search term searchterm
- Display search term in label lblSearchSymptom.
- In grdCandidateSymptoms only show records CandidateSymptoms for which the name (current language) matches the current searchterm. The items are first ordered by double key:
- position of search string match (i.e. pos(search,Symptom.name.LANG))
- Symptom.sortNR field.
- In grdCandidateSymptoms display highlighted in red all parts of words that match the current searchterm
RemoveSymptom
- Remove the selected symptom from the list of selected symptoms SelectedSymptoms
- Show list SelectedSymptoms in grdSelectedSymptoms
- Rebuild CandidateDiagnose as in action SelectSymptom.
SelectDiagnose
- Set SelectedDiagnoseID equal to selected diagnose ID from grid.
-
Construct a list with records with
- Association
- and connected Symptom objects that are connected to the selected diagnose:
- Association.diagId equals selected diagnose SelectedDiagnoseID
- Association.symId is not in list selectedSymptoms
- Association.conf.continent > 0 The list is sorted by descending Association.conf.continent
-
Revert both arrow images so they point to the left (west)
- Disable btnSelectSymptom
- Disable btnSelectSymptom
- Set label to 'available findings '+Diagnose name
- Create HTML element tblSolution with a list of symptoms as :
- a Bitmap from bitmapInfo (see lecture for how to determine the bitmap from the association record )
- the Symptom the element should be shown and follow an animated path: Start at grid grdDiagnose and follow a path from grid grdDiagnose till it covers grdCandidateSymptoms
- Make btnOK visible and enable it.
Exit
- if the incoming URL was
/clusters/return/expertnavigate to Navigate to /expert - if the incoming URL was
/clusters/, Navigate to /menu
UndoAnimation
- Undo effects of animation
- tblSolution invisible
- Arrows in right direction