# Instance-Based Learning Following Physician Reasoning for Assistance during Medical Consultation
## 5 Medical Consultation Flows
### Selecting an Already Defined Case Type
```
1:There is no CT\({}^{M}\) selected by physician
2:CT\({}^{M}_{new}\leftarrow\)\(<\)\"new-name\", \(\emptyset\), false, \(\emptyset>\) is created automatically
3:Physician creates new units UTs\({}_{new}\) and new elements CEs\({}_{new}\)
4:Physician defines sections, by using UTs\({}_{new}\) and CEs\({}_{new}\) or pre-defined
5:secTypes \(\leftarrow\)ALL-SECTION-TYPES
6:newComponents \(\leftarrow\)\(\emptyset\)
7:forsecType\({}_{i}\)in secTypes do
8: activeElems\({}_{i}\leftarrow\) [elementName, activeDescriptor] pairs in section\({}_{i}\)
9: CC\({}_{new_{i}}\leftarrow\)\(<\) maxCCId() + 1, secType\({}_{i}\), activeElems\({}_{i}>\)
10: newComponents \(\leftarrow\) newComponents \(\bigcup\) [CC\({}_{new}\)]
11:endfor
12:Physician assigns a unique name to attribute \(name\) of CT\({}^{M}_{new}\)
13:Physician can mark CT\({}^{M}_{new}\) as chronic
14:ifCT\({}^{M}_{new}\) is marked as chronic then
15:forelem in CEs\({}_{new}\)do
16: Physician needs to specify the value of elem_chron
17:endfor
18:CT\({}^{M}_{new}\leftarrow\)\(<\)name, newComponents, true, \(\emptyset>\)
19:else
20:CT\({}^{M}_{new}\leftarrow\)\(<\)name, newComponents, false, \(\emptyset>\)
21:endif
22:personalInfo \(\leftarrow\) getUqptUnits(CT\({}^{M}_{new}\))
23:PpersonalData.add(personalInfo)
24:CT\({}^{M}_{new}\leftarrow\) removeUqptUnits(CT\({}^{M}_{new}\))
25:mr\({}^{p}_{t}\leftarrow\) T\({}^{*}\)(CT\({}^{M}_{new}\))
26:MR\({}^{p}\leftarrow\) MR\({}^{p}\bigcup\) {mr\({}^{p}_{t}\)}
27:chronElements \(\leftarrow\) getAllActiveChonicElementsInludedIn(CT\({}^{M}_{new}\))
28:P.chronicElems.add(chronElems)
29:ifiSchronic(CT\({}^{M}_{new}\))then
30: P.chronicCaseTypes.add(CT\({}^{M}_{new}\)-name)
31:endif
32:CT\({}^{M}_{new}\leftarrow\) removeUqcnUnits(CT\({}^{M}_{new}\))
33:CR\({}^{M}\leftarrow\) CRB\({}^{M}\bigcup\) [CT\({}^{M}_{new}\)] the base is incremented
```
**Algorithm 6** New case type flow for the attention of patient \(P\)

### Temporal Case Type Flow

By applying a temporal case type, the history of patient \(P\) is updated, and the \(MR^{P}\) set is incremented with a new patient medical record. However, there is no change in physician \(CKB^{M}\). Algorithm 7 details the use of a temporal case type. ```
1:CT\({}^{M}\leftarrow\) selectSimilarCT\(0\)
2:applyCaseType(P,CT\({}^{M}\)) is called
3:Physician M define CT\({}^{M}\) by modifying the selected CT\({}^{M}\)
4:Physician M marks CT\({}^{M}\) as a temporal case type
5:personalInfo \(\leftarrow\) getUptUnits(CT\({}^{M}\))
6:PersonalData.add(personalInfo)
7:CT\({}^{M}\leftarrow\) removeUptUnits(CT\({}^{M}\))
8:mr\({}^{P}_{l}\leftarrow\) T\({}^{*}\)(CT\({}^{M}\))
9:MR\({}^{P}\leftarrow\) MR\({}^{P}\bigcup\) {mr\({}^{P}_{l}\)}
10:chronElemts \(\leftarrow\) getAllActiveChonicElementsInludedIn(CT\({}^{M}\))
11:PchronicElems.add(chronElemts)
12:CT\({}^{M}\) is deleted
```
**Algorithm 7** Temporal case type flow for the attention of patient \(P\)

Algorithm 7 is triggered after the physician assigns a temporal mark over an applied and modified case type (lines 1-4). As any other case type, all units marked as unique to the patient are stored as personal data, and are removed from the temporal case type (lines 5-7). \(T^{*}\) transformation is also applied to create a new medical record (lines 8-9). Each chronic conceptual element referenced in the temporal case is permanently associated with the patient being evaluated (lines 10-11). The temporal case type is finally removed, since it is marked to be not re-used (line 12). ### Multiple Case Types Flow

A physician can use more than one case type as the basis during the same medical consultation. Several rules are used to combine all conceptual components of each case type involved. To combine conceptual components, their active conceptual elements are accurately merged. The merge process takes into account the active elements described in the usual components, and active elements described in chronic components. Algorithm 8 details the method used to merge different case types.