Skip to main content

Limit Medical Certificate Uploads Per Month

TL;DR​

  • Each applicant can upload a limited number of Medical Certificates (MC) per calendar month.
  • The limit is a value in the table configurations.
  • The system counts the applicant's account_suspensions rows with document_uploaded_at in the current month.
  • When the count already reaches the limit, the system rejects the new MC automatically.
  • The APP and the web app show the applicant how many MCs they uploaded this month.
  • The APP and the web app warn the applicant at the limit.
  • The APP and the web app never block the cancellation, even when the MC will be rejected.
  • OPS can filter the MCs the system rejected in the portal.

Words used in this doc​

WordMeaning
ApplicantA jodder who applied to a gig job, and the hiring manager selected them
Medical Certificate (MC)The document an applicant uploads to explain a late cancellation
OPSThe internal Jod team that reviews each MC
APPThe mobile app for applicants
Web appThe repo jodgig-web-applicant, the browser version of the APP for applicants
Calendar monthThe 1st to the last day of a month, in Singapore time
The table account_suspensionsOne row per cancellation that puts an applicant at risk of suspension
The table configurationsKey and value settings that the backend reads at runtime, found by config_key

Problem​

Some applicants cancel a job late and upload an MC many times in one month.

  • An MC is easy to buy online, so an upload does not prove the applicant was sick.
  • OPS spends much time on these MCs.

The data shows that a small group of applicants cancels more than 3 times a month.

MeasureRangeSource
Users who cancel more than 3 times in a month11 to 52, about 29 a monthBI question 397: users who cancel more than 3 times
Their share of all users who cancelled that monthAbout 4% to 13%, average about 7.6%BI question 397: users who cancel more than 3 times

User stories​

  • US-1: As OPS, I want the system to reject an MC over the limit, so my queue holds real cases.
  • US-2: As product, I want to change the limit without a deploy, so we can tune it.
  • US-3: As an applicant, I want to see how many MCs I uploaded this month, so I know my limit.
  • US-4: As an applicant, I want a warning before the system rejects my MC, so I am not surprised.
  • US-5: As an applicant, I want to cancel even over the limit, so I am not forced to attend.
  • US-6: As OPS, I want to filter the MCs the system rejected, so I see them apart from mine.
  • US-7: As OPS, I want the upload count next to the applicant, so I judge each MC with context.

Rules​

RuleApplies toExample
The limit is the value in the table configurations. The code uses a default of 3 only when the row is missing or its value is not a numberUS-2Product changes 3 to 4 in the table
The count covers all jobs and slots of the applicantalwaysTwo jobs and two slots in September count as four uploads
An MC counts when the applicant uploads it, even if OPS approves it lateralwaysAn approved MC on 3 September stays in the count
A new file for the same account_suspensions row does not add to the countalwaysA clearer photo for the same job does not count again
A new file for a row the system rejected keeps the row rejected, and does not suspend the applicant againalwaysAdam sends a clearer photo for Slot D, and Slot D stays rejected
A new file for any other row that already has an MC sends the row back to OPS for reviewalwaysA clearer photo for Job A goes back to OPS
When the count is below the limit, the MC goes to OPS for review, as todayUS-1The 3rd MC in a month goes to OPS
When the count reaches the limit, the system rejects the new MCUS-1The 4th MC in a month never reaches OPS
The count starts again on the 1st of each monthalwaysAn MC on 1 October goes to OPS
The APP and the web app show the MCs uploaded this month and the limit, before the applicant uploadsUS-3Adam sees "2 of 3" before his 3rd MC
When the count already reaches the limit, the APP and the web app warn that the next MC will be rejectedUS-4Adam sees the warning before his 4th MC
The APP and the web app do not block the cancellation or the upload after the warningUS-5Adam still cancels Slot D, and the system suspends him
The suspension report can filter rows with account_suspensions.is_auto_rejected: trueUS-6OPS lists every system rejection in September
The portal shows the upload count next to the applicant's nameUS-7OPS sees "3 used" beside Adam

Design​

Configuration​

