@@ -238,6 +238,10 @@ void CommonWithinHost::update(Host::Human &human, LocalRng& rng, int &nNewInfs_i
238238 // Inner vector has one entry "per drug" (really, per element of LSTMModel.m_drugs).
239239 // Each inner vector element is a drug id (integer), and a drug-specific drug factor.
240240 std::vector<std::vector<std::pair<size_t , double >>> identifiedComponentDrugFactors;
241+
242+ // One outer vector entry for each day for each infection.
243+ std::vector<std::vector<std::tuple<std::string, double , double >>> pkpdTimeToDrugConcentrationMaps;
244+ std::vector<std::vector<std::tuple<std::string, double , double >>> pkpdTimeToTotalFactorMaps;
241245
242246 for ( SimTime now = sim::ts0 (), end = sim::ts0 () + sim::oneTS (); now < end; now = now + sim::oneDay () ){
243247 // every day, medicate drugs, update each infection, then decay drugs
@@ -250,10 +254,16 @@ void CommonWithinHost::update(Host::Human &human, LocalRng& rng, int &nNewInfs_i
250254 bool expires = ((*inf)->bloodStage () ? treatmentBlood : treatmentLiver);
251255
252256 if ( !expires ){ /* no expiry due to simple treatment model; do update */
253- // TODO : receive structure containing outputs of individual calculateDrugFactor calls here.
257+ // Using vector of pairs instead of a map, because otherwise values with same time key will get overwritten.
258+ std::vector<std::tuple<std::string, double , double >> pkpdTimeToDrugConcentrationMap;
259+ std::vector<std::tuple<std::string, double , double >> pkpdTimeToTotalFactorMap;
260+
254261 // The values within this structure need to somehow be associated with the specific drug they are from.
255262 // In the scenario in question, the particular override calculateDrugFactor being called is LSTMDrugOneComp::calculateDrugFactor.
256- const std::pair<double , std::vector<std::pair<size_t , double >>> output = pkpdModel.getDrugFactor (rng, *inf, body_mass);
263+ const std::pair<double , std::vector<std::pair<size_t , double >>> output = pkpdModel.getDrugFactor (rng, *inf, body_mass,
264+ pkpdTimeToDrugConcentrationMap,
265+ pkpdTimeToTotalFactorMap
266+ );
257267 const double drugFactor = output.first ;
258268 // Note this drug factor can in some cases be derived from more than one drug type.
259269 drugFactors.push_back (drugFactor);
@@ -289,9 +299,15 @@ void CommonWithinHost::update(Host::Human &human, LocalRng& rng, int &nNewInfs_i
289299 // Outer vector's elements correspond to individual days/infections.
290300 // Inner vector's elements correspond to individual drugs.
291301 // Format could possibly be improved w.r.t. days/infections.
292- std::vector<std::vector<std::pair<std::string, double >>> namedComponentDrugFactors;
302+ // This drug factor, as opposed to the other drug factors which get printed out,
303+ // represents the product of all drugs' drug factors for the given human-day-infection.
304+ std::vector<std::vector<std::pair<std::string, double >>> namedComponentDrugFactorProducts;
293305 for (auto outer_vec : identifiedComponentDrugFactors)
294306 {
307+ if (!outer_vec.empty ())
308+ {
309+ int x = 999 ; // Dummy instructions for breakpoint.
310+ }
295311 std::vector<std::pair<std::string, double >> namedDrugFactors;
296312 for (auto inner_vec : outer_vec)
297313 {
@@ -300,7 +316,7 @@ void CommonWithinHost::update(Host::Human &human, LocalRng& rng, int &nNewInfs_i
300316 const double drugFactor = inner_vec.second ;
301317 namedDrugFactors.push_back (std::pair<std::string, double >{drugName, drugFactor});
302318 }
303- namedComponentDrugFactors .push_back (namedDrugFactors);
319+ namedComponentDrugFactorProducts .push_back (namedDrugFactors);
304320 }
305321
306322 json special_info = json::object ();
@@ -310,7 +326,9 @@ void CommonWithinHost::update(Host::Human &human, LocalRng& rng, int &nNewInfs_i
310326 special_info[" parasite_density" ] = parasite_density;
311327 special_info[" getDrugFactor" ] = drugFactors;
312328 special_info[" drugConcentrations" ] = drugConcentrationMap;
313- special_info[" namedComponentDrugFactors" ] = namedComponentDrugFactors;
329+ special_info[" namedComponentDrugFactorProducts" ] = namedComponentDrugFactorProducts;
330+ special_info[" pkpdTimeToDrugConcentrationMaps" ] = pkpdTimeToDrugConcentrationMaps;
331+ special_info[" pkpdTimeToTotalFactorMaps" ] = pkpdTimeToTotalFactorMaps;
314332 std::cout << special_info.dump () << std::endl;
315333
316334 // As in AJTMH p22, cumulative_h (X_h + 1) doesn't include infections added
0 commit comments