Skip to content

Commit

Permalink
refactor: vaccinated schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Oct 15, 2024
1 parent d843d62 commit ec0fc00
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 26 deletions.
4 changes: 0 additions & 4 deletions app/Filament/Resources/CatagraphyResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,6 @@ public static function form(Form $form): Form
->multiple()
->searchable(),

Checkbox::make('is_vaccinated_on_schedule')
->label($categories->get('VCC'))
->columnSpanFull(),

Select::make('cat_ssa')
->label($categories->get('SSA'))
->placeholder(__('placeholder.select_many'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ protected function form(Form $form): Form
VulnerabilityChips::make('cat_ns')
->label($categories->get('NS')),

VulnerabilityChips::make('cat_vcc')
->label($categories->get('VCC'))
->columnSpanFull(),

VulnerabilityChips::make('cat_ssa')
->label($categories->get('SSA')),

Expand Down
13 changes: 0 additions & 13 deletions app/Models/Catagraphy.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class Catagraphy extends Model
'cat_ssa',
'cat_vif',
'is_social_case',
'is_vaccinated_on_schedule',
];

protected $casts = [
Expand All @@ -69,7 +68,6 @@ class Catagraphy extends Model
'has_disabilities' => 'boolean',
'has_health_issues' => 'boolean',
'is_social_case' => 'boolean',
'is_vaccinated_on_schedule' => 'boolean',
];

protected $with = [
Expand Down Expand Up @@ -190,17 +188,6 @@ public function catSoc(): Attribute
)->shouldCache();
}

public function catVcc(): Attribute
{
return Attribute::make(
get: fn () => match ($this->is_vaccinated_on_schedule) {
true => 'VVC_01',
// false => 'VVC_99',
default => null,
},
)->shouldCache();
}

public function catSs(): Attribute
{
return Attribute::make(
Expand Down
11 changes: 8 additions & 3 deletions app/Reports/Queries/Child/C20.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@
namespace App\Reports\Queries\Child;

use App\Models\Beneficiary;
use App\Models\Catagraphy;
use App\Reports\Queries\ReportQuery;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Builder as QueryBuilder;

class C20 extends ReportQuery
{
/**
* Sum beneficiari with Vaccinat conform calendarului (!= VVC_01); Copil 0-1 ani (VCV_01) OR Copil 1-5 ani (VCV_02) OR Copil 5-14 ani (VCV_03).
* Sum beneficiari with Vaccinat conform calendarului (VSC_97); Copil 0-1 ani (VCV_01) OR Copil 1-5 ani (VCV_02) OR Copil 5-14 ani (VCV_03).
*/
public static function query(): Builder
{
return Beneficiary::query()
->whereHasVulnerabilities(function (Builder $query) {
$query->whereJsonDoesntContain('properties', 'VVC_01')
->whereJsonOverlaps('properties', ['VCV_01', 'VCV_02', 'VCV_03']);
$query
->whereJsonOverlaps('properties', ['VCV_01', 'VCV_02', 'VCV_03'])
->whereHasCatagraphyRelation(Catagraphy::class, function (QueryBuilder $query) {
$query->whereJsonContains('properties->attributes->cat_ssa', 'VSC_97');
});
});
}
}
Binary file modified database/data/240722-vulnerabilities.xlsx
Binary file not shown.
1 change: 0 additions & 1 deletion database/factories/CatagraphyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public function definition()
'has_disabilities' => fake()->boolean(),
'has_health_issues' => fake()->boolean(),
'is_social_case' => fake()->boolean(),
'is_vaccinated_on_schedule' => fake()->boolean(),

'cat_age' => fake()->randomElement($this->vulnerabilities->get('AGE')->keys()),
'cat_as' => fake()->randomElement($this->vulnerabilities->get('AS')->keys()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public function up(): void
{
Schema::table('catagraphies', function (Blueprint $table) {
$table->boolean('is_social_case')->nullable()->after('evaluation_date');
$table->boolean('is_vaccinated_on_schedule')->nullable()->after('cat_ns');
});
}
};

0 comments on commit ec0fc00

Please sign in to comment.