Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2621. Fixes #2622 #2630

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/PKSim.Core/Services/HIDiseaseStateImplementation.cs
Copy link
Member

@Yuri05 Yuri05 May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understood the discussion in #2621 the value origin for the blood flow factors must be changed now from Edginton to Johnson?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha ha this is correct. Eagle eye Juri

Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ private static HIFactors createFactors(double forA, double forB, double forC) =>
};

private static readonly HIFactors _portalFlowScalingFactor = createFactors(0.4, 0.36, 0.04);
private static readonly HIFactors _hepaticFlowScalingFactor = createFactors(1.3, 2.3, 3.4);
private static readonly HIFactors _hepaticFlowScalingFactor = createFactors(1.61, 2.34, 5.29);
private static readonly HIFactors _hepaticVolumeScalingFactor = createFactors(0.69, 0.55, 0.28);
private static readonly HIFactors _renalFlowScalingFactor = createFactors(0.88, 0.65, 0.48);
private static readonly HIFactors _cardiacIndexScalingFactor = createFactors(1.11, 1.27, 1.36);
private static readonly HIFactors _gfrScalingFactor = createFactors(1, 0.7, 0.36);
private static readonly HIFactors _albuminScalingFactor = createFactors(0.81, 0.68, 0.5);
private static readonly HIFactors _agpScalingFactor = createFactors(0.6, 0.56, 0.3);
private static readonly HIFactors _hematocritScalingFactor = createFactors(0.92, 0.88, 0.83);
private static readonly HIFactors _hematocritScalingFactor = createFactors(0.866, 0.822, 0.778);

private static readonly Cache<string, HIFactors> _moleculeScalingFactorEdginton = new()
{
Expand Down Expand Up @@ -78,16 +78,16 @@ public HIDiseaseStateImplementation(IDimensionRepository dimensionRepository,
_ageDimension = dimensionRepository.AgeInYears;
}

public override bool ApplyTo(Individual individual) => applyTo(individual, UpdateParameter(HI_EDGINTON_VALUE_ORIGIN_ID));
public override bool ApplyTo(Individual individual) => applyTo(individual, UpdateParameter);

public override bool ApplyForPopulationTo(Individual individual) => applyTo(individual, UpdateParameterValue);
public override bool ApplyForPopulationTo(Individual individual) => applyTo(individual, x=>UpdateParameterValue);

private bool applyTo(Individual individual, Action<ParameterUpdate> updateParameterFunc)
private bool applyTo(Individual individual, Func<int, Action<ParameterUpdate>> updateParameterFunc)
{
updateBloodFlowsAndVolumes(individual, updateParameterFunc);
updateGFR(individual, updateParameterFunc);
updateOntogenyFactory(individual, updateParameterFunc);
updateHematocrit(individual, updateParameterFunc);
updateBloodFlowsAndVolumes(individual, updateParameterFunc(HI_JOHNSON_VALUE_ORIGIN_ID));
updateGFR(individual, updateParameterFunc(HI_EDGINTON_VALUE_ORIGIN_ID));
updateOntogenyFactory(individual, updateParameterFunc(HI_EDGINTON_VALUE_ORIGIN_ID));
updateHematocrit(individual, updateParameterFunc(HI_EDGINTON_VALUE_ORIGIN_ID));
return true;
}

Expand Down Expand Up @@ -148,8 +148,8 @@ private void updateBloodFlowsAndVolumes(Individual individual, Action<ParameterU
var Q_portal = portalOrgans.Sum(bloodFlow);
var Q_other = otherOrgans.Sum(bloodFlow);
var Q_brain = bloodFlow(BRAIN);
var Q_liver = bloodFlow(LIVER);
var Q_kidney = bloodFlow(KIDNEY);
var Q_liver = bloodFlow(LIVER);

var portal_factor = _portalFlowScalingFactor[score];
var liver_factor = _hepaticFlowScalingFactor[score];
Expand All @@ -168,8 +168,8 @@ private void updateBloodFlowsAndVolumes(Individual individual, Action<ParameterU

//retrieve the scaling factor based on publication and github entry
//see https://github.com/Open-Systems-Pharmacology/Forum/discussions/1341
var otherOrganFactor = (ci_factor * (Q_other + Q_portal + Q_kidney + Q_liver + Q_brain) - (Q_brain + Q_portal * portal_factor + Q_liver_HI * liver_factor + Q_kidney * kidney_factor)) / Q_other;
otherOrgans.Each(x => updateBloodFlowSpec(x, otherOrganFactor));
var otherOrganDiseaseFactor = (ci_factor * (Q_other + Q_portal + Q_kidney + Q_liver + Q_brain) - (Q_brain + Q_portal * portal_factor + Q_liver_HI * liver_factor + Q_kidney * kidney_factor)) / Q_other;
otherOrgans.Each(x => updateBloodFlowSpec(x, otherOrganDiseaseFactor));
}

private Action<string, double> updateBloodFlowSpecDef(Action<ParameterUpdate> updateParameterFunc, IContainer organism) => (organName, factor) =>
Expand Down
Loading