{"id":1039,"date":"2019-02-15T14:43:25","date_gmt":"2019-02-15T13:43:25","guid":{"rendered":"http:\/\/davikingcode.com\/blog\/?p=1039"},"modified":"2019-02-18T09:52:27","modified_gmt":"2019-02-18T08:52:27","slug":"efficasthme-asthma-attack-simulator","status":"publish","type":"post","link":"https:\/\/davikingcode.com\/blog\/efficasthme-asthma-attack-simulator\/","title":{"rendered":"Effic&#8217;asthme &#8211; Asthma Attack Simulator"},"content":{"rendered":"<p><a href=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-Logo.png\"><img loading=\"lazy\" class=\"aligncenter wp-image-1043 size-large\" src=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-Logo-1024x411.png\" alt=\"\" width=\"660\" height=\"265\" srcset=\"https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-Logo-1024x411.png 1024w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-Logo-300x120.png 300w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-Logo-768x308.png 768w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><\/p>\n<p>During 9 month, we worked with DOWiNO and the Paris Descartes\u00a0University on a medical serious game.<br \/>\nEffic&#8217;asthme is available both on the Play store ( <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=fr.parisdescartes.efficasthme\">https:\/\/play.google.com\/store\/apps\/details?id=fr.parisdescartes.efficasthme<\/a> ) and the App store ( <a href=\"https:\/\/itunes.apple.com\/fr\/app\/efficasthme\/id1400814236?mt=8\">https:\/\/itunes.apple.com\/fr\/app\/efficasthme\/id1400814236?mt=8<\/a> ).<\/p>\n<p>The app targets parents of children suffering from asthma to help them face asthma attacks. The app is based on and supported by a thesis of a PhD student in health <em>David DRUMMOND. <\/em>(<a href=\"https:\/\/www.researchgate.net\/profile\/David_Drummond3\/publication\/326187302_Design_and_development_of_a_simulation_game_for_parents_of_preschool_children_with_asthma_an_evidence-based_approach_Conception_et_developpement_d%27un_simulation_game_pour_les_parents_d%27enfants_de_moin\/links\/5b3ce04eaca27207850d11e3\/Design-and-development-of-a-simulation-game-for-parents-of-preschool-children-with-asthma-an-evidence-based-approach-Conception-et-developpement-dun-simulation-game-pour-les-parents-denfants-de-moin.pdf\">Link to the thesis<\/a> &#8211; in French )<\/p>\n<p>Effic&#8217;asthme provides : a digital action planning to deal with asthma attacks, a small encyclopedia on asthma attacks, a diary, and a simulator with realistic medical behaviors and a screen debriefing the event.<\/p>\n<p>In the rest of the article, I will explain the most important parts of Effic&#8217;asthme : the simulator.<\/p>\n<p><!--more--><\/p>\n<h2><span id=\"result_box\" class=\"short_text\" lang=\"en\"><span class=\"\">Simulator<\/span><\/span> part<\/h2>\n<p><a href=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/IMG_0015.png\"><img loading=\"lazy\" class=\"alignnone wp-image-1044 size-large\" src=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/IMG_0015-1024x473.png\" alt=\"\" width=\"660\" height=\"305\" srcset=\"https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/IMG_0015-1024x473.png 1024w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/IMG_0015-300x139.png 300w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/IMG_0015-768x355.png 768w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/IMG_0015.png 2048w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><\/p>\n<p>The simulator combines 3 elements : a <strong>child&#8217;s medical state<\/strong>, a <strong>medical logic<\/strong> and a <strong>scenario manager<\/strong>.<\/p>\n<h4>Child state<\/h4>\n<p>The <strong>child state<\/strong> is obviously the state of the child in the simulator. It contain the medical status of the child (temperature, cough, abnormal breathing, &#8230;).<\/p>\n<p>At the beginning of the simulation, it is configured by the Scenario manager. After, it will be affected by the <strong>Medical logic<\/strong>, and in particular cases by the Scenario manager.<\/p>\n<p>The <strong>child state<\/strong> control the 3D character models (animation &amp; shader) to show the health information.<\/p>\n<h4>Scenario Manager<\/h4>\n<p>The <strong>scenario manager<\/strong> is the scenario part of the simulator. It initializes the simulation, gives a context, and can modify the simulation based on the scenario.<\/p>\n<p>A scenario is a ScriptableObject for persistence. The data structure of a scenario is represented below.<\/p>\n<p><a href=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-Scenario-Data.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1050\" src=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-Scenario-Data.png\" alt=\"\" width=\"374\" height=\"564\" srcset=\"https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-Scenario-Data.png 374w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-Scenario-Data-199x300.png 199w\" sizes=\"(max-width: 374px) 100vw, 374px\" \/><\/a><\/p>\n<p>This manager also records all actions and simulator events. It with this log the manager can know where we are on the scenario (<em>scenario steps<\/em><em>)<\/em>, and trigger modification on the simulation (<em>scenario action<\/em>).<\/p>\n<p>The manager and his log are the corner stone between the simulation and the debriefing.<\/p>\n<h4>Medical Logic<\/h4>\n<p>This part is relatively simple. One action is made, a consequence is apply and the event (action and his consequence) is record in the <strong>Scenario Manager<\/strong> log.<\/p>\n<p>The medical logic use the <strong>Child State <\/strong>and medical information of the child (weight, medical planning, &#8230;) to determine the consequence of a action. It can be <em>Good<\/em>, <em>No effect<\/em>, or <em>Bad. <\/em>The consequences are applies on the <strong>Child State<\/strong>.<\/p>\n<p>Some action, like medical spray, require more interaction than just clicking on a button. It&#8217;s also the medical logic (particularly a sub module for each medicine) which manage the manipulation system and send the manipulation events. By following the medical protocol and the user interaction (fingers movement, 3D trigger), the system can report the good and bad manipulations.<\/p>\n<p>You can see below a scheme of the simulator integration.<\/p>\n<p><a href=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Simulator-scheme-e1542879391487.png\"><img loading=\"lazy\" class=\"alignnone wp-image-1090 size-large\" src=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Simulator-scheme-e1542879391487-1024x479.png\" alt=\"\" width=\"660\" height=\"309\" srcset=\"https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Simulator-scheme-e1542879391487-1024x479.png 1024w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Simulator-scheme-e1542879391487-300x140.png 300w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Simulator-scheme-e1542879391487-768x359.png 768w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Simulator-scheme-e1542879391487.png 1718w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><\/p>\n<p>When the user wish to stop or the scenario stop the simulation (<em>Time out<\/em><em>)<\/em>, the simulator close and the debriefing start.<\/p>\n<h2>Debriefing Part<\/h2>\n<p>The debriefing is compose of 2 aspects : the <strong>diary log<\/strong> and the <strong>dynamic correction<\/strong>.<\/p>\n<h4>Debriefing Diary<\/h4>\n<p><a href=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-debriefing.jpg\"><img loading=\"lazy\" class=\"alignnone size-large wp-image-1046\" src=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-debriefing-1024x576.jpg\" alt=\"\" width=\"660\" height=\"371\" srcset=\"https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-debriefing-1024x576.jpg 1024w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-debriefing-300x169.jpg 300w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-debriefing-768x432.jpg 768w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Effic-asthme-debriefing.jpg 1754w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><\/p>\n<p>The diary capture the <strong>Scenario Manager<\/strong> to read the initial state of the simulation, the scenario and the log.<\/p>\n<p>It will compare the scenario and the log to determine if you have correctly deal the situation (done all the scenario and made no big mistake). Then it will read each entry of the log, see the consequences, to determine the action result : <span style=\"text-decoration: underline;\"><em>Good<\/em><\/span>, <span style=\"text-decoration: underline;\"><em>Partially good <\/em><\/span>(good consequences, bad manipulation), or if the health state was <span style=\"text-decoration: underline;\"><em>Worst<\/em><\/span>\u00a0after that. It will also look the scenario to check if the action was <span style=\"text-decoration: underline;\"><em>Badly Timed<\/em><\/span>. Some extra information will be provide depending of the action result.<\/p>\n<p>In most of scenario some actions like <em>Give the emergency medicine<\/em> are mandatory. When the simulation log reading is finished, we verify if these mandatory actions was performed. In the case they weren&#8217;t, new display entries are added to warn the user of their mistakes.<\/p>\n<p>To conclude, the debriefing will assign a score on this session. On each entry display previously, the system will compute associate points. It depending of the action result and a table given by the game designers. Furthermore, some action not performed will give or cost points depending of the scenario.<\/p>\n<p>A mark will be give on the advance you made in the current scenario. If you have a poor mark (&lt; 50%), the debriefing will propose you to play the dynamic correction of the scenario.<\/p>\n<h4>Dynamic Correction<\/h4>\n<p><a href=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Screenshot_20181116-180742.png\"><img loading=\"lazy\" class=\"alignnone size-large wp-image-1079\" src=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Screenshot_20181116-180742-1024x512.png\" alt=\"\" width=\"660\" height=\"330\" srcset=\"https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Screenshot_20181116-180742-1024x512.png 1024w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Screenshot_20181116-180742-300x150.png 300w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Screenshot_20181116-180742-768x384.png 768w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><\/p>\n<p>The <strong>dynamic corrector<\/strong> is a guided version of a scenario. It is a extra layer module on the simulator.<\/p>\n<p>A first screen display the current medical state of the child. Each asthma symptoms are checked and a medical report is made with the attack gravity.<br \/>\nIf the child state change during the simulation, this screen will be call again.<\/p>\n<p>Then the simulation launched and the <strong>dynamic correction<\/strong> controlled the UI and some interactions to guide the user.<\/p>\n<p>Based on the needed actions, the <strong>dynamic correction<\/strong> will composed a parallel scenario with scripted pattern block.<\/p>\n<p>Each scripted pattern block are manually designed. They have a queue (sequence list) of simulation events and reactions (modify UI, limit user interaction, send simulator request). The simulation event sequences are designed to follow the events send by the simulator.<\/p>\n<p>The <strong>dynamic corrector<\/strong> follow his scenario (queue of scripted pattern block). For each event send by the simulator corresponding with the current scripted pattern, the linked reaction is apply. When all events in the scripted pattern are triggers, the next scripted pattern is selected.<br \/>\nWhen all scripted pattern in the scenario are consumed, the dynamic correction end.<\/p>\n<p>A descriptive schematic of the dynamic correction is available bellow.<\/p>\n<p><a href=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Dynamic-correction-scheme.png\"><img loading=\"lazy\" class=\"alignnone size-large wp-image-1092\" src=\"http:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Dynamic-correction-scheme-1024x537.png\" alt=\"\" width=\"660\" height=\"346\" srcset=\"https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Dynamic-correction-scheme-1024x537.png 1024w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Dynamic-correction-scheme-300x157.png 300w, https:\/\/davikingcode.com\/blog\/wp-content\/uploads\/2018\/10\/Dynamic-correction-scheme-768x403.png 768w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><\/p>\n<h2>Particularity &amp; Challenge :<\/h2>\n<h3>Localization<\/h3>\n<p>Effic&#8217;asthme will be use, at least, in two languages : French and English. To make localization easier, we use a plugin call <em>I2Loc<\/em>. We could localize texts, sounds, images and also videos.<\/p>\n<p>The useful feature in <em>I2Loc<\/em> is the google sheet provider. Instead of had a .<em>csv<\/em> or .<em>xml<\/em> file, the plugin will use a google sheet in a google drive. So the translation can be done during or further the development, without any modification in the build. The refresh period can be modify according to needs.<\/p>\n<p>A localization term (text, image, sound , &#8230;) is identify by a string id. To make more usable, we implemented <em>enums<\/em> and <em>static readonly dictionaries<\/em>. Like this, we can centralize string ids and avoid bad naming call.<\/p>\n<h3>3D animations<\/h3>\n<p>This is a important part of the project cause of the realism needed. Because of the artistic process, we decided to use point cache animations.<\/p>\n<p>Cache animations are animations like blend shape but they are separate from the 3d model. So the animation software capture the vertex on an area of the model and sample their positions periodically. After, this samples are write in a file, a <em>.mdd<\/em> in that case.<br \/>\nLike this the artists can make the animations and release them gradually without the previous ones and the model. On the other hand, depending on the vertex number and the sampling frequency, the animation files can be super heavy. This can be a problem for mobile application.<\/p>\n<p>Unity can&#8217;t read this type of animation, so we use a plugin which read them, <em>MegaFiers<\/em>. <em>MegaFiers<\/em> modify the mesh geometry with the instruction of the .mdd and some extrapolation.<br \/>\nThe animations are play in multiple scripts attach to the GameObject with the mesh. For more convenient usages, I prefer to link this scripts to the animation controller by animation clips. It work very well excepting for the animation blending.<\/p>\n<p>Our animation cover all the child body and some artifacts appear when blend are apply. Some vertex go away depending on their positions on the animations. By iterations, I found that blending on the beginning of animations was the most stable part.<\/p>\n<p>This type of animation give more flexibility to the artists, whereas is more difficult to programmers to integrate it and it can be super heavy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>During 9 month, we worked with DOWiNO and the Paris Descartes\u00a0University on a medical serious game. Effic&#8217;asthme is available both on the Play store ( https:\/\/play.google.com\/store\/apps\/details?id=fr.parisdescartes.efficasthme ) and the App store ( https:\/\/itunes.apple.com\/fr\/app\/efficasthme\/id1400814236?mt=8 ). The app targets parents of children suffering from asthma to help them face asthma attacks. The app is based on and &hellip; <a href=\"https:\/\/davikingcode.com\/blog\/efficasthme-asthma-attack-simulator\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Effic&#8217;asthme &#8211; Asthma Attack Simulator<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_discordance_state":"","_discordance_checked":true},"categories":[4],"tags":[5],"_links":{"self":[{"href":"https:\/\/davikingcode.com\/blog\/wp-json\/wp\/v2\/posts\/1039"}],"collection":[{"href":"https:\/\/davikingcode.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/davikingcode.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/davikingcode.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/davikingcode.com\/blog\/wp-json\/wp\/v2\/comments?post=1039"}],"version-history":[{"count":14,"href":"https:\/\/davikingcode.com\/blog\/wp-json\/wp\/v2\/posts\/1039\/revisions"}],"predecessor-version":[{"id":1144,"href":"https:\/\/davikingcode.com\/blog\/wp-json\/wp\/v2\/posts\/1039\/revisions\/1144"}],"wp:attachment":[{"href":"https:\/\/davikingcode.com\/blog\/wp-json\/wp\/v2\/media?parent=1039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/davikingcode.com\/blog\/wp-json\/wp\/v2\/categories?post=1039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/davikingcode.com\/blog\/wp-json\/wp\/v2\/tags?post=1039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}