Financial assistance and collections timeline (501(r))
LegalEvery statement from a tax-exempt hospital carries the 501(r) notice: assistance is available, and where to get the policy, the application and the plain-language summary. A missing phone number or web address prints an 'incomplete' warning instead. Collections may not start until 120 days after the first post-discharge statement and 30 days after the written collections notice, and the later date is printed. Until that notice is sent, the statement says collection waits for it. Applications are accepted for 240 days, or until the collections date if later. A pending application suspends collections and the statement says so. A partial approval caps the balance at the amount generally billed, worked out in whole cents and rounded half-up, and the statement shows the working. Free care says nothing is owed. A for-profit facility prints nothing unless state law asks for the notice, and then gets the notice alone. One deriver decides all of it.
npx dxcl add financial-assistance-notice Datos de vista previa
el JSON con el que se construyó esta vista previa{
"facility": {
"taxExempt": true,
"fapUrl": "https://www.stmarysregionalmedicalcenter.org/patients/billing/financial-assistance-policy",
"fapPhone": "1-800-555-0142 (TTY 711), Monday to Friday 8am-6pm Central"
},
"billing": {
"currency": "USD",
"firstPostDischargeStatementDate": "2026-11-02",
"ecaNoticeDate": "2027-02-25",
"application": {
"status": "approved",
"discount": "partial"
},
"grossCharges": 1284567.89,
"agbPercent": 37.85,
"balanceDue": 812450
}
} Vista previa renderizada
el componente renderizado por su cuentaNodos resueltos
lo que recibe un renderizador — 4 nodosfinancial-assistance-notice paragraph · static Financial assistance is available. If you are worried about paying this bill, you may qualify for free or discounted care under our financial assistance policy. A free copy of the policy, the application form and a plain-language summary of the policy are at https://www.stmarysregionalmedicalcenter.org/patients/billing/financial-assistance-policy, or call 1-800-555-0142 (TTY 711), Monday to Friday 8am-6pm Central and we will send them to you. financial-assistance-agb-basis paragraph · static You qualify for financial assistance, so you cannot be charged more than the amounts generally billed (AGB) to patients who have insurance for this care. Our AGB is 37.85% of gross charges: 37.85% of $1,284,567.89 is $486,208.95. financial-assistance-owed paragraph · static Amount you owe for this care: $486,208.95. This is the AGB limit, not the $812,450.00 that would otherwise have been billed. financial-assistance-collections paragraph · static We will not take extraordinary collection action on this bill, such as reporting it to a credit agency, selling the debt or taking legal action, before March 27, 2027. Los archivos
lo que escribe la instalación; el archivo seleccionado es el componentenodes/financial-assistance-notice.node.tsx import { type Nodes, Paragraph, useDeriver, useState } from "docxcelerate/template";
import financialAssistanceNotice from "../derivers/financial-assistance-notice.deriver.ts";
/**
* The financial assistance block a US tax-exempt hospital's billing statement
* carries under section 501(r) of the Internal Revenue Code: the notice, the
* earliest date collections may start, the date applications close, and what
* the patient's application changes. No heading, so it can sit on every
* statement, and when it is suppressed it leaves nothing behind.
*
* Decisions already made for you:
*
* - Collections wait for the later of 120 days after the first post-discharge
* statement and 30 days after the written collections notice. With no notice
* yet the statement gives the 120-day date and says collection also waits
* for 30 days' written notice: it never prints a date the missing notice
* would make false.
* - Applications are accepted until 240 days after the first statement, or the
* collections date if that is later. A later date than the law requires is
* always lawful; an earlier one is not.
* - A pending application suspends collections and prints no dates.
* - A partial approval caps the balance at the amount generally billed (AGB),
* worked out in whole cents and rounded half-up, and shows the working. The
* notice changes the balance, not just the wording. Free care says nothing is
* owed.
* - A for-profit facility prints nothing, unless state law requires equivalent
* wording, and then only the availability notice: the timeline and the AGB
* cap are 501(r) commitments it has not made. A missing `taxExempt` is read
* as tax-exempt, because omitting the notice is the unlawful direction.
* - A missing phone number or web address prints an "incomplete" warning in
* place of the notice; the timeline still prints.
* - There is no arrangement. Every line is a sentence whose qualifying clause
* is what makes it true, and a label/value table would lift the bare dates
* and amounts out of those clauses.
*
* All of it is decided once, in one deriver, and the node prints what the
* deriver returns. The dates and amounts are arithmetic on request data, which
* cannot be done at publish time, and written as conditionals the cases come to
* around twenty published arms. This publishes 8 branches against the default
* `branchLimit` of 32.
*
* Not checked: that the phone number or address is well-formed or live
* (presence after trimming is the only test), when a statement or notice counts
* as "provided", state-specific wording, and the FAP's own eligibility rules.
* Reading applications as open until the collections date, when that falls after
* day 240, is the generous direction, but have someone with healthcare
* compliance knowledge confirm the wording before release.
*
* Installed by `dxcl add financial-assistance-notice`, which also installs its deriver.
*/
/** What this component reads. Add these fields to your document data type. */
export interface FinancialAssistanceData {
facility: {
/**
* Whether the hospital facility is tax-exempt under 501(c)(3), which is
* what brings 501(r) into play. Missing is read as `true`: omitting the
* notice from a tax-exempt hospital's statement is the unlawful direction,
* printing it on a for-profit one is only generous.
*/
taxExempt: boolean;
/**
* For a facility that is not tax-exempt: whether state law requires it to
* give equivalent financial assistance wording anyway. `true` prints the
* availability notice alone, with no timeline, suspension or AGB lines.
* Missing means false. Ignored when `taxExempt` is not `false`.
*/
stateNoticeRequired?: boolean;
/**
* The direct web address of the financial assistance policy, the
* application form and the plain-language summary, printed as given
* (trimmed). Missing or blank prints the "incomplete" warning in place of
* the notice.
*/
fapUrl: string;
/**
* The phone number of the office that explains the policy and the
* application process, printed as given (trimmed). Missing or blank prints
* the "incomplete" warning in place of the notice.
*/
fapPhone: string;
};
billing: {
/** ISO 4217 code for every amount printed. Defaults to USD. */
currency?: string;
/**
* The date the first post-discharge billing statement for this care was
* sent, as an ISO 8601 date: `2026-11-02`. Anything after the tenth
* character is ignored. Both clocks start here. Required whenever the
* timeline prints: the deriver throws when it is missing or not a real
* calendar date.
*/
firstPostDischargeStatementDate: string;
/**
* The date the written notice of intended extraordinary collection actions
* was sent, ISO 8601. Missing means none has been sent: the statement then
* says collection also waits for 30 days' written notice. Throws when
* present but not a real calendar date.
*/
ecaNoticeDate?: string;
/**
* The patient's financial assistance application. Missing means no
* application (`status: "none"`).
*/
application?: {
/**
* `none` and `denied` print the timeline. `pending` prints the
* suspension. `approved` prints by `discount`. Missing means `none`;
* any other value throws.
*/
status?: "none" | "pending" | "approved" | "denied";
/**
* What an approval gives. Read only when `status` is `approved`, where
* it is required: missing or any other value throws, because a wrong
* amount on this notice is worse than no statement.
*/
discount?: "free" | "partial";
};
/**
* Gross charges for this care, before any discount, in `currency`.
* Required for an approved partial discount (it is what AGB is a
* percentage of): missing, negative or not finite throws there. Read
* nowhere else.
*/
grossCharges?: number;
/**
* The AGB percentage, `37.85` for 37.85%, to at most two decimal places
* (more are rounded to two). Required for an approved partial discount:
* missing, not finite, 0 or below, or above 100 throws there.
*/
agbPercent?: number;
/**
* What the statement would otherwise ask for, after the policy's own
* discount. Read only for an approved partial discount. Missing means the
* patient owes the AGB figure. Given, the patient owes the lower of this
* and AGB. Negative or not finite throws: a credit is not a balance this
* notice caps.
*/
balanceDue?: number;
};
}
/**
* The financial assistance notice and, by the patient's position, the
* collections and application dates, the suspension, or the AGB-capped balance.
*/
export const FinancialAssistanceNotice: Nodes = async () => {
const [{ facility, billing }] = useState((d: FinancialAssistanceData) => ({
facility: d.facility,
billing: d.billing,
}));
const fa = await useDeriver(financialAssistanceNotice, [facility, billing]);
return (
<>
{fa.notice && <Paragraph id="financial-assistance-notice">{fa.notice}</Paragraph>}
{fa.noticeIncomplete && (
<Paragraph id="financial-assistance-notice-incomplete">{fa.noticeIncomplete}</Paragraph>
)}
{fa.suspended && <Paragraph id="financial-assistance-suspended">{fa.suspended}</Paragraph>}
{fa.free && <Paragraph id="financial-assistance-free">{fa.free}</Paragraph>}
{fa.agbBasis && <Paragraph id="financial-assistance-agb-basis">{fa.agbBasis}</Paragraph>}
{fa.owed && <Paragraph id="financial-assistance-owed">{fa.owed}</Paragraph>}
{fa.collections && <Paragraph id="financial-assistance-collections">{fa.collections}</Paragraph>}
{fa.apply && <Paragraph id="financial-assistance-apply">{fa.apply}</Paragraph>}
</>
);
}; derivers/financial-assistance-notice.deriver.ts import { deriver } from "docxcelerate/template";
/**
* Decides every line of a 501(r) financial assistance block: the notice, the
* collections and application dates, the suspension, and the AGB cap. Installed
* by `dxcl add financial-assistance-notice`.
*
* It is self-contained on purpose:
* it travels to the engine as source text, so a module-level constant or helper
* would be a ReferenceError there. Date helpers, formatters and wording are all
* declared inside it.
*/
export default deriver({
name: "financialAssistanceNotice",
run: (facility: unknown, billing: unknown) => {
// deno-lint-ignore no-explicit-any
const fac = (facility ?? {}) as any;
// deno-lint-ignore no-explicit-any
const bil = (billing ?? {}) as any;
const out: Record<
"notice" | "noticeIncomplete" | "collections" | "apply" | "suspended" | "free" | "agbBasis" | "owed",
string | null
> = {
notice: null,
noticeIncomplete: null,
collections: null,
apply: null,
suspended: null,
free: null,
agbBasis: null,
owed: null,
};
const forProfit = fac.taxExempt === false;
if (forProfit && fac.stateNoticeRequired !== true) return out;
const url = typeof fac.fapUrl === "string" ? fac.fapUrl.trim() : "";
const phone = typeof fac.fapPhone === "string" ? fac.fapPhone.trim() : "";
if (url !== "" && phone !== "") {
out.notice = "Financial assistance is available. If you are worried about paying this bill, " +
"you may qualify for free or discounted care under our financial assistance policy. " +
"A free copy of the policy, the application form and a plain-language summary of the policy are at " +
url + ", or call " + phone + " and we will send them to you.";
} else {
out.noticeIncomplete = "Financial assistance notice incomplete: this statement must give the phone number " +
"and web address where the financial assistance policy can be obtained, and at least one is missing. " +
"Add them before this statement is sent.";
}
if (forProfit) return out;
const isoDate = (value: unknown, field: string): string => {
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}/.test(value)) {
throw new Error(field + " must be an ISO 8601 date");
}
const iso = value.slice(0, 10);
const [y, m, d] = iso.split("-").map(Number);
if (new Date(Date.UTC(y, m - 1, d)).toISOString().slice(0, 10) !== iso) {
throw new Error(field + " is not a real calendar date");
}
return iso;
};
// Whole UTC calendar days, so the date does not shift on the engine.
const addDays = (iso: string, n: number): string => {
const [y, m, d] = iso.split("-").map(Number);
return new Date(Date.UTC(y, m - 1, d + n)).toISOString().slice(0, 10);
};
const dateFormat = new Intl.DateTimeFormat("en-US", { dateStyle: "long", timeZone: "UTC" });
const fmtDate = (iso: string) => dateFormat.format(new Date(iso + "T00:00:00Z"));
const first = isoDate(bil.firstPostDischargeStatementDate, "billing.firstPostDischargeStatementDate");
const hasEca = bil.ecaNoticeDate !== undefined && bil.ecaNoticeDate !== null && bil.ecaNoticeDate !== "";
const ecaNotice = hasEca ? isoDate(bil.ecaNoticeDate, "billing.ecaNoticeDate") : null;
const status = bil.application?.status ?? "none";
if (!["none", "pending", "approved", "denied"].includes(status)) {
throw new Error("billing.application.status must be one of none, pending, approved, denied");
}
const discount = bil.application?.discount;
if (status === "approved" && discount !== "free" && discount !== "partial") {
throw new Error("billing.application.discount must be free or partial when the application is approved");
}
// Day 120 after the statement is the first permitted day; the later of the
// two clocks wins, and the application window never ends before it.
const ecaBar = addDays(first, 120);
const earliestEca = ecaNotice !== null && addDays(ecaNotice, 30) > ecaBar ? addDays(ecaNotice, 30) : ecaBar;
const lastApply = addDays(first, 240) > earliestEca ? addDays(first, 240) : earliestEca;
const collections = "We will not take extraordinary collection action on this bill, such as reporting it to a " +
"credit agency, selling the debt or taking legal action, before " +
fmtDate(earliestEca) +
(ecaNotice === null ? ", and not until at least 30 days after we have written to you to say that we intend to." : ".");
if (status === "none" || status === "denied") {
out.collections = collections;
out.apply = "You can apply for financial assistance until " + fmtDate(lastApply) +
". If you apply in that time, we will consider your application even if collection action has begun.";
} else if (status === "pending") {
out.suspended = "We have received your application for financial assistance. While we consider it, we have " +
"stopped all extraordinary collection action on this bill, and we will not start any until we have told you " +
"our decision in writing.";
} else if (discount === "free") {
out.free = "You qualify for free care under our financial assistance policy. You owe nothing for this care.";
} else {
const gross = bil.grossCharges;
const pct = bil.agbPercent;
const due = bil.balanceDue;
if (typeof gross !== "number" || !Number.isFinite(gross) || gross < 0) {
throw new Error("billing.grossCharges must be a finite number of at least 0 for a partial approval");
}
if (typeof pct !== "number" || !Number.isFinite(pct) || pct <= 0 || pct > 100) {
throw new Error("billing.agbPercent must be above 0 and at most 100 for a partial approval");
}
const hasDue = due !== undefined && due !== null;
if (hasDue && (typeof due !== "number" || !Number.isFinite(due) || due < 0)) {
throw new Error("billing.balanceDue must be a finite number of at least 0");
}
// Integer arithmetic: a float times a float rounds 2.01 * 50% down a cent.
const grossCents = Math.round(gross * 100);
const bp = Math.round(pct * 100);
const agbCents = Math.floor((grossCents * bp + 5000) / 10000);
const money = new Intl.NumberFormat("en-US", {
style: "currency",
currency: typeof bil.currency === "string" && bil.currency !== "" ? bil.currency : "USD",
});
const fmtMoney = (cents: number) => money.format(cents / 100);
const pctText = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 }).format(bp / 100);
const agb = fmtMoney(agbCents);
out.agbBasis = "You qualify for financial assistance, so you cannot be charged more than the amounts " +
"generally billed (AGB) to patients who have insurance for this care. Our AGB is " + pctText +
"% of gross charges: " + pctText + "% of " + fmtMoney(grossCents) + " is " + agb + ".";
if (!hasDue) {
out.owed = "Amount you owe for this care: " + agb + ".";
} else {
const balanceCents = Math.round(due * 100);
out.owed = balanceCents > agbCents
? "Amount you owe for this care: " + agb + ". This is the AGB limit, not the " + fmtMoney(balanceCents) +
" that would otherwise have been billed."
: "Amount you owe for this care: " + fmtMoney(balanceCents) +
". This is below the AGB limit, so the limit does not change it.";
}
out.collections = collections;
}
return out;
},
});