Duration of Disease #12

Closed
opened 2016-04-28 11:23:48 +00:00 by distantobserver · 16 comments
distantobserver commented 2016-04-28 11:23:48 +00:00 (Migrated from github.com)

This needs to be included. In this way it would be applied as follows

Work days lost of Problem = Annual work days lost x duration

Then the user sets the projected reduction in mortality and morbidity as being over the whole period rather than over the year.

I will provide a reference to the code as soon as possible so we can do it.

This needs to be included. In this way it would be applied as follows Work days lost of Problem = Annual work days lost x duration Then the user sets the projected reduction in mortality and morbidity as being over the whole period rather than over the year. I will provide a reference to the code as soon as possible so we can do it.

I need that reference to make the needed changes thanks.

I need that reference to make the needed changes thanks.
distantobserver commented 2016-05-02 19:17:38 +00:00 (Migrated from github.com)

In the sum file change to:
$this->items[$id]->$gender->$age->estimated_burden = ($this->items[$id]->$gender->$age->yld * duration/ $this->company->country_yld)*100;

also
change to:
$this->items[$id]->$gender->$age->mortality_raw = ( _**$this->company->healthData[$id]->{$gender.'death'}[$age]*duration/100000**_ )

Both are now including a "multiplied by duration" operation. This is the duration defined in this line

In the [sum file](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L546) change to: `$this->items[$id]->$gender->$age->estimated_burden = ($this->items[$id]->$gender->$age->yld * duration/ $this->company->country_yld)*100; ` [also](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L775) change to: `$this->items[$id]->$gender->$age->mortality_raw = ( _**$this->company->healthData[$id]->{$gender.'death'}[$age]*duration/100000**_ )` Both are now including a "multiplied by duration" operation. This is the duration defined in [this line](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1396)
distantobserver commented 2016-05-02 19:20:11 +00:00 (Migrated from github.com)

sorry, theraw mortality line should read
$this->items[$id]->$gender->$age->mortality_raw = ($this->company->healthData[$id]->{$gender.'death'}[$age]*duration/100000)

I didn't mean to add the extra characters

sorry, theraw mortality line should read `$this->items[$id]->$gender->$age->mortality_raw = ($this->company->healthData[$id]->{$gender.'death'}[$age]*duration/100000)` I didn't mean to add the extra characters

Okay so the duration is a new value in each Cause/Risk? Where in the back-end will this value be added?

Okay so the duration is a new value in each Cause/Risk? Where in the back-end will this value be added?
distantobserver commented 2016-05-03 08:32:46 +00:00 (Migrated from github.com)

No. we can't assign a duration to each cause/risk as it is specific to each intervention.

That means the above solution doesn't work, so forget that.

What would be the possibility of adding a multiplier (_duration) to the following columns in _Intervention Net Benefit* Table?

  • Cost of problem
  • Cost of Intervention (remove word annual)
  • Net Benefit

This would then carry through to the Intervention Cost Benefit Chart

No. we can't assign a duration to each cause/risk as it is specific to each intervention. That means the above solution doesn't work, so forget that. What would be the possibility of adding a multiplier (_duration) to the following columns in *_Intervention Net Benefit*\* Table? - Cost of problem - Cost of Intervention (remove word annual) - Net Benefit This would then carry through to the **Intervention Cost Benefit Chart**

So the duration will be set per intervention or per targeted risk/cause in an intervention?

The calculations for the interventions are done from line1387 to line1535

You will possibly need to added the changes to line1435

So the duration will be set per intervention or per targeted risk/cause in an intervention? The calculations for the interventions are done from [line1387](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1387) to [line1535](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1535) You will possibly need to added the changes to [line1435](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1435)

Please give me the exact calculation and the line you think it should be added. I tried to name the values in the code so you can understand what is being done and when.

Please give me the exact calculation and the line you think it should be added. I tried to name the values in the code so you can understand what is being done and when.
distantobserver commented 2016-05-06 10:31:29 +00:00 (Migrated from github.com)

We should multiply the cost of the problem and the annual benefit by " duration" . This will give us the figures we need.

I'm not sure but I think we should edit the following to acheive this:

Line 1481/1482
or line 1435

['cost_of_problem_scaled'] = (cost_of_problem_scaled + subtotal_cost_scaled) * duration

