Define my own substance


I’m wondering if I can use the serialize_from_file to define a substance in the python SDK of Pulse Physiology Engine, as I didn’t find such a method in the python codes?

Many Thanks

To define a new substance, we modify the Data.xlsx Substances tab
Just expand a comperable substance and copy the 4 associated columns

and paste it where you want it and fill out the properties for you particular substance.

Then run the genData option from the Pulse dev tools

This will generate a substance for use in Pulse

Thanks for your reply!

For example I added a new PropofolChange, should just leave the reference value, reference source, notes/pages columns blank?

Many thanks

If you are going to push this back into the repository, we require that you reference where/how you get your values from so we can properly review, test, and assure that PK/PD is appropriate.
You can see that a lot of drugs have a single URL on one row where we get most data.

This is assuming you trying to model an available real world drug.

We do have drugs like, our oversedation drug that is used for specific targeted effect, so no references there.

As always, documentation and sourcing is always a good practice, but it depends on what you are trying to accomplish

Thanks for your reply!

No, I’m just testing see if I can modify any of the substance properties, not pushing it back to the repo. I was just wondering why I still get this Unknown Substance error, as I can already see the PropofolChange.json file in the bin/substance folder. So I thought these three columns might have gone wrong. However, it seems that there’s some other problems.

Many thanks

So you are loading a state.
States contain the substance database
You have created a new substance, but your state file does not have that new substances in it.

Now you will need to regenerate those states so they contain your new substance.

To generate all states, execute ./ genStates from the install/bin directory
Or if you just want to generate StandardMale, you can execute ./PulseScenarioDriver InitialPatientState.json, which will just generate the StandardMale state

Then try your test again

You can open that states/StandardMale@0s.json and search for your new substance after state generation

Thank you so much! Your explanation makes perfect sense and that worked!

I wonder if I serialze the patient data from a file, instead of using states, and then do an infusion. I don’t need to run genStates, do I?

That will load a json file into a SEPatient object, but you want to initialize your engine with that patient.

You should play with this initialization method, should be plenty of HowTo’s demonstrating using this method

Thank you so much! I can see plenty of examples in the HowTos!