One new row goes into the table configurations.

  • config_key: 'portal.mc_upload_monthly_limit', which matches the existing portal.* keys

  • value: '3'

  • The migration 2026_10_20_100100_execute_mc_upload_monthly_limit_configuration_seeder.php adds the row, so product can change the value without a deploy.

  • The backend reads the row on every check, so a change takes effect at once.

  • If the row is missing, or its value is not a number, the backend uses Constants::MC_UPLOAD_MONTHLY_LIMIT_DEFAULT, which is 3.

Database​

Two columns and one index go on the table account_suspensions.

Schema::table('account_suspensions', function (Blueprint $table) {
$table->timestamp('document_uploaded_at')->nullable()
->comment('Set once on the first MC upload for this suspension row');
$table->boolean('is_auto_rejected')->default(false)
->comment('True only when the system rejected the MC for the monthly upload limit');
$table->index(['user_id', 'document_uploaded_at']);
});
  • account_suspensions.document_uploaded_at is set on the first MC upload for the row, and it does not change after that.
  • account_suspensions.is_auto_rejected is true only when the system rejected the MC for the monthly limit.
  • Old rows keep account_suspensions.document_uploaded_at empty, so the count starts at 0 on the release day.

Backend​

Every MC upload path calls one shared check before it saves the MC.

  • The APP and the web app call the same endpoints, so one check covers both.
Upload pathFileEntry point
The MC comes with the cancellationapp/Services/SuspendedService.phpsuspendWithGracePeriod
The MC comes after the cancellation, for a jobapp/Services/JodJobService.phpapplicantUploadCancellationDocumentJobService
The MC comes after the cancellation, for a slotapp/Services/JodJobService.phpapplicantUploadCancellationDocumentSlotService
OPS uploads the MC in the portal, see Portal-Assisted Medical Certificate Uploadapp/Services/PendingSuspensionService.phpuploadCancellationDocumentByAdmin
  • The shared check is McUploadLimitService::recordUpload.
  • A new upload path must call recordUpload too.

The check follows these steps.

  1. If the row already has an MC (document_uploaded_at is set), this is a new file for the same row.
    • When the system rejected the row, the row stays rejected. The system does not suspend the applicant again or send a second notification.
    • For any other row, set the status of the row to pending for review. document_uploaded_at does not change.
  2. Read the limit from the table configurations.
  3. Count the applicant's other account_suspensions rows with document_uploaded_at in the current calendar month, Singapore time.
  4. When the count is below the limit, set the status of the row to pending for review, as today, and set document_uploaded_at to now.
  5. When the count reaches the limit, reject the MC.
    • Set account_suspensions.is_auto_rejected: true, account_suspensions.is_document_approved: false and document_uploaded_at to now.
    • Suspend the applicant the same way OPS does when it rejects an MC.
    • The row and the user are updated in one database transaction, so they are always updated together.
    • If the applicant is suspended now, keep the first users.suspended_at, so the 30-day suspension does not start again.
    • If the applicant is not suspended now, set users.suspended_at to now, even if an old value is still in the column.

When the MC comes with the cancellation (suspendWithGracePeriod) and the count reaches the limit:

  • The system suspends the applicant at once. There is no grace period, and the system does not send UPCOMING_SUSPENSION.
  • The cancelled slot still goes back to the marketplace, the same as a cancellation under the limit.

APP​

The cancellation screen and the urgent-cancellation screen get two fields from GET job/get-mc-limit-info.

  • The endpoint uses the middleware auth.mobile, and returns the fields for the applicant who is signed in.
FieldMeaning
data.mc_uploads_used_this_monthThe number of MCs the applicant uploaded this calendar month
data.mc_upload_monthly_limitThe limit, which the backend reads from the table configurations

The APP shows one message before the applicant uploads an MC.

MCs uploaded this monthWhat the APP shows
Below the limit"You have uploaded used of limit medical certificates this month."
At the limit or more"You have used all limit medical certificate uploads this month. If you upload another one, we will reject it automatically and suspend your account."
  • The warning does not block the applicant.
    • The applicant can still cancel and upload the MC.
  • After the system rejects the MC, the APP shows that the MC was rejected, not "under review".

