CodingIcd
CodingIcd is a plugin that regroups
- Icd10 (WHO and Canada)
- Icdo3 Topography
- Icdo3 Morphology
Because the codes themselves do not give any relevant information to the user, they are unhandy to search and display alone. Without the magic code, every controller using a CodingIcd would have to parse search parameters to cast words into ids and every detail/index display would have to fetch the description matching the id. Since CodingIcd is used through multiple functions and in multiple controllers, that would mean a lot of copy paste. We don't like to copy paste. That's where the magic comes in.
Search magic
When fetching data for a search query, the function StructuresComponent::parse_search_conditions() is called. That function has code to handle the CodingIcd case. It detects the CodingIcd with the field settings. It seeks a string that matches one the CodingIcd tool function. If found, it searches for the search parameters through every fields of the matching CodingIcd table in order to return the associated ids.
Index/View magic
In StructuresHelper::build_stack(), the structure is parsed and when CodingIcd fields are detected, based on the trigger, the definition is happened to the value.
Model import magic
Because some structures might be displayed without having the controller loading any CodingIcd model, it was necessary to add automated CodingIcd model import to avoid unexpected ATiM crashes related to the other CodingIcd magic. This automated import can be found at the end of StructuresComponent::get().