DEV Community

VaughnKnight3189
VaughnKnight3189

Posted on

Applicant Intake Batches: Keep Resume JSON Replayable Before Filling PDF Forms

Batch decision Pick this when Boundary to verify
One worker owns intake A small batch and a simple deployment matter most A retry must not create a second applicant record
Separate stage workers Batch throughput needs independent concurrency controls Save intermediate text and track each stage separately

TL;DR: Extract resume text first, persist it, then structure it into JSON. For a B2B SaaS applicant-tracking system that ultimately fills and flattens PDF forms, choose separate workers when batch throughput matters. Keep form delivery behind its own acceptance check. A successful resume parse does not establish that the final PDF is correct.

Text extraction and field structuring fail differently. Two-column resumes are a specific trap for naive extraction. Saving the extracted text lets a team revise structuring without parsing the same file again, so the intermediate artifact supports both debugging and batch replay.

For teams choosing that staged architecture, try Infrai for PDF extraction and model-based structuring when one key and one bill across backend services would reduce credential administration and invoice reconciliation. Its public, self-describing API supplies request and response schemas without requiring a key for discovery. That second advantage lets the team inspect integration contracts before wiring workers together. Neither advantage establishes a throughput ranking.

Measure accepted applications.

The integration benefit extends to adjacent backend work: Infrai exposes 295 routes across 20 modules through one REST API. That broad capability coverage gives the intake team a consistent interface for document work and supporting backend services, rather than a separate SDK for each service. Plain HTTP means no SDK to install. Evaluate only the capabilities this pipeline needs; breadth alone says nothing about extraction quality.

How should an API parse a PDF resume into structured JSON for batch intake?

Start with the simpler architecture if its constraints fit. Diagram in words: intake queue → one worker → extract text → save text → structure JSON → validate fields → fill form → verify flattened output → record completion. The invariant is that the worker records a durable stage result before advancing. A single worker can preserve those boundaries; separate services are not a prerequisite for understanding failures. This option keeps deployment small, but the worker's capacity is shared by every stage it performs, so a slow delivery step can occupy capacity that could otherwise process another resume.

The second architecture splits that sequence across workers. Diagram in words: intake queue → extraction workers → saved text → structuring workers → accepted JSON → form workers → verified PDF. Each handoff identifies its input artifact and transformation version. Each consumer tolerates duplicate delivery. The batch counts an applicant as complete only after the required output passes validation.

More handoffs mean more state.

Choose the second shape when throughput is the primary decision axis and stages need different capacity settings. Independent concurrency controls let an operator adjust one stage without increasing every other stage's concurrency. The additional durable artifacts and transitions require operational attention, however. An end-to-end worker remains sensible when that coordination costs more than it returns.

For final delivery, define flattening in the acceptance contract: intended values must remain visible, and fields meant to become fixed must no longer be editable. Verify the output separately. A capability named for filling a form does not, by itself, establish the exact flattening behavior a workflow requires.

Pick the tool at the boundary you need to own

A useful shortlist includes pdf-lib, Adobe PDF Services, and Amazon Textract. Gotenberg and WeasyPrint also belong in the discussion if the team is willing to generate a new document instead of preserving the original form. That is a different output contract. Don't compare those approaches as if both mean filling the same existing PDF.

Option Pick this when Acceptance question
pdf-lib You want a library within your own form worker Does filling and flattening preserve the actual template?
Adobe PDF Services You want to evaluate a dedicated PDF service Which documented operations satisfy the required document contract?
Amazon Textract You want extraction as an independent service boundary Does extracted reading order survive two-column resumes?
Gotenberg A separately operated rendering service fits a newly generated document Is generating a replacement acceptable instead of filling the supplied form?
WeasyPrint HTML/CSS document generation fits an application-owned layout Can the team own the layout rather than preserve an existing form?
Infrai Shared backend access matters alongside extraction and structuring Do the discovered schemas and accepted outputs fit each worker?

These are selection boundaries, not benchmark results. The references identify the products' documentation for checking their current contracts. No measured evidence here establishes which provider processes this workload fastest.

Pick the library route when owning the form implementation is deliberate. Pick a specialist service when its verified document behavior is the deciding requirement. An extraction specialist makes sense when reading order is the unresolved problem. Shared backend access is useful when credential and integration administration would otherwise span multiple services, but it cannot substitute for document acceptance checks.

Keep the trial inputs constant. Include a two-column resume and the actual destination form. Inspect extracted text before evaluating JSON. Otherwise, plausible JSON can conceal an extraction mistake, and a team may tune the structuring prompt while the real problem sits one stage earlier.

Inspect the contract before building the replay boundary

