-
Notifications
You must be signed in to change notification settings - Fork 28
Moving code 3.4.1 code to 3.6.0 #145
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
base: release-3.6.0
Are you sure you want to change the base?
Conversation
fix: 1963 Added proper space in the string #113
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the β¨ Finishing touchesπ§ͺ Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| } else { | ||
| if (frequency.equalsIgnoreCase("Single Dose") || frequency.equalsIgnoreCase("Stat Dose")|| | ||
| frequency.equalsIgnoreCase("Single Dose Before Food") || frequency.equalsIgnoreCase("Single Dose After Food")) { | ||
| frequency.equalsIgnoreCase("Single Dose Before Food") || frequency.equalsIgnoreCase("Single Dose After Food")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be typo with extra space between Before and Food. π€
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snehar-nd didn't follow this fix.
The fix is to introduce a space?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically a dose and frequency multiplier.
Gave this to AI, got bacK:
public static double getQtyForOneDay(String form, String dose, String frequency) {
if (form == null || dose == null || frequency == null) return 0d;
String f = form.trim().toLowerCase();
String d = dose.trim().toLowerCase();
String freq = frequency.trim().toLowerCase();
// dose multiplier for tablets (capsules treated as 1 per administration in original code)
double doseMultiplier;
if (f.contains("tablet")) {
switch (d) {
case "half tab": doseMultiplier = 0.5; break;
case "one tab": doseMultiplier = 1.0; break;
case "one & half tab": doseMultiplier = 1.5; break;
case "one & half tablet": doseMultiplier = 1.5; break; // tolerate small wording variants
case "two tabs": doseMultiplier = 2.0; break;
default: doseMultiplier = 0.0; // unknown dose
}
} else if (f.contains("capsule")) {
// original code always used integer counts for capsule (1 per administration)
doseMultiplier = 1.0;
} else {
return 0d; // unknown form
}
// frequency -> administrations per day
double freqMultiplier;
if (freq.contains("once in a week") || freq.contains("once a week") || freq.contains("weekly")) {
freqMultiplier = 1.0 / 7.0;
} else if (freq.contains("four") || freq.contains("qid") || freq.contains("four times")) {
freqMultiplier = 4.0;
} else if (freq.contains("thrice") || freq.contains("tid")) {
freqMultiplier = 3.0;
} else if (freq.contains("twice") || freq.contains("bd")) {
freqMultiplier = 2.0;
} else if (freq.contains("once daily") || freq.contains("od") || (freq.contains("once") && freq.contains("daily"))) {
freqMultiplier = 1.0;
} else if (freq.contains("single dose") || freq.contains("stat dose") || freq.contains("single dose before") || freq.contains("single dose after")) {
freqMultiplier = 1.0;
} else if (freq.contains("sos")) {
freqMultiplier = 1.0;
} else {
// unknown frequency -> 0 (safer than making a guess)
return 0d;
}
return doseMultiplier * freqMultiplier;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was a quick fix for the issue, I will implement quality code here.
* fix: anc care issue * fix: alignment
|



π Description
JIRA ID:
AMM-1963
β Type of Change