public function show($time = "")
 {
     if (empty($time)) {
         $time = date("Y");
     }
     $regions = Region::regionsArr();
     $districts = District::districtsArr();
     $facility_levels = FacilityLevel::facilityLevelsArr();
     $count_positives = Sample::countPositives($time);
     $av_positivity = Sample::avPositivity($time);
     $count_positives_arr = Sample::countPositives2($time);
     $av_positivity_arr = Sample::avPositivity2($time);
     return view('db/show', compact("time", "regions", "districts", "facility_levels", "count_positives", "av_positivity", "count_positives_arr", "av_positivity_arr"));
 }
Beispiel #2
0
 public static function PCRAges($year, $pcr = "")
 {
     $res = Sample::select("s.infant_age")->from("dbs_samples AS s")->whereYear('s.date_results_entered', '=', $year);
     $res = !empty($pcr) ? $res->where('s.pcr', '=', $pcr) : $res;
     $res = $res->get();
     $ret = [];
     foreach ($res as $rw) {
         $ret[] = Sample::cleanAge($rw->infant_age);
     }
     //if($pcr=="SECOND") print_r($ret);
     return $ret;
 }
Beispiel #3
0
 public static function avPositivity2($year = "")
 {
     if (empty($year)) {
         $year = date("Y");
     }
     $res = Sample::select(\DB::raw("month(date_results_entered) AS mth,count(s.id) AS num"))->from("dbs_samples AS s")->whereYear('s.date_results_entered', '=', $year)->groupby('mth')->get();
     $mths_with_p_nrs = Sample::countPositives2($year);
     $months = \MyHTML::initMonths();
     foreach ($res as $k) {
         $ttl_num = $k->num;
         $ttl_pos = $mths_with_p_nrs[$k->mth];
         $av = $ttl_num > 0 ? $ttl_pos / $ttl_num * 100 : 0;
         $months[$k->mth] = round($av, 1);
     }
     return $months;
 }