It’s not fixed in 3.0 but I fixed it a while ago for our practices. Make the following change to interface/main/calendar/modules/PostCalendar/pnuserapi.php around line 1146:
Was playing around with tracker system last night. I think Rod needs to assign tracker privileges to use this so we can assign to ourselves and change status etc.
-brady
I copied that original code for use in a form to calculate age and I noticed it was wrong while testing. I changed it to this:
function patient_age($birthday, $date) { //calculate age from birthdate and a given later date
list($birth_year,$birth_month,$birth_day) = explode("-",$birthday);
list($date_year,$date_month,$date_day) = explode("-",$date);
$year_diff = $date_year - $birth_year;
$month_diff = $date_month - $birth_month;
$day_diff = $date_day - $birth_day;
if ($month_diff < 0) $year_diff–;
elseif (($month_diff==0) && ($day_diff < 0)) $year_diff–;
return $year_diff;
}
Is this wrong? I just followed the thought process of how I figure out someone’s age in my head, given their birthdate and the current date. Pediatricians will need something that can give an age in months as well.
There is already a function that determines a patient’s age in <oemr>/library/patient.inc and it’s called, aptly enough, getPatientAge.
It takes a DOB in the format YYYYMMDD and returns a string. The string comes back in two different formats:
"## month" - if the patient is less than two years old
"##" - if the patient is older than two years
The PostNuke API file could include the patient.inc file or the code could be copied from that file and pasted into the pnuserapi.php file. Both solutions are good but I think the preferred method is to include the library file. That way we only have one function to repair, if needed, in the future.
A fix has been made and committed to CVS. The date-math has been changed in library/patient.inc to reflect the recommentation by Mark Leeds. Also, the calendar code pnuserapi.php has been changed so the patient’s age is calculated using the corrected library function.
Please, somebody take a look and confirm my code corrections.
Jason I posted your update notes in Tracker on Bug: 2707687
Let’s try and keep track of these things a little more formally if we can. Forums are good for discussion, not so good for figuring out current status.
:
No worries. I’m trying to keep all bugs and feature requests funneled through the tracking system too. It makes it *much* easier to tackle a development task.