Skip to content
Closed
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
257 changes: 4 additions & 253 deletions packages/flow/openadapt_flow/form_tx/pack_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
FieldAnchorSpec,
FieldBindingSpec,
FieldCodecSpec,
FormCodecKind,
FormPack,
FormSnapshot,
ObservedControl,
Expand Down Expand Up @@ -149,258 +148,10 @@ def build_patient_registration_domain_schema() -> CanonicalDomainSchema:


def build_property_quote_domain_schema() -> CanonicalDomainSchema:
"""Build generic residential/commercial property quote domain schema."""
return CanonicalDomainSchema(
schema_id="property_quote.v1",
fields=(
CanonicalFieldSpec(
dossier_key="applicant_first_name",
synonyms=(
"applicant first name",
"insured first name",
"primary insured first name",
"first name",
"given name",
"applicant_first_name",
"insured_fname",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.WHITESPACE_COLLAPSE),
section_hints=("applicant", "insured", "policyholder", "client"),
required=True,
),
CanonicalFieldSpec(
dossier_key="applicant_last_name",
synonyms=(
"applicant last name",
"insured last name",
"primary insured last name",
"last name",
"surname",
"applicant_last_name",
"insured_lname",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.WHITESPACE_COLLAPSE),
section_hints=("applicant", "insured", "policyholder", "client"),
required=True,
),
CanonicalFieldSpec(
dossier_key="effective_date",
synonyms=(
"effective date",
"policy effective date",
"coverage start date",
"inception date",
"effective_date",
),
expected_codec=FieldCodecSpec(
kind=FormCodecKind.ISO_DATE, date_order="MDY"
),
section_hints=("policy", "term", "coverage", "quote"),
required=False,
),
CanonicalFieldSpec(
dossier_key="property_street_address",
synonyms=(
"property street address",
"property address",
"risk address",
"location address",
"dwelling address",
"street address",
"premises address",
"property_address",
"risk_street",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.WHITESPACE_COLLAPSE),
section_hints=("property", "location", "risk", "dwelling", "premises"),
required=True,
triggers_re_render_hint=True,
),
CanonicalFieldSpec(
dossier_key="property_city",
synonyms=(
"property city",
"risk city",
"location city",
"city",
"property_city",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.WHITESPACE_COLLAPSE),
section_hints=("property", "location", "risk", "dwelling"),
required=False,
),
CanonicalFieldSpec(
dossier_key="property_state",
synonyms=(
"property state",
"risk state",
"location state",
"state",
"province",
"property_state",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.UPPER),
section_hints=("property", "location", "risk", "dwelling"),
required=False,
triggers_re_render_hint=True,
),
CanonicalFieldSpec(
dossier_key="property_postal_code",
synonyms=(
"property postal code",
"property zip",
"risk zip",
"location zip",
"postal code",
"zip code",
"zip",
"property_postal_code",
"risk_zip",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.WHITESPACE_COLLAPSE),
section_hints=("property", "location", "risk", "dwelling"),
required=True,
triggers_re_render_hint=True,
),
CanonicalFieldSpec(
dossier_key="year_built",
synonyms=(
"year built",
"construction year",
"yr built",
"year of construction",
"year_built",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.INTEGER),
section_hints=(
"construction",
"building",
"dwelling",
"property",
"risk",
),
required=True,
),
CanonicalFieldSpec(
dossier_key="square_footage",
synonyms=(
"square footage",
"total square feet",
"living area",
"heated sq ft",
"sq ft",
"sqft",
"square_footage",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.INTEGER),
section_hints=("construction", "building", "dwelling", "property"),
required=False,
),
CanonicalFieldSpec(
dossier_key="construction_type",
synonyms=(
"construction type",
"frame type",
"building construction",
"structure type",
"exterior construction",
"construction_type",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.CASEFOLD),
section_hints=("construction", "building", "dwelling"),
required=False,
triggers_re_render_hint=True,
),
CanonicalFieldSpec(
dossier_key="roof_material",
synonyms=(
"roof material",
"roof type",
"roof covering",
"roofing",
"roof_material",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.CASEFOLD),
section_hints=("construction", "roof", "building", "dwelling"),
required=False,
),
CanonicalFieldSpec(
dossier_key="dwelling_coverage_amount",
synonyms=(
"dwelling coverage amount",
"dwelling coverage",
"coverage a limit",
"coverage a",
"replacement cost",
"building limit",
"insured value",
"dwelling limit",
"dwelling_coverage",
"coverage_amount",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.CURRENCY_CENTS),
section_hints=("coverage", "limits", "rating", "valuation"),
required=True,
triggers_re_render_hint=True,
),
CanonicalFieldSpec(
dossier_key="deductible_amount",
synonyms=(
"deductible amount",
"all peril deductible",
"policy deductible",
"deductible",
"deductible_amount",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.CURRENCY_CENTS),
section_hints=("coverage", "limits", "deductible", "rating"),
required=False,
),
CanonicalFieldSpec(
dossier_key="monitored_alarm",
synonyms=(
"monitored alarm",
"central station alarm",
"protective alarm",
"security alarm",
"burglar alarm",
"monitored_alarm",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.BOOLEAN_YES_NO),
section_hints=("discounts", "protection", "safety", "property"),
required=False,
),
),
expected_outputs=(
CanonicalFieldSpec(
dossier_key="quote_number",
synonyms=(
"quote number",
"quote id",
"proposal number",
"quote reference",
"quote_number",
"quote_id",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.WHITESPACE_COLLAPSE),
required=True,
),
CanonicalFieldSpec(
dossier_key="annual_premium",
synonyms=(
"annual premium",
"total premium",
"quoted premium",
"estimated annual premium",
"premium",
"annual_premium",
"quoted_premium",
),
expected_codec=FieldCodecSpec(kind=FormCodecKind.CURRENCY_CENTS),
required=True,
),
),
)
"""The property insurance quote preset (``presets/property_quote.json``)."""
from openadapt_flow.form_tx.presets import load_domain_schema

return load_domain_schema("property_quote")


def _scrub_snapshot_values(snapshot: FormSnapshot) -> FormSnapshot:
Expand Down
Loading
Loading