Line 1471/1472
or line 1440

benefit = annual benefit * duration
Similarly for lines 1473 or 1445 and 1473

This leaves a semantic problem in that the values are all called "annual" (annual_cost, annual_benefit etc.) whereas this change makes the totals "cumulative" not annual.

We should multiply the cost of the problem and the annual benefit by " duration" . This will give us the figures we need. I'm not sure but I think we should edit the following to acheive this: Line [1481/1482](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1481) or line [1435](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1435) ['cost_of_problem_scaled'] = (cost_of_problem_scaled + subtotal_cost_scaled) \* duration Line [1471/1472](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1471) or line [1440](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1440) benefit = annual benefit \* duration Similarly for lines 1473 or 1445 and 1473 This leaves a semantic problem in that the values are all called "annual" (annual_cost, annual_benefit etc.) whereas this change makes the totals "cumulative" not annual.

So we will again add the DURATION (years) field back to the intervention table and only allow integers or would a decimal value also be allowed?

Then line 1481 and 1471 is only the sum of the totals and not where the actual change is to be made.

Here is the lines I think should change on account of your proposal:

For the Cost
LINE1435 Must change to

$this->interventions[$i]['items'][$a]['cost'] = 
    ($this->interventions[$i]["coverage"] /100) 
    * $value['cpe'] * ($this->company->males + $this->company->females) 
    * DURATION;

For the Benefit
LINE1440 Must change to

$this->interventions[$i]['items'][$a]['benefit_unscaled'] = 
    ($this->interventions[$i]["coverage"] /100) * ($value['mbr'] /100) 
    * ($this->items[$value['id']]->subtotal_cost_morbidity_unscaled 
    + $this->items[$value['id']]->subtotal_cost_presenteeism_unscaled) 
    + ($value['mtr']/100) 
    * $this->items[$value['id']]->subtotal_cost_mortality_unscaled 
    * DURATION; 

& LINE1445

$this->interventions[$i]['items'][$a]['benefit_scaled'] = 
    ($this->interventions[$i]["coverage"] /100) 
    * ($value['mbr'] /100) 
    * (($this->items[$value['id']]->subtotal_cost_morbidity_scaled 
    + $this->items[$value['id']]->subtotal_cost_presenteeism_scaled) 
    + ($value['mtr']/100)) 
    * $this->items[$value['id']]->subtotal_cost_mortality_scaled 
    * DURATION; 

Then these new values:

$this->interventions[$i]['items'][$a]['cost']
$this->interventions[$i]['items'][$a]['benefit_unscaled']
$this->interventions[$i]['items'][$a]['benefit_scaled'] 

Will be used throughout the rest of the calculation. Also all naming of the values as annual will be removed. If I remember correctly this is how it was before... Why did we change it back then?

Anyway does all this look correct to you? Please confirm and I will commit the changes so we can test the results.

So we will again add the DURATION (years) field back to the intervention table and only allow integers or would a decimal value also be allowed? Then line [1481](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1481) and [1471](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1471) is only the sum of the totals and not where the actual change is to be made. Here is the lines I think should change on account of your proposal: _For the Cost_ [LINE1435](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1435) Must change to ``` $this->interventions[$i]['items'][$a]['cost'] = ($this->interventions[$i]["coverage"] /100) * $value['cpe'] * ($this->company->males + $this->company->females) * DURATION; ``` _For the Benefit_ [LINE1440](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1440) Must change to ``` $this->interventions[$i]['items'][$a]['benefit_unscaled'] = ($this->interventions[$i]["coverage"] /100) * ($value['mbr'] /100) * ($this->items[$value['id']]->subtotal_cost_morbidity_unscaled + $this->items[$value['id']]->subtotal_cost_presenteeism_unscaled) + ($value['mtr']/100) * $this->items[$value['id']]->subtotal_cost_mortality_unscaled * DURATION; ``` & [LINE1445](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1445) ``` $this->interventions[$i]['items'][$a]['benefit_scaled'] = ($this->interventions[$i]["coverage"] /100) * ($value['mbr'] /100) * (($this->items[$value['id']]->subtotal_cost_morbidity_scaled + $this->items[$value['id']]->subtotal_cost_presenteeism_scaled) + ($value['mtr']/100)) * $this->items[$value['id']]->subtotal_cost_mortality_scaled * DURATION; ``` Then these new values: ``` $this->interventions[$i]['items'][$a]['cost'] $this->interventions[$i]['items'][$a]['benefit_unscaled'] $this->interventions[$i]['items'][$a]['benefit_scaled'] ``` Will be used throughout the rest of the calculation. Also all naming of the values as annual will be removed. If I remember correctly this is how it was before... Why did we change it back then? Anyway does all this look correct to you? Please confirm and I will commit the changes so we can test the results.
distantobserver commented 2016-05-09 08:57:55 +00:00 (Migrated from github.com)

