References/Facility Config
More languages
More actions
Holds one facility's billing configuration: a discount-code catalog, discount component definitions, a discount-stacking rule, and the invoice-number template. The Django model FacilityMonetoryConfig stores all of it, but three fields are plain JSONFields whose shape, enums, and validation live in the Pydantic specs that drive the API. Both layers are documented here.
Sources:
- Model: [https://github.com/ohcnetwork/care/blob/develop/care/emr/models/facility_config.py
care/emr/models/facility_config.py] - Spec: [https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/facility/spec.py
care/emr/resources/facility/spec.py] - Monetary types: [https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/common/monetary_component.py
care/emr/resources/common/monetary_component.py] - Coding: [https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/common/coding.py
care/emr/resources/common/coding.py] - Expression evaluator: [https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/invoice/default_expression_evaluator.py
care/emr/resources/invoice/default_expression_evaluator.py] - API viewset: [https://github.com/ohcnetwork/care/blob/develop/care/emr/api/viewsets/facility.py
care/emr/api/viewsets/facility.py]
Models
| Model | Purpose |
|---|---|
FacilityMonetoryConfig
|
Per-facility billing config: facility-scoped discount codes, discount monetary component definitions, a discount-stacking rule, and the invoice-number expression |
FacilityMonetoryConfig extends EMRBaseModel, so it inherits external_id, created_date/modified_date, soft-delete via deleted, created_by/updated_by, and the history/meta JSON fields.
FacilityMonetoryConfig fields
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
facility |
OneToOneField → Facility |
yes | ||
discount_codes |
JSONField → list[Coding] |
no | ||
discount_monetary_components |
JSONField → list[MonetaryComponentDefinition] |
no | ||
discount_configuration |
JSONField → DiscountConfiguration |
no | ||
invoice_number_expression |
CharField(1000) |
no |
discount_codes,discount_monetary_components, anddiscount_configurationare declared as plainJSONFields. The database accepts any JSON — their structure is enforced only at the API layer by the Pydantic specs below.
JSON field shapes
Coding shape
Each discount_codes[] entry is a Coding object (model_config = extra="forbid", so unknown keys are rejected).
| Field | Type | Required | Notes |
|---|---|---|---|
system |
str |
no | |
version |
str |
no | |
code |
str |
yes | |
display |
str |
no |
MonetaryComponentDefinition shape
Each discount_monetary_components[] entry subclasses MonetaryComponent and adds title. Definition mode overrides or disables the base duplicate-code and amount-or-factor checks, but rejects a base-typed component outright.
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
title |
str |
yes | ||
monetary_component_type |
MonetaryComponentType enum |
yes | ||
code |
Coding |
no | ||
factor |
Decimal |
no | ||
amount |
Decimal |
no | ||
tax_included_amount |
Decimal |
no | ||
global_component |
bool |
no | ||
conditions |
list[EvaluatorConditionSpec] |
no |
EvaluatorConditionSpec (each conditions[] entry):
| Field | Type | Required | Notes |
|---|---|---|---|
metric |
str |
yes
... content truncated for display in this response but full source used in update ... Related
|