Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ node_modules/
/playwright-report/
/blob-report/
/playwright/.cache/

#Bruno collection config with api key
**/meta.bru
4 changes: 2 additions & 2 deletions app/Console/Commands/PdfFillFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class PdfFillFields extends Command

public function handle()
{
$inputPath = storage_path('app/pdfs/intake-forms/enrollment_documents_fillable_gd_global_DRAFT_v1.pdf');
$inputPath = storage_path('pdfs/intake-form/Enrollment_Form_Fillable_2026-01-27.pdf');
$timestamp = now()->format('Ymd_His');
$outputPath = storage_path("app/pdfs/intake-forms/enrollment_documents_fillable_gd_global_DRAFT_v1-{$timestamp}.pdf");
$outputPath = storage_path("pdfs/intake-form/enrollment_documents_field_names-{$timestamp}.pdf");

// --- 1️⃣ First instance: Get all field names ---
$reader = new Pdf($inputPath);
Expand Down
25 changes: 18 additions & 7 deletions app/Console/Commands/PollNeonParticipants.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@

use Illuminate\Console\Command;
use App\Services\Integrations\NeonApiService;
use App\Services\NeonDTOTransformer;
use App\Jobs\GenerateParticipantPdfJob;
use App\Models\NeonHash;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;

class PollNeonParticipants extends Command
{
Expand Down Expand Up @@ -39,21 +42,29 @@ public function __construct(NeonApiService $neonApi)
*/
public function handle()
{
$participants = $this->neonApi->getTodaysParticipants();

$participantIds = $this->neonApi->getTodaysParticipantIds();

foreach ($participantIds as $participantId) {
// Get the full participant record
$fullRecord = $this->neonApi->buildFullParticipantRecord($participantId);

foreach ($participants as $person) {
$participantId = (int) $person['persons_id']['value'];

// Build the full participant record
$fullRecord = $this->neonApi->buildFullParticipantRecord($participantId);

// Create a hash of the full record
$hash = hash('sha256', json_encode($fullRecord));

// Check if hash already exists
if (!NeonHash::where('id', $hash)->exists()) {
Log::info("Participant ". $participantId . " has updated data. Queuing pdf regeneration.");
// Store the hash for the participant data for future comparison
NeonHash::create(['id' => $hash]);
dispatch(new GenerateParticipantPdfJob($participantId));

// Transform the participant data into serializable DTOs
$serializableDTOs = NeonDTOTransformer::transformParticipantData($fullRecord);
// Queue the pdf generation job
dispatch(new GenerateParticipantPdfJob($serializableDTOs));
} else {
Log::info("Participant ". $participantId . " has no updated data. Skipping pdf regeneration.");
}
}

Expand Down
47 changes: 47 additions & 0 deletions app/DTOs/AssessmentDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace App\DTOs;

readonly class AssessmentDTO implements PdfArrayable
{
public function __construct(
public readonly string $fullName,
public readonly string $dob,
public readonly string $eligibilityMissouriResident,
public readonly string $eligibilityChildUnder18,
public readonly string $financialEligibility,
public readonly string $financialDriversLicence,
public readonly string $financialUtilityBill,
public readonly string $financialWrittenEmployerStatement,
public readonly string $financialSsBenefitsStatement,
public readonly string $financialNoEmploymentIncome,
public readonly string $financialUnemploymentCompensation,
public readonly string $financialOther,
public readonly ?string $financialOtherDescription,
public readonly string $povertyMonthlyIncome,
public readonly string $povertyHouseholdMembers,
public readonly string $povertyPercentageFpl,
) {}

public function toPdfArray(): array {
return [
'participant_full_name' => $this->fullName,
'participant_dob' => $this->dob,
'eligibility_missouri_resident' => $this->eligibilityMissouriResident,
'eligibility_child_under_18' => $this->eligibilityChildUnder18,
'financial_assessment_eligibility' => $this->financialEligibility,
'financial_assessment_drivers_licence' => $this->financialDriversLicence,
'financial_assessment_utility_bill' => $this->financialUtilityBill,
'financial_assessment_written_employer_statement' => $this->financialWrittenEmployerStatement,
'financial_assessment_ss_benefits_statement' => $this->financialSsBenefitsStatement,
'financial_assessment_no_employment_income' => $this->financialNoEmploymentIncome,
'financial_assessment_unemployment_compensation' => $this->financialUnemploymentCompensation,
'financial_assessment_other' => $this->financialOther,
'financial_assessment_other_description' => $this->financialOtherDescription,
'poverty_level_monthly_income' => $this->povertyMonthlyIncome,
'poverty_level_number_of_household_members' => $this->povertyHouseholdMembers,
'poverty_level_percentage_fpl' => $this->povertyPercentageFpl
];
}
}
?>
13 changes: 13 additions & 0 deletions app/DTOs/ChildDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\DTOs;

class ChildDTO
{
public function __construct(
public readonly string $name,
public readonly string $age,
public readonly string $dob,
) {}
}
?>
54 changes: 54 additions & 0 deletions app/DTOs/ContactInfoDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace App\DTOs;

readonly class ContactInfoDTO implements PdfArrayable
{
public function __construct(
public readonly string $titleRegion,
public readonly string $fullName,
public readonly string $enteredDate,
public readonly string $address,
public readonly string $employer,
public readonly string $tshirtSize,
public readonly string $phone,
public readonly string $workPhone,
public readonly string $otherPhone,
public readonly string $email,
public readonly string $caseworkerName,
public readonly string $caseworkerPhone,
public readonly string $monthlyChildSupport,
public readonly string $maritalStatus,
public readonly string $ethnicity,
public readonly string $contactWithChildren,
public readonly string $childrenCustody,
public readonly string $childrenVisitation,
public readonly string $childrenPhone,
) {}

public function toPdfArray(): array
{
return [
'title_region' => $this->titleRegion,
'full_name' => $this->fullName,
'entered_date' => $this->enteredDate,
'address' => $this->address,
'employer' => $this->employer,
'tshirt_size' => $this->tshirtSize,
'phone' => $this->phone,
'work_phone' => $this->workPhone,
'other_phone' => $this->otherPhone,
'email' => $this->email,
'case_worker_name' => $this->caseworkerName,
'case_worker_phone' => $this->caseworkerPhone,
'monthly_child_support' => $this->monthlyChildSupport,
'marital_status' => $this->maritalStatus,
'ethnicity' => $this->ethnicity,
'contact_with_children' => $this->contactWithChildren,
'children_custody' => $this->childrenCustody,
'children_visitation' => $this->childrenVisitation,
'children_phone' => $this->childrenPhone,
];
}
}
?>
83 changes: 83 additions & 0 deletions app/DTOs/DisclosureDTO.php
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since DSS and FSD are checked by default, could we have our own fields for those that we default to true? Or are those fields not fillable in the PDF?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are not fillable as far as I can see.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, cool. I see some that are marked pre-filled, so wanted to double check.

Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

namespace App\DTOs;

readonly class DisclosureDTO implements PdfArrayable
{
public function __construct(
public readonly string $fullName,
public readonly string $phone,
public readonly string $dob,
public readonly string $address,
public readonly string $email,
public readonly string $authorizeDys,
public readonly string $authorizeMhd,
public readonly string $authorizeDfas,
public readonly string $authorizeMmac,
public readonly string $authorizeOther,
public readonly ?string $authorizeDiscloserFormOther,
public readonly string $authorizeCd,
public readonly string $authorizeDls,
public readonly string $discloseToAttorney,
public readonly string $discloseToLegislator,
public readonly string $discloseToEmployer,
public readonly string $discloseToGovernorsStaff,
public readonly string $purposeContinuityOfServicesCare,
public readonly string $purposeLegalConsultationRepresentation,
public readonly string $purposeComplaintInvestigationResolution,
public readonly string $purposeBackgroundInvestigation,
public readonly string $purposeLegalProceedings,
public readonly string $purposeTreatmentPlanning,
public readonly string $purposeAtConsumersRequest,
public readonly string $purposeToShareOrRefer,
public readonly string $purposeOther,
public readonly string $licensureInformation,
public readonly string $disclosureMedical,
public readonly string $hotlineInvestigations,
public readonly string $homeStudies,
public readonly string $eligibilityDeterminations,
public readonly string $substanceAbuseTreatment,
public readonly string $clientEmploymentRecords,
public readonly string $acceptTextMessages,
) {}

public function toPdfArray(): array {
return [
'authorize_full_name' => $this->fullName,
'authorize_dys' => $this->authorizeDys,
'authorize_mhd' => $this->authorizeMhd,
'authorize_dfas' => $this->authorizeDfas,
'authorize_mmac' => $this->authorizeMmac,
'authorize_other' => $this->authorizeOther,
'authorize_discloser_form_other' => $this->authorizeDiscloserFormOther,
'authorize_cd' => $this->authorizeCd,
'authorize_dls' => $this->authorizeDls,
'disclose_full_name' => $this->fullName,
'disclose_phone' => $this->phone,
'disclose_dob' => $this->dob,
'disclose_address' => $this->address,
'disclose_email' => $this->email,
'disclose_to_attorney' => $this->discloseToAttorney,
'disclose_to_legislator' => $this->discloseToLegislator,
'disclose_to_employer' => $this->discloseToEmployer,
'disclose_to_governors_staff' => $this->discloseToGovernorsStaff,
'disclosure_purpose_continuity_of_services_care' => $this->purposeContinuityOfServicesCare,
'disclosure_purpose_legal_consultation_representation' => $this->purposeLegalConsultationRepresentation,
'disclosure_purpose_complaint_investigation_resolution' => $this->purposeComplaintInvestigationResolution,
'disclosure_purpose_background_investigation' => $this->purposeBackgroundInvestigation,
'disclosure_purpose_legal_proceedings' => $this->purposeLegalProceedings,
'disclosure_purpose_treatment_planning' => $this->purposeTreatmentPlanning,
'disclosure_purpose_at_consumers_request' => $this->purposeAtConsumersRequest,
'disclosure_purpose_to_share_or_refer' => $this->purposeToShareOrRefer,
'disclosure_licensure_information' => $this->licensureInformation,
'disclosure_medical' => $this->disclosureMedical,
'disclose_hotline_investigations' => $this->hotlineInvestigations,
'disclosure_home_studies' => $this->homeStudies,
'disclosure_eligibility_determinations' => $this->eligibilityDeterminations,
'disclosure_substance_abuse_treatment' => $this->substanceAbuseTreatment,
'disclosure_client_employment_records' => $this->clientEmploymentRecords,
'accept_text_messages' => $this->acceptTextMessages
];
}
}
?>
56 changes: 56 additions & 0 deletions app/DTOs/ParticipantUpdateData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace App\DTOs;

readonly class ParticipantUpdateData
{
/**
* @param ChildDTO[] $children
*/
public function __construct(
// Meta (not PDF fields, used for file generation)
public readonly int $id,
public readonly string $firstName,
public readonly string $lastName,

// Enrollment form data
public readonly ContactInfoDTO $contactInfo,
public readonly array $children,
public readonly DisclosureDTO $disclosure,
public readonly AssessmentDTO $assessment,
public readonly SurveyDTO $survey,
public readonly ServicePlanDTO $servicePlan
) {}

/**
* This is for the email generation
*/
public function fullName(): string {
return $this->firstName . ' ' . $this->lastName;
}

public function toPdfArray(): array {

$children = [];

foreach ($this->children as $index => $child) {
$adjusted_index = $index + 1;
$children['child_name_' . $adjusted_index] = $child->name;
$children['child_age_' . $adjusted_index] = $child->age;
$children['child_dob_' . $adjusted_index] = $child->dob;

}

$arrays = [
$this->contactInfo->toPdfArray(),
$children,
$this->disclosure->toPdfArray(),
$this->assessment->toPdfArray(),
$this->survey->toPdfArray(),
$this->servicePlan->toPdfArray()
];

return array_merge(...$arrays);
}
}
?>
7 changes: 7 additions & 0 deletions app/DTOs/PdfArrayable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
namespace App\DTOs;

interface PdfArrayable {
public function toPdfArray(): array;
}
?>
47 changes: 47 additions & 0 deletions app/DTOs/ServicePlanDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace App\DTOs;

readonly class ServicePlanDTO implements PdfArrayable
{
public function __construct(
public readonly string $participantFullName,
public readonly string $clientNumber,
public readonly string $goal, // service_plan_goal
public readonly string $serviceIdentified,
public readonly string $strategies_1,
public readonly string $personResponsible_1,
public readonly string $timeline_1,
public readonly string $measureOfSuccess_1,
public readonly string $strategies_2,
public readonly string $personResponsible_2,
public readonly string $timeline_2,
public readonly string $measureOfSuccess_2,
public readonly string $strategies_3,
public readonly string $personResponsible_3,
public readonly string $timeline_3,
public readonly string $measureOfSuccess_3,
) {}

public function toPdfArray(): array {
return [
'service_plan_participant_full_name' => $this->participantFullName,
'service_plan_client_number' => $this->clientNumber,
'service_plan_goal' => $this->goal,
'service_plan_service_identified' => $this->serviceIdentified,
'service_plan_strategies_1' => $this->strategies_1,
'service_plan_person_responsible_1' => $this->personResponsible_1,
'service_plan_timeline_1' => $this->timeline_1,
'service_plan_measure_of_success_1' => $this->measureOfSuccess_1,
'service_plan_strategies_2' => $this->strategies_2,
'service_plan_person_responsible_2' => $this->personResponsible_2,
'service_plan_timeline_2' => $this->timeline_2,
'service_plan_measure_of_success_2' => $this->measureOfSuccess_2,
'service_plan_strategies_3' => $this->strategies_3,
'service_plan_person_responsible_3' => $this->personResponsible_3,
'service_plan_timeline_3' => $this->timeline_3,
'service_plan_measure_of_success_3' => $this->measureOfSuccess_3
];
}
}
?>
Loading