Web app​

The web app gets the same message as the APP on four pages.

Web app pageFileBackend endpoint
Cancel a jobapp/routes/jobs/job-cancel-page.jsxPOST job/applicantCancelJob
Cancel a slotapp/routes/jobs/job-cancel-single-slot-page.jsxPOST job/cancel-single-slot
Upload an MC after the cancellation, for a jobapp/routes/jobs/job-upload-cancellation-document-page.jsxPOST job/applicant-upload-cancellation-document-job
Upload an MC after the cancellation, for a slotapp/routes/jobs/job-upload-cancellation-document-single-slot-page.jsxPOST job/applicant-upload-cancellation-document-slot
  • Each page loads the job from GET job/applicant-job-detail, as today.
    • Each page also calls GET job/get-mc-limit-info to get the two fields from APP.
  • Each page shows the message from the table in APP above the field Supporting Document.
    • On the two cancel pages, this field shows only after the applicant picks Upload now.
  • The warning does not block the applicant.
  • The web app has no separate urgent-cancellation page.
    • In the last 3 hours before the start, the applicant clicks Request for Urgent Cancellation and confirms a modal.
    • The modal then opens the same cancel page, so the message shows there too.
  • The web app shows no MC review status today.
    • After a cancel or an upload, the web app shows a toast that says "successfully".
    • When the system rejects the MC, the toast must also say that the MC was rejected.
    • The backend response tells the web app whether the system rejected the MC, in the field data.is_mc_auto_rejected.
Backend endpointField
POST job/applicantCancelJobdata.is_mc_auto_rejected
POST job/cancel-single-slotdata.is_mc_auto_rejected
POST job/applicant-upload-cancellation-document-jobdata.is_mc_auto_rejected, next to data.cancellation_document_url
POST job/applicant-upload-cancellation-document-slotdata.is_mc_auto_rejected, next to data.cancellation_document_url
  • true means the system rejected the MC for the monthly limit and suspended the applicant.
  • When the applicant uploads a new file for a row the system already rejected, the value is still true.

Portal​

The portal shows OPS which rejections the system made, and how many MCs each applicant uploaded.

Portal pageFileEntry point
The pending suspension listapp/Services/PendingSuspensionService.phpgetListPendingSuspension
The applicant detail viewapp/Http/Controllers/ApplicantUserController.phpdetail, GET applicantuser/detail/{id}
  • The pending suspension list shows only rows with the status pending for review.
    • A row the system rejected is never in this list, so OPS does not review it.
  • The pending suspension list returns mc_uploads_used_this_month on each row.
    • The backend gets the counts for the whole page with one query.
  • The applicant detail view returns data.mc_uploads_used_this_month.
  • The suspension report gets a filter and a column for account_suspensions.is_auto_rejected.

Worked example: Adam in September​

The limit in the table configurations is 3.

  1. Adam cancels Job A on 3 September and uploads an MC, so the count is 1.
  2. Adam cancels Slot B on 10 September in the web app and uploads an MC, so the count is 2.
  3. Adam cancels Job C on 20 September and uploads an MC, so the count is 3.
  4. OPS reviews these three MCs, as today.
  5. Adam opens the cancellation screen for Slot D on 25 September.
  6. The APP calls GET job/get-mc-limit-info, and warns him that he used all 3 uploads, and that the next MC will be rejected.
  7. Adam still cancels Slot D and uploads an MC.
  8. The count is already 3, so the system rejects the MC and suspends Adam at once, with no grace period.
  9. The system sets account_suspensions.is_auto_rejected: true on the row for Slot D, and the response returns data.is_mc_auto_rejected: true.
    • Slot D still goes back to the marketplace.
  10. OPS does not see the Slot D row in the pending suspension list.
  11. OPS filters the suspension report by account_suspensions.is_auto_rejected and finds the Slot D row.
  12. On 1 October the count is 0, so Adam's next MC goes to OPS.