Creating new actions and conditions

Do you have any documentation or starters to create new condition class. I want to create a condition for valve defect. How do I proceed about creating conditions or actions in source code? Any documentation available to refer?

Thanks in advance!!

Comments

  • Hi Pavithra,

    Adding a new condition is a fairly involved process, so be warned that it make take a little bit of trial and error to get everything compiling and functioning on your implementation. That said, I will try to outline the steps we use internally to add a condition, and maybe you can replicate them with success.

    1) The first step is to modify the Common Data Model to include your new condition. You'll need to look at PatientConditions.xsd for this. Depending on how many variables you want to influence with your condition, you might be able to use one of the existing conditions as a template. If you only want to be able to detect that the condition exists, you could copy the ChronicHeartFailure condition, for example. Or, if you wanted to pass data along with the condition, like maybe a severity value, you could copy something like the ChronicAnemia condition. Copy and paste the block of xsd you want to use, and modify it to fit your ValveDefect condition.

    2) Once you've modified the XSD and saved, you'll need to use it to generate the appropriate source code. If you're using our ANT build targets, you can do this by using an "ant compile" command. The goal here is to generate ValveDefectData.cxx and ValveDefectData.hxx in your BioGears\src\scema\cpp\bind directory. Once you see it appear, you can move on. This step seems to cause problems sometimes, so if you run into issues, let me know and I can try to help you troubleshoot them.

    3) Add condition-specific Java files. Again, you can use an existing file as a template. You should be able to find some examples in your BioGears\src\cdm\java\mil\tatrc\physiology\datamodel\patient\conditions\ directory. You'll need to make sure you replicate the functions in these files, but with your new condition. The Java should build once you do this ("ant compileJava" should work).

    4) On the C++ side, add your condition-specific .h and .cpp files. Again, you can copy one of the existing conditions to make this easier. Look in BioGears\src\cdm\cpp\patient\conditions\ for the files like SEChronicAnemia.h and .cpp. Replicate the functionality inside those for your new condition, and don't forget to add the files to your BioGears project.

    5) You'll need to add a class, member variable, Has() function, and Get() function for your new condition to SEConditionManager.h and .cpp. You should be able to copy the lines for an existing condition to make this work. Don't forget to add the necessary #includes, too.

    6) You'll also need to duplicate a few lines in the NewFromBind() function in SECondition.cpp. Again, just copy the other conditions here. Don't forget the #includes.

    7) Lastly, you'll need to handle some stabilization data for your new condition. You can do this in BioGears.xlsx on the Stabilization tab. You can copy one of the existing conditions for this, and you can modify the criteria if you like. After this, you can call "ant genData" or alternately directly modify DynamicStabilization.xml and TimedStabilization.xml.

    That's it! It's a lot of work, but most of it is just copying existing conditions. Of course, from here, you'd actually need to implement your condition model in BioGears, but this should allow you to add the condition to a patient and check whether it exists. If you run into issues, you can respond here, and I'll try to help so that other forum users can see the solution, or if you need more specific help, you can email me at bwelch@ara.com. If you get it working, you might also consider pushing your work to our GitHub; we'd love to incorporate great new community models to make BioGears better! Good luck!

    -Bennett
Sign In or Register to comment.