The Hound of the Wolf

For the strength of Pack is in the Wolf, and the strength of Wolf is in the Pack -Rudyard Kipling

Tuesday, September 30, 2008


Natapos ang ika-36 na araw ko sa Capiz ngayon, Sept 30. Halos tapos na din ang Maternal Care module ng CHITS kasama ang madaming complications ang FHSIS. Ngayon ko lang naramdaman ang kakaibang pagod. Nag-iinit ang aking katawan pero hindi naman libido (hehe). Hyperthermia na ito dala ng sobrang pag-iisip. Nag-overheat na ang mga brain cells para lang sa SQL code na ito:

"SELECT a.mc_id,b.prenatal_date FROM m_patient_mc a,m_consult_mc_prenatal b WHERE a.patient_id='$pxid' AND a.mc_id=b.mc_id AND b.visit_sequence=1 AND b.prenatal_date BETWEEN '$_SESSION[sdate2]' AND '$_SESSION[edate2]' AND (TO_DAYS(a.patient_edc)-TO_DAYS('$vacc_date'))<='$tt_duration[$tt_num]'"

Ang ginagawa lang nito ay dini-determine kung ang isang buntis ay protected sa tetanus. Solved, in 5 hours of coding. Syet, nilalagnat na ako pag katapos. Kung magaling lang talaga ako sa MySQL, mas madali na ito. But i must say I am a notch higher now in terms of Mysql skills.

Makatulog nga muna ...zzzz.

Tuesday, September 23, 2008

The 1-1-4 Maternal care dilemna

The FHSIS Maternal Care indicator 1 says that a count should be made for prenatal patients with 4 prenatal visits. To query it in the database, it is as easy as checking if the COUNT function would return 4 visits if the patient is still under the prenatal period. What makes it difficult to query is to check if within the 4 visits, the patient was able to made at least 1 1st trimester visit, at least 1 for the 2nd semester and at least 2 for the 3rd trimester. Establishing the 1-1 setup is easy while 1-1-2 is quite a challenge (at least on my level). Truly a dilemna which i have been solving for 48 hours already.

The algorithm i have structured is:

1. Get all maternal id's with at least 4 visits and with a third trimester visit
2. Traverse thru the resulted array and check for visits in each trimester.
3. Mark 1 in the cell of the array corresponding with 1st and 2nd trimester indicating that 1st and 2nd trimesters are made.
4. Query for third trimester and get the second least date of prenatal visit using the SQL statement:

$q_min_date = mysql_query("SELECT MIN(prenatal_date) FROM m_consult_mc_prenatal WHERE mc_id='$mcid' AND trimester='$j' AND prenatal_date!=(SELECT MIN(prenatal_date) FROM m_consult_mc_prenatal WHERE mc_id='$mcid' AND trimester='$j')") or die("cannot query: 204");

5. If the result exists, marked the cell corresponding with 1 indicating that there is a second visit for third trimester.

6. Iterate the count for the month of the second visit of the third trimester by getting the month from the resulting date using:

$max_date = date("n",mktime(0,0,0,$latestm,$latestd,$latesty)); where $latestm,$latestd,$latesty is a result of "exploding" the visit date.

7. Return the array of consolidated months after the iteration of maternal id's that complied with the condition stated in the first step.

Thursday, September 18, 2008

CHITS Database changes logs

As of September 18:

1. Added 'vitals_height (int(5))' field in m_consults_vitals

2. Unassigned 'visit_sequence' as an index in m_consult_mc_prenatal

3. Added 'prenatal_id (int (11))' as an index in m_consult_mc_prenatal

4. Assigned 'prenatal_id (int (11))' as an index together with mc_id and consult_id in m_consult_mc_prenatal

5. Added 'actual_service_date' and 'service_qty' to the m_consult_mc_services

6. Added 'Goiter' and 'Having a fourth (or more) baby (grandmulti)' in the MC Risk Factors library m_consult_mc_visit_risk

7. Unassigned mc_id, consult_id and visit_risk_id as index in m_consult_mc_visit_risk

8. Added prenatal_remarks and postpartum_remarks in m_patient_mc

9. Added 'date_breastfed' in m_patient_mc. This field will store date wherein the mother initially breastfed the child.

Sunday, September 07, 2008

CHITS Capiz - 2nd week milestones

Sept 1-2: Reviewed the Maternal Care Pre-natal form
Sept 3-4: Development of new Prenatal TCL
Sept 5: Visited Dumalag and Cuartero RHU for inspection of LAN. Cuartero's LAN restored to usual. Dumalag's LAN is not working (cable problems perhaps) but server is up and running as a standalone.

1.The checkbox for the HBMR option was removed and the user can now explicitly specify the prenatal date. The original setup is that CHITS will consider the date of consultation as the prenatal date. For prenatal data collected in the BHS's, there is a need to tick the HBMR box to allow changing the prenatal date.

2. Allowed the editing of systolic, diastolic and patient weight in prenatal record of the patient

3. Adjusted the vaccination such that TT's recorded on it shall be reflected and seen on the Services on Maternal Care. Presently, the encoder needs to IMPORT DATA so as to copy the TT vaccination record from m_consult_vaccine to m_consult_mc_vaccine. If the user failed to check the IMPORT DATA box, the tendency is for him/her to record the same vaccination again. CHITS will usually treat this as another vaccination based on the testings I've done.

The algorithms are as follows:

a. If a TT vaccination is recorded in Module::Vaccination, the record will also be inserted in the m_consult_mc_vaccine table. MC_ID will be marked as 0 while consult_id, vaccine_id, adr_flag,vaccine_id, actual_vaccine_date, vaccine_timestamp and patient_id will be imported. This condition holds true if the patient is female regardless of age and history of pregnancy.

b. If the TT vaccination record is edited or delete in the Module::Vaccination, the same action will apply to the same TT vaccination record in m_consult_mc_vaccine. Its vice-versa is still being develop (editing and deleting TT's from MC Service)

c. The IMPORT DATA was retained for the existing TT records that were encoded prior to the installation of this change (i.e. Malibay, Lagrosa). Same mechanism for importing applies except that if the the TT record is already in the m_consult_mc_vaccine table, it will not be diplayed in the IMPORT DATA box anymore.

4. Prenatal form (FHSIS 2008) is almost 90% done. Things that are left undone are:
a. adding a quantity field for Iron intakes
b. matching the risk codes, attendant and outcome to the letter codes specified in the FHSIS end user manual
c. adding of remarks text box in the prenatal form.

5. The CHITS query tool was installed inside the main CHIITS directory in the name of 'chits_query'. If REPORTS link is clicked a new tab shall be opened displaying the CHITS query tool form.

Wednesday, September 03, 2008

Cell wrapping in FPDF

what a life saver!



for ($r=0;$r<10;$r++){
for ($c=0;$c<6;$c++){
$pdf->SetY($y); //set pointer back to previous values
$pdf->MultiCell($width,$height,$r."-".$c." ".$x.",".$y,1,'L');