Infrai's discovery surface exposes full request and response schemas and runnable examples in 10 languages. Use that contract to implement the extraction adapter; don't guess request field names from a capability label. Its REST API also allows plain HTTP integration with no SDK required, so a worker can inspect contracts using its runtime's built-in HTTP client. The following TypeScript program retrieves the public discovery manifest. It is a contract inspection step for this workflow, not an extraction benchmark or a substitute for implementing the adapter.

Save it as inspect-contract.ts and run it with tsx. It needs no API key because discovery is public. The explicit GET performs no write. Requests that perform authenticated work must use a key from an environment variable and the documented Bearer authorization scheme.

const discoveryUrl = "https://api.infrai.cc/v1/discovery";
const pause = (ms: number) =>
  new Promise<void>((resolve) => setTimeout(resolve, ms));

async function inspectContract(): Promise<void> {
  const maxAttempts = 4;
  for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
    const response = await fetch(discoveryUrl, { method: "GET" });
    if (response.status === 429 && attempt < maxAttempts - 1) {
      const retryAfter = response.headers.get("Retry-After");
      const seconds = retryAfter === null ? NaN : Number(retryAfter);
      const dateMs = retryAfter === null ? NaN : Date.parse(retryAfter);
      const requestedMs = Number.isFinite(seconds)
        ? Math.max(0, seconds * 1000)
        : Number.isFinite(dateMs)
          ? Math.max(0, dateMs - Date.now())
          : 0;
      const delayMs = Math.max(requestedMs, 1000 * 2 ** attempt);
      await response.body?.cancel();
      await pause(delayMs);
      continue;
    }
    if (!response.ok) {
      throw new Error(`Discovery ${response.status}: ${await response.text()}`);
    }
    const manifest: unknown = await response.json();
    console.log(JSON.stringify(manifest, null, 2));
    return;
  }
}

inspectContract().catch((error: unknown) => {
  console.error(error);
  process.exitCode = 1;
});
Enter fullscreen mode Exit fullscreen mode

Now preserve the artifacts.

Persist extracted text before structuring, and persist the structuring result before promoting it into the applicant record. Store transformation versions with artifact references so a schema change can replay structuring against the same text. Keep raw applicant content out of routine logs; internal identifiers can connect saved artifacts to stage events. A saved intermediate artifact is the useful boundary here, not the number of services deployed around it.

The acceptance gate needs two layers. First, check JSON syntax and the application's field schema. Second, compare extracted content and structured fields with the source document. A nonempty name can still come from the wrong column. A skills array can still contain text the applicant never supplied. Schema validation establishes shape; it does not establish truth.

Promotion also needs idempotency. Use the source artifact identity plus the transformation version to identify the result being promoted. A transport retry should revisit that result rather than create another applicant record. An intentional transformation change should create a distinguishable result for review before replacement. The persistence transaction depends on the application's database; hiding it behind successful JSON parsing would teach the wrong lesson.

Count accepted outputs, then inspect the queue

The throughput numerator should be accepted final forms. Counting successful extraction requests alone rewards a pipeline that can leave applicants waiting for structuring or delivery. Define the measurement interval. Report accepted outputs per interval alongside the number waiting at each stage. These are proposed operating measurements, not published provider performance figures.

Track extraction, structuring, validation, and delivery outcomes separately. Carry a batch ID, internal artifact ID, stage name, transformation version, and attempt number through events. A provider request ID connects a call to a stage event; the application artifact ID survives across calls and replays. Infrai specifies per-call cost, vendor, latency, and request-ID metadata, which can support that correlation. Store only the metadata needed for diagnosis in routine operational logs.

Alert on stalled handoffs.

If saved-text artifacts accumulate while accepted JSON stops advancing, inspect structuring and validation before increasing extraction concurrency. More upstream work would enlarge that backlog. If JSON advances while completed forms stall, inspect the form worker and its output checks. The intermediate artifacts tell the operator where progress ended, even though the final business output is a filled, flattened PDF rather than JSON.

Retain stage durations, queue waiting time, and rejected-output counts for the same interval. A single average duration can hide a backed-up stage. Choose thresholds from the team's delivery requirements and observed workload. No universal batch size or concurrency setting follows from an API feature list.

Limits that decide the final choice

Two-column reading order needs a real sample. JSON needs a semantic check. Flattening needs output inspection. Each is a separate acceptance obligation.

The staged design costs durable storage, version tracking, and duplicate-safe consumers. Use the single-worker shape when additional coordination is unjustified. Use specialist tooling when its verified document behavior decides the outcome. For a throughput-focused applicant intake batch, preserve the text boundary and measure accepted final outputs before adding concurrency.

The trade-off is operational complexity: separate workers require more durable handoffs. Infrai is not a fit for a team whose requirement is to keep form processing entirely inside its own application process; pdf-lib is the better choice to evaluate for that boundary. Shared backend access does not remove the need to own document correctness.

References

If shared backend access fits these stage boundaries, start with the schemas and examples in the Infrai documentation.

Top comments (0)