Hi,

The calculations look OK (I don't think we had it like this before)

I think let's just allow integers, then put a label next to duration in the intervention edit page saying "in number of years". Put in "1" as a default value

Hi, The calculations look OK (I don't think we had it like this before) I think let's just allow integers, then put a label next to duration in the intervention edit page saying "in number of years". Put in "1" as a default value

Okay,

I was wondering since I remembered this duration value before we moved over to the YLD's. But you may be right :)

Okay, I was wondering since I remembered this duration value before we moved over to the YLD's. But you may be right :)
distantobserver commented 2016-05-09 09:03:04 +00:00 (Migrated from github.com)

Yes. It was there in the old incidence/prevalence version, but we didn't migrate it until now.

Yes. It was there in the old incidence/prevalence version, but we didn't migrate it until now.

@distantobserver the changes has been made and is now installed on the https://www.staffhealthcbp.com/ please test the duration implementation to insure it works as expected.

@distantobserver the changes has been made and is now installed on the https://www.staffhealthcbp.com/ please test the duration implementation to insure it works as expected.
distantobserver commented 2016-05-12 17:14:30 +00:00 (Migrated from github.com)

Hi.

The change to benefit is OK. (though I don't see it on the github code, line 1140 and 1145)

The cost of problem is not multiplying - rather the cost of the intervention is. I realise I gave you a wrong reference in the code. 1435 should have remained unchanged. Sorry.

We need to multiply the cost of problem referred to in line 1433https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1433

so that the number in column 6 is cost of problem * duration
image

Hi. The change to benefit is OK. (though I don't see it on the github code, line 1140 and 1145) The cost of problem is not multiplying - rather the cost of the intervention is. I realise I gave you a wrong reference in the code. 1435 should have remained unchanged. Sorry. We need to multiply the cost of problem referred to in line 1433[https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/sum.php#L1433](url) so that the number in column 6 is cost of problem \* duration ![image](https://cloud.githubusercontent.com/assets/7658109/15223618/4ebf6be6-186d-11e6-920e-9a1bcc32bde2.png)

To see the changes you need to go to the staging branch since the final commit to the master branch is only made once we are sure it works.

So to get to the updated file change the branch from master to staging and then go to the file as normal.

This is not good news, I think that is why I use the words please give me the exact calculation and the line you think it should be added

I am little unsure what to change now, and what to un-change. Looking back at my detailed/exact calculations I gave as a proposal here is what I did:

For the Cost
LINE1441 was change to

$this->interventions[$i]['items'][$a]['cost'] = 
    ($this->interventions[$i]["coverage"] /100) 
    * $value['cpe'] * ($this->company->males + $this->company->females) 
    * DURATION;

For the Benefit
LINE1447 was change to

$this->interventions[$i]['items'][$a]['benefit_unscaled'] = 
    ($this->interventions[$i]["coverage"] /100) * ($value['mbr'] /100) 
    * ($this->items[$value['id']]->subtotal_cost_morbidity_unscaled 
    + $this->items[$value['id']]->subtotal_cost_presenteeism_unscaled) 
    + ($value['mtr']/100) 
    * $this->items[$value['id']]->subtotal_cost_mortality_unscaled 
    * DURATION; 

& LINE1453

$this->interventions[$i]['items'][$a]['benefit_scaled'] = 
    ($this->interventions[$i]["coverage"] /100) 
    * ($value['mbr'] /100) 
    * (($this->items[$value['id']]->subtotal_cost_morbidity_scaled 
    + $this->items[$value['id']]->subtotal_cost_presenteeism_scaled) 
    + ($value['mtr']/100)) 
    * $this->items[$value['id']]->subtotal_cost_mortality_scaled 
    * DURATION; 

Then these new values:

$this->interventions[$i]['items'][$a]['cost']
$this->interventions[$i]['items'][$a]['benefit_unscaled']
$this->interventions[$i]['items'][$a]['benefit_scaled'] 

So what must be changed back to its old state and what must stay the same?

Then if you want to target the cost_of_problem the following may be the implementation. again looking at the file in the staging branch and using its line numbers as reference (they are not the same as the master branch).

For Cost of Problem
LINE1436 must be changed to

$this->interventions[$i]['items'][$a]['cost_of_problem_unscaled'] = 
    $this->items[$value['id']]->subtotal_cost_unscaled * $item->duration;
$this->interventions[$i]['items'][$a]['cost_of_problem_scaled'] = 
    $this->items[$value['id']]->subtotal_cost_scaled * $item->duration;
To see the changes you need to go to the [staging branch](https://github.com/namibia/CBP-Joomla-3-Component/tree/staging) since the final commit to the master branch is only made once we are sure it works. So to get to the updated file change the branch from master to staging and then go to the [file as normal](https://github.com/namibia/CBP-Joomla-3-Component/blob/staging/admin/helpers/sum.php). This is not good news, I think that is why I use the words **please give me the exact calculation and the line you think it should be added** I am little unsure what to change now, and what to un-change. Looking back at my detailed/exact calculations I gave as a proposal here is what I did: _For the Cost_ [LINE1441](https://github.com/namibia/CBP-Joomla-3-Component/blob/staging/admin/helpers/sum.php#L1441) was change to ``` $this->interventions[$i]['items'][$a]['cost'] = ($this->interventions[$i]["coverage"] /100) * $value['cpe'] * ($this->company->males + $this->company->females) * DURATION; ``` _For the Benefit_ [LINE1447](https://github.com/namibia/CBP-Joomla-3-Component/blob/staging/admin/helpers/sum.php#L1447) was change to ``` $this->interventions[$i]['items'][$a]['benefit_unscaled'] = ($this->interventions[$i]["coverage"] /100) * ($value['mbr'] /100) * ($this->items[$value['id']]->subtotal_cost_morbidity_unscaled + $this->items[$value['id']]->subtotal_cost_presenteeism_unscaled) + ($value['mtr']/100) * $this->items[$value['id']]->subtotal_cost_mortality_unscaled * DURATION; ``` & [LINE1453](https://github.com/namibia/CBP-Joomla-3-Component/blob/staging/admin/helpers/sum.php#L1453) ``` $this->interventions[$i]['items'][$a]['benefit_scaled'] = ($this->interventions[$i]["coverage"] /100) * ($value['mbr'] /100) * (($this->items[$value['id']]->subtotal_cost_morbidity_scaled + $this->items[$value['id']]->subtotal_cost_presenteeism_scaled) + ($value['mtr']/100)) * $this->items[$value['id']]->subtotal_cost_mortality_scaled * DURATION; ``` Then these new values: ``` $this->interventions[$i]['items'][$a]['cost'] $this->interventions[$i]['items'][$a]['benefit_unscaled'] $this->interventions[$i]['items'][$a]['benefit_scaled'] ``` So what must be changed back to its old state and what must stay the same? Then if you want to target the **cost_of_problem** the following may be the implementation. again looking at the file in the [staging branch](https://github.com/namibia/CBP-Joomla-3-Component/blob/staging/admin/helpers/sum.php#L1387) and using its line numbers as reference _(they are not the same as the master branch)_. _For Cost of Problem_ [LINE1436](https://github.com/namibia/CBP-Joomla-3-Component/blob/staging/admin/helpers/sum.php#L1436) must be changed to ``` $this->interventions[$i]['items'][$a]['cost_of_problem_unscaled'] = $this->items[$value['id']]->subtotal_cost_unscaled * $item->duration; $this->interventions[$i]['items'][$a]['cost_of_problem_scaled'] = $this->items[$value['id']]->subtotal_cost_scaled * $item->duration; ```
distantobserver commented 2016-05-13 06:49:02 +00:00 (Migrated from github.com)

The code looks OK and the figures on the site are correct now.

Thanks and sorry for the confusion.

The code looks OK and the figures on the site are correct now. Thanks and sorry for the confusion.
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Cost-Benefit-Projection#12
No description provided.