diff --git a/.gitattributes b/.gitattributes index 8d8ef37..35a9c48 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,6 @@ -# Set the default behavior, in case people don't have core.autocrlf set. -text eol=crlf \ No newline at end of file +# Ensure epilog files always use CRLF line endings +*.epilogscript text eol=crlf +*.epilogbuild text eol=crlf +*.metadata text eol=crlf +*.hdf text eol=crlf +*.hrf text eol=crlf \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Deploy/berlitz.hdf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Deploy/berlitz.hdf new file mode 100644 index 0000000..6e32a8f --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Deploy/berlitz.hdf @@ -0,0 +1,213 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Base Relations +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +berlitz(claim.first_hospital_can_provide_emergency_services(C, yes), + "the first hospital to which the patient in $C$ was taken can provide the emergency services that the patient needs.") +berlitz(claim.first_hospital_can_provide_emergency_services(C, no), + "the first hospital to which the patient in $C$ was taken cannot provide the emergency services that the patient needs.") + +berlitz(claim.ambulance_service_from_one_hospital_to_another(C, yes), + "the ambulance service for the patient in $C$ was from one hospital to another.") +berlitz(claim.ambulance_service_from_one_hospital_to_another(C, no), + "the ambulance service for the patient in $C$ was not from one hospital to another.") + +berlitz(claim.is_the_only_safe_way_to_transport_you(C, yes), + "the type of transportation used to transport the patient in $C$ was the only safe way to transport the patient.") +berlitz(claim.is_the_only_safe_way_to_transport_you(C, no), + "the type of transportation used to transport the patient in $C$ was not the only safe way to transport the patient.") + +berlitz(claim.type_of_non_emergency_transportation(C, T), + "the patient in $C$ was transported by a $T$") + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Defined Relations +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +berlitz(is_covered_emergency_ambulance_service(C), + "$C$ is a covered emergency ambulance service") + +berlitz(is_covered_non_emergency_ambulance_service(C), + "$C$ is a covered non-emergency ambulance service") + +berlitz(is_covered_type_of_non_emergency_transportation(C), + "the type of transportation used to transport the patient in $C$ is a covered type of emergency transportation") + +berlitz(ambulance_service(S), + "$S$ is an ambulance service") +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Base Relations +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%% Claim relations %%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%% Claim type-generic %%%%%%%%%%%%%%%%%%%%%%% +berlitz(claim.patient(C, P), + "the patient in $C$ is $P$") + +% berlitz(claim.quarter_enrolled_stanford_2024_2025(C, Q), +% "$Q$ is the first quarter that the patient in $C$ was enrolled in Stanford in the 2023-2024 academic year") + + +berlitz(claim.date_service_received(C, D), + "the service in $C$ was received on $D$") + +berlitz(claim.service_type(C, S), + "the service in $C$ has type $S$") + +berlitz(claim.precertification_received(C, yes), + "precertification was received for the service in $C$") +berlitz(claim.precertification_received(C, no), + "precertification was not received for the service in $C$") + + +% berlitz(claim.waived_cardinal_care(C, yes), +% "Cardinal Care was waived") +% berlitz(claim.waived_cardinal_care(C, no), +% "Cardinal Care was not waived") + + +berlitz(claim.location_service_received(C, L), + "the service in $C$ was received at $L$") + + +berlitz(claim.service_available_at_tier_one_or_two_location(C, yes), + "the service in $C$ is available at a tier one or tier two location") +berlitz(claim.service_available_at_tier_one_or_two_location(C, no), + "the service in $C$ is not available at a tier one or tier two location") + + +%%%%%%%%%%%%%%%%%%%%%%%%%%% General Exclusions %%%%%%%%%%%%%%%%%%%%%%%%%%% + +% berlitz(claim.reception_of_service_or_supplies_resulted_from_service_in_armed_forces(C, yes), +% "the service in $C$ was received from a provider as a result of an injury sustained, or illness contracted, while in the service of the armed forces of any country") +% berlitz(claim.reception_of_service_or_supplies_resulted_from_service_in_armed_forces(C, no), +% "the service in $C$ was not received from a provider as a result of an injury sustained, or illness contracted, while in the service of the armed forces of any country") + +% berlitz(claim.service_or_supplies_provided_by_provider_acting_beyond_scope_of_legal_authority(C, yes), +% "the service in $C$ was provided by a provider that was acting beyond the scope of its legal authority, (I.e. the provider was not licensed/certified to provide the health care services they provided to the patient)") +% berlitz(claim.service_or_supplies_provided_by_provider_acting_beyond_scope_of_legal_authority(C, no), +% "the service in $C$ was not provided by a provider that was acting beyond the scope of its legal authority, (I.e. the provider was licensed/certified to provide the health care services they provided to the patient)") + +% berlitz(claim.service_is_clinical_trial_therapy_experimental_investigational(C, yes), +% "the service in $C$ was an experimental or investigational clinical trial therapy") +% berlitz(claim.service_is_clinical_trial_therapy_experimental_investigational(C, no), +% "the service in $C$ was not an experimental or investigational clinical trial therapy") + +% berlitz(claim.service_is_genetic_care(C, yes), +% "the service in $C$ altered the body's genes, genetic make-up, or the expression of the body's genes") +% berlitz(claim.service_is_genetic_care(C, no), +% "the service in $C$ did not alter the body's genes, genetic make-up, or the expression of the body's genes") + +% berlitz(claim.service_for_correction_of_congenital_birth_defects(C, yes), +% "the service in $C$ was for the correction of congenital birth defects") +% berlitz(claim.service_for_correction_of_congenital_birth_defects(C, no), +% "the service in $C$ was not for the correction of congenital birth defects") + +% berlitz(claim.payment_for_service_made_for_judgment_settlement(C, yes), +% "the payment for the service in $C$ was made as a judgment or settlement by any person deemed responsible for an injury or illness, or by their insurers") +% berlitz(claim.payment_for_service_made_for_judgment_settlement(C, no), +% "the payment for the service in $C$ was not made as a judgment or settlement by any person deemed responsible for an injury or illness, or by their insurers") + +% berlitz(claim.service_provided_by_family_member(C, yes), +% "the service in $C$ was provided by a spouse, domestic partner, civil union partner, parent, child, step-child, brother, sister, in-law or any household member of the patient") +% berlitz(claim.service_provided_by_family_member(C, no), +% "the service in $C$ was not provided by a spouse, domestic partner, civil union partner, parent, child, step-child, brother, sister, in-law or any household member of the patient") + +% berlitz(claim.treated_in_facility_owned_or_operated_by_governmental_entity(C, yes), +% "the service in $C$ was received in a facility owned or operated by any federal, state, or other governmental entity") +% berlitz(claim.treated_in_facility_owned_or_operated_by_governmental_entity(C, no), +% "the service in $C$ was not received in a facility owned or operated by any federal, state, or other governmental entity") + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% builtins +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +berlitz(member(E, L), + "$E$ is one of $L$") + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Defined Relations +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% berlitz(covered_under_policy(C, P, T), +% "$C$ is covered under $P$ which is an instance of $T$") + + +% berlitz(policy_in_effect(C, P), +% "$P$ is in effect during $C$") + + +berlitz(service_received_at_valid_provider(C), + "the service in $C$ was received at a valid provider") + +berlitz(meets_additional_eligibility_requirements_if_present(C), + "$C$ meets additional eligibility requirements, if there are any") + + +berlitz(medically_necessary_service(C), + "the service received in $C$ is medically necessary") + + +berlitz(precertified_if_necessary(C), + "the service in $C$ was precertified, if necessary") + + +berlitz(beyond_limits(C), + "the service in $C$ is beyond limits on coverage") + + +berlitz(general_exclusion_applies(C), + "one or more general exclusions apply to $C$") + + +% berlitz(policy_in_effect_for_claim(POL, C), +% "$POL$ is in effect for $C$") + + +berlitz(date_between_dates_incl(ServiceDate, StartDate, EndDate), + "$ServiceDate$ is between $StartDate$ and $EndDate$, inclusive") + + +berlitz(covered_under_cardinal_care_24_25_benefit(C, B), + "$C$ is covered under the Cardinal Care 2024-2025 benefit $B$") + +berlitz(patient_age_at_time_of_service(C, A), + "the age of the patient in $C$ at the time of the service is $A$") + +berlitz(patient_age_on_date(DOB, D, A), + "the age of the patient with date of birth $DOB$ on $D$ is $A$") + +berlitz(age_at_time_of_service(C, P, A), + "the age of $P$ at the time of the service in $C$ is $A$") + +berlitz(age_on_date(P, D, A), + "the age of $P$ on $D$ is $A$") + +berlitz(datetimetotimestamp(D, T, S), + "the timestamp for $D$ and $T$ is $S$") + + +berlitz(requires_precertification(S), + "$S$ requires precertification") + + +berlitz(not_yet_birthday_delta(M, D, DOBM, DOBD, -1), + "on the date $M$ $D$ it is not yet the person's birthday") +berlitz(not_yet_birthday_delta(M, D, DOBM, DOBD, 0), + "on the date $M$ $D$ it is not before the person's birthday") + +berlitz(n_months_diff(D1, D2, N), + "the number of months between $D1$ and $D2$ is $N$") + +% Note: D1 and D2 are integers. This Berlitz entry is meant to give context around this relation's usage, if not its formal definition. +berlitz(not_yet_day_of_month_delta(D1, D2, 0), + "the day of the month in the first date is at least that of the second date") +berlitz(not_yet_day_of_month_delta(D1, D2, -1), + "the day of the month in the first date is less than that of the second date") + + +berlitz(is_preventive_care_service(S), + "$S$ is a preventive care service") diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Deploy/metadata.metadata b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Deploy/metadata.metadata new file mode 100644 index 0000000..470600c --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Deploy/metadata.metadata @@ -0,0 +1,164 @@ + +%%%%%%%%%%%%%%%%%%%%%%%%%%% Policy relations %%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% type(policy, class) +%%% attribute(policy, policy.type) +%%% attribute(policy, policy.insuree) + +%%% type(policy.type, attributerelation) +%%% domain(policy.type, policy) +%%% codomain(policy.type, product) +%%% unique(policy.type, yes) +%%% total(policy.type, yes) + +%%% type(policy.insuree, attributerelation) +%%% domain(policy.insuree, policy) +%%% codomain(policy.insuree, person) +%%% unique(policy.insuree, no) +%%% total(policy.insuree, yes) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%% Person relations %%%%%%%%%%%%%%%%%%%%%%%%%%% +% type(person, class) +% attribute(person, person.dob) + +% type(person.dob, attributerelation) +% domain(person.dob, person) +% codomain(person.dob, date) +% unique(person.dob, yes) +% total(person.dob, yes) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%% Claim relations %%%%%%%%%%%%%%%%%%%%%%%%%%% +type(claim, class) + +%%%%%%%%%%%%%%%%%%%%%%% Claim type-generic %%%%%%%%%%%%%%%%%%%%%%% +%attribute(ambulance_service_coverage, claim.patient) +attribute(ambulance_service_coverage, claim.patient_dob) +%%% attribute(ambulance_service_coverage, claim.quarter_enrolled_stanford_2024_2025) +attribute(ambulance_service_coverage, claim.date_service_received) +attribute(ambulance_service_coverage, claim.service_type) +attribute(ambulance_service_coverage, claim.precertification_received) +%%% attribute(ambulance_service_coverage, claim.waived_cardinal_care) +attribute(ambulance_service_coverage, claim.location_service_received) +attribute(ambulance_service_coverage, claim.service_available_at_tier_one_or_two_location) + +% type(claim.patient, attributerelation) +% domain(claim.patient, ambulance_service_coverage) +% codomain(claim.patient, person) +% unique(claim.patient, yes) +% total(claim.patient, yes) + +type(claim.patient_dob, attributerelation) +domain(claim.patient_dob, ambulance_service_coverage) +codomain(claim.patient_dob, date) +unique(claim.patient_dob, yes) +total(claim.patient_dob, yes) +changestyle(claim.patient_dob,datestyle) + + +%%% type(claim.quarter_enrolled_stanford_2024_2025, attributerelation) +%%% domain(claim.quarter_enrolled_stanford_2024_2025, ambulance_service_coverage) +%%% codomain(claim.quarter_enrolled_stanford_2024_2025, quarter_2023_2024) +%%% unique(claim.quarter_enrolled_stanford_2024_2025, yes) +%%% total(claim.quarter_enrolled_stanford_2024_2025, no) + +type(claim.date_service_received, attributerelation) +domain(claim.date_service_received, ambulance_service_coverage) +codomain(claim.date_service_received, date) +unique(claim.date_service_received, yes) +total(claim.date_service_received, yes) +changestyle(claim.date_service_received,datestyle) + +type(claim.service_type, attributerelation) +domain(claim.service_type, ambulance_service_coverage) +codomain(claim.service_type, cardinal_care_2024_2025_service) +unique(claim.service_type, yes) +total(claim.service_type, yes) +changestyle(claim.service_type,selector) + +type(claim.precertification_received, attributerelation) +domain(claim.precertification_received, ambulance_service_coverage) +codomain(claim.precertification_received, boolean) +unique(claim.precertification_received, yes) +total(claim.precertification_received, yes) +changestyle(claim.precertification_received,selector) + +%%% type(claim.waived_cardinal_care, attributerelation) +%%% domain(claim.waived_cardinal_care, ambulance_service_coverage) +%%% codomain(claim.waived_cardinal_care, boolean) +%%% unique(claim.waived_cardinal_care, yes) +%%% total(claim.waived_cardinal_care, yes) + +type(claim.location_service_received, attributerelation) +domain(claim.location_service_received, ambulance_service_coverage) +codomain(claim.location_service_received, cardinal_care_2024_2025_location) +unique(claim.location_service_received, yes) +total(claim.location_service_received, yes) +changestyle(claim.location_service_received,selector) + +type(claim.service_available_at_tier_one_or_two_location, attributerelation) +domain(claim.service_available_at_tier_one_or_two_location, ambulance_service_coverage) +codomain(claim.service_available_at_tier_one_or_two_location, boolean) +unique(claim.service_available_at_tier_one_or_two_location, yes) +total(claim.service_available_at_tier_one_or_two_location, yes) +changestyle(claim.service_available_at_tier_one_or_two_location,selector) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Classes without attributes +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +type(boolean,class) +type(person,class) +type(product,class) +type(date,class) +type(number,class) + +type(quarter_2024_2025, class) +type(cardinal_care_2024_2025_location, class) +type(cardinal_care_2024_2025_service, class) +type(ambulance_service_coverage, class) +superclass(ambulance_service_coverage, claim) +attribute(ambulance_service_coverage, claim.first_hospital_can_provide_emergency_services) +attribute(ambulance_service_coverage, claim.ambulance_service_from_one_hospital_to_another) +attribute(ambulance_service_coverage, claim.non_emergency_transport_is_precertified) +attribute(ambulance_service_coverage, claim.is_the_only_safe_way_to_transport_you) +attribute(ambulance_service_coverage, claim.type_of_non_emergency_transportation) + +type(claim.first_hospital_can_provide_emergency_services, attributerelation) +domain(claim.first_hospital_can_provide_emergency_services, claim) +codomain(claim.first_hospital_can_provide_emergency_services, boolean) +unique(claim.first_hospital_can_provide_emergency_services, yes) +total(claim.first_hospital_can_provide_emergency_services, no) +changestyle(claim.first_hospital_can_provide_emergency_services, selector) + +type(claim.ambulance_service_from_one_hospital_to_another, attributerelation) +domain(claim.ambulance_service_from_one_hospital_to_another, claim) +codomain(claim.ambulance_service_from_one_hospital_to_another, boolean) +unique(claim.ambulance_service_from_one_hospital_to_another, yes) +total(claim.ambulance_service_from_one_hospital_to_another, no) +changestyle(claim.ambulance_service_from_one_hospital_to_another, selector) + +type(claim.is_the_only_safe_way_to_transport_you, attributerelation) +domain(claim.is_the_only_safe_way_to_transport_you, claim) +codomain(claim.is_the_only_safe_way_to_transport_you, boolean) +unique(claim.is_the_only_safe_way_to_transport_you, yes) +total(claim.is_the_only_safe_way_to_transport_you, no) +changestyle(claim.is_the_only_safe_way_to_transport_you, selector) + +type(claim.type_of_non_emergency_transportation, attributerelation) +domain(claim.type_of_non_emergency_transportation, claim) +codomain(claim.type_of_non_emergency_transportation, type_of_non_emergency_transportation) +unique(claim.type_of_non_emergency_transportation, yes) +total(claim.type_of_non_emergency_transportation, no) +changestyle(claim.type_of_non_emergency_transportation, selector) + +type(type_of_non_emergency_transportation, class) +%%%%%%%%%%%%%%%%%%%%%%% General Exclusions %%%%%%%%%%%%%%%%%%%%%%% +attribute(ambulance_service_coverage, claim.exclusions) + +type(claim.exclusions, attributerelation) +domain(claim.exclusions, ambulance_service_coverage) +codomain(claim.exclusions, general_exclusion) +unique(claim.exclusions, yes) +total(claim.exclusions, yes) +changestyle(claim.exclusions, checkboxfield) diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Deploy/rules.hrf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Deploy/rules.hrf new file mode 100644 index 0000000..0d3e9e1 --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Deploy/rules.hrf @@ -0,0 +1,261 @@ +covered_under_cardinal_care_24_25_benefit(C, ambulance_service_benefit) :- + claim.service_type(C, emergency_ambulance_service) & + is_covered_emergency_ambulance_service(C) + +% Assuming ambulance service to first hospital (i.e. NOT from one hospital to +% another) is covered *regardless* of whether the first hospital can provide +% emergency services. +is_covered_emergency_ambulance_service(C) :- + claim.is_ambulance_service_from_one_hospital_to_another(C, no) + +is_covered_emergency_ambulance_service(C) :- + claim.can_first_hospital_provide_emergency_services(C, no) & + claim.is_ambulance_service_from_one_hospital_to_another(C, yes) + +covered_under_cardinal_care_24_25_benefit(C, ambulance_service_benefit) :- + claim.service_type(C, non_emergency_ambulance_service) & + is_covered_non_emergency_ambulance_service(C) + +is_covered_non_emergency_ambulance_service(C) :- + is_covered_type_of_non_emergency_transportation(C) & + claim.is_the_only_safe_way_to_transport_you(C, yes) + +is_covered_type_of_non_emergency_transportation(C) :- + claim.type_of_non_emergency_transportation(C, T) & + member(T, [ + licensed_ambulance, + licensed_psychiatric_transport_van + ]) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Precertified if necessary +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +requires_precertification(non_emergency_ambulance_service) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Medical necessity +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Preventive care is a larger category of benefits, including immunizations +is_preventive_care_service(ServiceType) :- + ambulance_service(ServiceType) + +% Is a service under the ambulance service benefit +ambulance_service(emergency_ambulance_service) +ambulance_service(non_emergency_ambulance_service) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Limitations from Schedule of Benefits +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% No limitations listed in the PDBS +% covers(Policy, C) :- +% policy.type(Policy, aetna_cardinal_care_2023_2024) & +% covered_under_policy(C, Policy, aetna_cardinal_care_2023_2024) + + +%covered_under_policy(C, Policy, aetna_cardinal_care_2023_2024) :- +covered(C) :- + % policy_in_effect(C, Policy) & + service_received_at_valid_provider(C) & + meets_additional_eligibility_requirements_if_present(C) & + medically_necessary_service(C) & + precertified_if_necessary(C) & + ~beyond_limits(C) & + claim.exclusions(C, nil) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Policy in effect +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Important note: Does not currently capture conditions on withdrawal/leaves of absence, coverage on another Stanford-offered plan, or special extensions on coverage dates + +% Whether the policy was in effect when the service was received +% policy_in_effect(C, Policy) :- +% claim.patient(C, Patient) & +% claim.waived_cardinal_care(C, no) & +% policy_in_effect_for_claim(Policy, C) + + +% Student enrolled in Autumn 2024 +% policy_in_effect_for_claim(Policy, Claim) :- +% claim.date_service_received(Claim, ServiceDate) & +% claim.quarter_enrolled_stanford_2024_2025(Claim, autumn_quarter_2024) & +% date_between_dates_incl(ServiceDate, 2024_09_01, 2025_08_31) + + +% Student enrolled in Winter 2025 +% policy_in_effect_for_claim(Policy, Claim) :- +% claim.date_service_received(Claim, ServiceDate) & +% claim.quarter_enrolled_stanford_2024_2025(Claim, winter_quarter_2025) & +% date_between_dates_incl(ServiceDate, 2025_01_01, 2025_08_31) + +% Student enrolled in Spring 2025 +% policy_in_effect_for_claim(Policy, Claim) :- +% claim.date_service_received(Claim, ServiceDate) & +% claim.quarter_enrolled_stanford_2024_2025(Claim, spring_quarter_2025) & +% date_between_dates_incl(ServiceDate, 2025_04_01, 2025_08_31) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Received from a valid provider +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Important note: Encoding does not currently capture the cases where treatment began out-of-network before the policy began, or when the care is emergency or urgent care and received from an out-of-network provider + +service_received_at_valid_provider(C) :- + claim.location_service_received(C, Location) & + member(Location, [ + stanford_health_care, + menlo_medical_clinic, + sutter_health_palo_alto_medical_foundation, + tier_two_in_network + ]) + +service_received_at_valid_provider(C) :- + claim.location_service_received(C, other) & + claim.service_available_at_tier_one_or_two_location(C, no) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Eligible for service - additional eligibility requirements +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +meets_additional_eligibility_requirements_if_present(C) :- + covered_under_cardinal_care_24_25_benefit(C, B) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Medical necessity +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +medically_necessary_service(C) :- + claim.service_type(C, ServiceType) & + is_preventive_care_service(ServiceType) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Precertified if necessary +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +precertified_if_necessary(C) :- + claim.service_type(C, ServiceType) & + requires_precertification(ServiceType) & + claim.precertification_received(C, yes) + +precertified_if_necessary(C) :- + claim.service_type(C, ServiceType) & + ~requires_precertification(ServiceType) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Limitations from Schedule of Benefits +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Important Note: Loaded from other, benefit-specific rulesets + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% General exclusions +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Important Note: Formerly loaded from exclusion.hrf. Now encoded in world.hdf. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Helper functions +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +patient_age_at_time_of_service(Claim, Age) :- + claim.patient_dob(Claim, PatientDOB) & + claim.date_service_received(Claim, ServiceDate) & + patient_age_on_date(PatientDOB, ServiceDate, Age) + +patient_age_on_date(PatientDOB, Date, Age) :- + evaluate(parsedate(Date),[Year,Month,Day]) & + evaluate(parsedate(PatientDOB),[PatientDOBYear,PatientDOBMonth,PatientDOBDay]) & + evaluate(minus(Year,PatientDOBYear), YearDiff) & + not_yet_birthday_delta(Month,Day, PatientDOBMonth, PatientDOBDay, Delta) & + evaluate(plus(YearDiff, Delta), Age) + +age_at_time_of_service(Claim, Person, Age) :- + claim.date_service_received(Claim, ServiceDate) & + age_on_date(Person, ServiceDate, Age) + +age_on_date(Person, Date, Age) :- + person.dob(Person, DOB) & + evaluate(parsedate(Date),[Year,Month,Day]) & + evaluate(parsedate(DOB),[DOBYear,DOBMonth,DOBDay]) & + evaluate(minus(Year,DOBYear), YearDiff) & + not_yet_birthday_delta(Month,Day, DOBMonth, DOBDay, Delta) & + evaluate(plus(YearDiff, Delta), Age) + + +not_yet_birthday_delta(Month, Day, DOBMonth, DOBDay, -1) :- + less(Month, DOBMonth) + +not_yet_birthday_delta(Month, Day, DOBMonth, DOBDay, -1) :- + same(Month, DOBMonth) & + less(Day, DOBDay) + +not_yet_birthday_delta(Month, Day, DOBMonth, DOBDay, 0) :- + less(DOBMonth, Month) + +not_yet_birthday_delta(Month, Day, FOBMonth, DOBDay, 0) :- + same(Month, DOBMonth) & + leq(DOBDay, Day) + + +date_between_dates_incl(Date, BeginDateRange, EndDateRange) :- + symleq(BeginDateRange, Date) & + symleq(Date, EndDateRange) + +leq_n_months_diff(EarlierDate, LaterDate, N) :- + n_months_diff(EarlierDate, LaterDate, Diff) & + less(Diff, N) + +leq_n_months_diff(EarlierDate, LaterDate, N) :- + n_months_diff(EarlierDate, LaterDate, N) & + evaluate(parsedate(EarlierDate),[_,_,SameDay]) & + evaluate(parsedate(LaterDate),[_,_,SameDay]) + +n_months_diff(EarlierDate, LaterDate, N) :- + evaluate(parsedate(EarlierDate),[EY,EM,ED]) & + evaluate(parsedate(LaterDate),[LY,LM,LD]) & + evaluate(times(minus(LY, EY), 12), MonthsFromYear) & + not_yet_day_of_month_delta(ED, LD, Delta) & + evaluate(plus(MonthsFromYear, minus(LM, EM), Delta), N) + +not_yet_day_of_month_delta(D1, D2, 0) :- + leq(D1, D2) + +not_yet_day_of_month_delta(D1, D2, -1) :- + less(D2, D1) + +%%%%% Relations to faciliate choosing elements from lists that may have repeats + +% Generates all pairs (unordered) of elements from a list, counting identical elements at different positions as distinct +choose_2_with_indices_from_list_no_repeats(L, E1, I1, E2, I2) :- + choose_2_with_indices_from_sublist_no_repeats(0, L, E1, I1, E2, I2) + + +% Case 1: The first element is the head +choose_2_with_indices_from_sublist_no_repeats(NumBefore, H!T, H, NumBefore, E2, I2) :- + evaluate(plus(NumBefore, 1), NewNumBefore) & + choose_1_with_index_from_sublist(NewNumBefore, T, E2, I2) + +% Case 2: The first element is in the tail +choose_2_with_indices_from_sublist_no_repeats(NumBefore, H!T, E1, I1, E2, I2) :- + evaluate(plus(NumBefore, 1), NewNumBefore) & + choose_2_with_indices_from_sublist_no_repeats(NewNumBefore, T, E1, I1, E2, I2) + + +% Entry point +choose_1_with_index_from_list(L, E, I) :- + choose_1_with_index_from_sublist(0, L, E, I) + +% Case 1: The element is the head +choose_1_with_index_from_sublist(NumBefore, H!T, H, NumBefore) + +% Case 2: The element is in the tail +choose_1_with_index_from_sublist(NumBefore, H!T, E, I) :- + evaluate(plus(NumBefore, 1), NewNumBefore) & + choose_1_with_index_from_sublist(NewNumBefore, T, E, I) diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Deploy/world.hdf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Deploy/world.hdf new file mode 100644 index 0000000..bde6e0f --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Deploy/world.hdf @@ -0,0 +1,7 @@ +%%%%%%%% Other Services - Ambulance Service %%%%%%%% +type(emergency_ambulance_service, cardinal_care_2024_2025_service) +type(non_emergency_ambulance_service, cardinal_care_2024_2025_service) + +type(licensed_ambulance, type_of_non_emergency_transportation) +type(licensed_psychiatric_transport_van, type_of_non_emergency_transportation) +type(other, type_of_non_emergency_transportation) diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_covered1.hdf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_covered1.hdf new file mode 100644 index 0000000..a4b4bb7 --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_covered1.hdf @@ -0,0 +1,29 @@ +--- +data: + - ../../../../../Cardinal Care Core/General Exclusions/no_exclusion_claim.hdf +--- + +%%%%%% Covered example 1 %%%%%% +%%%%%% Service: emergency_ambulance_service %%%%%% + +%%% Types %%% +type(rta_bondonado, person) +type(claim1, claim) + +%%% Claim %%% +%% Service-generic %% +claim.patient_dob(claim1, 1999_06_01) +claim.date_service_received(claim1,2024_08_10) +claim.service_type(claim1, emergency_ambulance_service) +claim.precertification_received(claim1, no) + + +claim.location_service_received(claim1, stanford_health_care) +claim.service_available_at_tier_one_or_two_location(claim1, yes) + +%% Service-specific %% +claim.can_first_hospital_provide_emergency_services(claim1, no) +claim.is_ambulance_service_from_one_hospital_to_another(claim1, yes) + +%% General Exclusions %% +% Imported from no_exclusion_claim.hdf \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_covered2.hdf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_covered2.hdf new file mode 100644 index 0000000..3b4f400 --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_covered2.hdf @@ -0,0 +1,28 @@ +--- +data: + - ../../../../../Cardinal Care Core/General Exclusions/no_exclusion_claim.hdf +--- + +%%%%%% Covered example 1 %%%%%% +%%%%%% Service: emergency_ambulance_service %%%%%% + +%%% Types %%% +type(rta_bondonado, person) +type(claim1, claim) + +%%% Claim %%% +%% Service-generic %% +claim.patient_dob(claim1, 1999_06_01) +claim.date_service_received(claim1,2024_08_10) +claim.service_type(claim1, emergency_ambulance_service) +claim.precertification_received(claim1, no) + + +claim.location_service_received(claim1, stanford_health_care) +claim.service_available_at_tier_one_or_two_location(claim1, yes) + +%% Service-specific %% +claim.is_ambulance_service_from_one_hospital_to_another(claim1, no) + +%% General Exclusions %% +% Imported from no_exclusion_claim.hdf \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_covered3.hdf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_covered3.hdf new file mode 100644 index 0000000..e2887dd --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_covered3.hdf @@ -0,0 +1,29 @@ +--- +data: + - ../../../../../Cardinal Care Core/General Exclusions/no_exclusion_claim.hdf +--- + +%%%%%% Covered example 1 %%%%%% +%%%%%% Service: emergency_ambulance_service %%%%%% + +%%% Types %%% +type(rta_bondonado, person) +type(claim1, claim) + +%%% Claim %%% +%% Service-generic %% +claim.patient_dob(claim1, 1999_06_01) +claim.date_service_received(claim1,2024_08_10) +claim.service_type(claim1, non_emergency_ambulance_service) +claim.precertification_received(claim1, yes) + + +claim.location_service_received(claim1, stanford_health_care) +claim.service_available_at_tier_one_or_two_location(claim1, yes) + +%% Service-specific %% +claim.is_the_only_safe_way_to_transport_you(C, yes) +claim.type_of_non_emergency_transportation(C, licensed_psychiatric_transport_van) + +%% General Exclusions %% +% Imported from no_exclusion_claim.hdf \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_not_covered1.hdf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_not_covered1.hdf new file mode 100644 index 0000000..c826487 --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_not_covered1.hdf @@ -0,0 +1,29 @@ +--- +data: + - ../../../../../Cardinal Care Core/General Exclusions/no_exclusion_claim.hdf +--- + +%%%%%% Covered example 1 %%%%%% +%%%%%% Service: emergency_ambulance_service %%%%%% + +%%% Types %%% +type(rta_bondonado, person) +type(claim1, claim) + +%%% Claim %%% +%% Service-generic %% +claim.patient_dob(claim1, 1999_06_01) +claim.date_service_received(claim1,2024_08_10) +claim.service_type(claim1, emergency_ambulance_service) +claim.precertification_received(claim1, no) + + +claim.location_service_received(claim1, stanford_health_care) +claim.service_available_at_tier_one_or_two_location(claim1, yes) + +%% Service-specific %% +claim.can_first_hospital_provide_emergency_services(claim1, yes) +claim.is_ambulance_service_from_one_hospital_to_another(claim1, yes) + +%% General Exclusions %% +% Imported from no_exclusion_claim.hdf \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_not_covered2.hdf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_not_covered2.hdf new file mode 100644 index 0000000..db477b3 --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_not_covered2.hdf @@ -0,0 +1,29 @@ +--- +data: + - ../../../../../Cardinal Care Core/General Exclusions/no_exclusion_claim.hdf +--- + +%%%%%% Covered example 1 %%%%%% +%%%%%% Service: emergency_ambulance_service %%%%%% + +%%% Types %%% +type(rta_bondonado, person) +type(claim1, claim) + +%%% Claim %%% +%% Service-generic %% +claim.patient_dob(claim1, 1999_06_01) +claim.date_service_received(claim1,2024_08_10) +claim.service_type(claim1, non_emergency_ambulance_service) +claim.precertification_received(claim1, no) + + +claim.location_service_received(claim1, stanford_health_care) +claim.service_available_at_tier_one_or_two_location(claim1, yes) + +%% Service-specific %% +claim.is_the_only_safe_way_to_transport_you(C, yes) +claim.type_of_non_emergency_transportation(C, licensed_psychiatric_transport_van) + +%% General Exclusions %% +% Imported from no_exclusion_claim.hdf \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_not_covered3.hdf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_not_covered3.hdf new file mode 100644 index 0000000..3f93852 --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_not_covered3.hdf @@ -0,0 +1,28 @@ +--- +data: + - ../../../../../Cardinal Care Core/General Exclusions/no_exclusion_claim.hdf +--- + +%%%%%% Covered example 1 %%%%%% +%%%%%% Service: emergency_ambulance_service %%%%%% + +%%% Types %%% +type(rta_bondonado, person) +type(claim1, claim) + +%%% Claim %%% +%% Service-generic %% +claim.patient_dob(claim1, 1999_06_01) +claim.date_service_received(claim1,2024_08_10) +claim.service_type(claim1, non_emergency_ambulance_service) +claim.precertification_received(claim1, yes) + + +claim.location_service_received(claim1, stanford_health_care) +claim.service_available_at_tier_one_or_two_location(claim1, yes) + +%% Service-specific %% +claim.is_the_only_safe_way_to_transport_you(C, no) + +%% General Exclusions %% +% Imported from no_exclusion_claim.hdf \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_not_covered4.hdf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_not_covered4.hdf new file mode 100644 index 0000000..dc794c6 --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/Example Datasets/ambulance_not_covered4.hdf @@ -0,0 +1,29 @@ +--- +data: + - ../../../../../Cardinal Care Core/General Exclusions/no_exclusion_claim.hdf +--- + +%%%%%% Covered example 1 %%%%%% +%%%%%% Service: emergency_ambulance_service %%%%%% + +%%% Types %%% +type(rta_bondonado, person) +type(claim1, claim) + +%%% Claim %%% +%% Service-generic %% +claim.patient_dob(claim1, 1999_06_01) +claim.date_service_received(claim1,2024_08_10) +claim.service_type(claim1, non_emergency_ambulance_service) +claim.precertification_received(claim1, yes) + + +claim.location_service_received(claim1, stanford_health_care) +claim.service_available_at_tier_one_or_two_location(claim1, yes) + +%% Service-specific %% +claim.is_the_only_safe_way_to_transport_you(C, yes) +claim.type_of_non_emergency_transportation(C, other) + +%% General Exclusions %% +% Imported from no_exclusion_claim.hdf \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/berlitz.hdf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/berlitz.hdf new file mode 100644 index 0000000..c7a821d --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/berlitz.hdf @@ -0,0 +1,42 @@ +--- +data: + - ../../../../Cardinal Care Core/berlitz.hdf +--- + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Base Relations +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +berlitz(claim.first_hospital_can_provide_emergency_services(C, yes), + "the first hospital to which the patient in $C$ was taken can provide the emergency services that the patient needs.") +berlitz(claim.first_hospital_can_provide_emergency_services(C, no), + "the first hospital to which the patient in $C$ was taken cannot provide the emergency services that the patient needs.") + +berlitz(claim.ambulance_service_from_one_hospital_to_another(C, yes), + "the ambulance service for the patient in $C$ was from one hospital to another.") +berlitz(claim.ambulance_service_from_one_hospital_to_another(C, no), + "the ambulance service for the patient in $C$ was not from one hospital to another.") + +berlitz(claim.is_the_only_safe_way_to_transport_you(C, yes), + "the type of transportation used to transport the patient in $C$ was the only safe way to transport the patient.") +berlitz(claim.is_the_only_safe_way_to_transport_you(C, no), + "the type of transportation used to transport the patient in $C$ was not the only safe way to transport the patient.") + +berlitz(claim.type_of_non_emergency_transportation(C, T), + "the patient in $C$ was transported by a $T$") + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Defined Relations +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +berlitz(is_covered_emergency_ambulance_service(C), + "$C$ is a covered emergency ambulance service") + +berlitz(is_covered_non_emergency_ambulance_service(C), + "$C$ is a covered non-emergency ambulance service") + +berlitz(is_covered_type_of_non_emergency_transportation(C), + "the type of transportation used to transport the patient in $C$ is a covered type of emergency transportation") + +berlitz(ambulance_service(S), + "$S$ is an ambulance service") \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/build.epilogbuild b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/build.epilogbuild new file mode 100644 index 0000000..5f158fb --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/build.epilogbuild @@ -0,0 +1,5 @@ +world.hdf ==> Deploy/world.hdf +rules.hrf ==> Deploy/rules.hrf +metadata_consolidation_order.metadata ==> Deploy/metadata.metadata +berlitz.hdf ==> Deploy/berlitz.hdf +overwrite: true \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/metadata.metadata b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/metadata.metadata new file mode 100644 index 0000000..3c28c08 --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/metadata.metadata @@ -0,0 +1,37 @@ +type(ambulance_service_coverage, class) +superclass(ambulance_service_coverage, claim) +attribute(ambulance_service_coverage, claim.first_hospital_can_provide_emergency_services) +attribute(ambulance_service_coverage, claim.ambulance_service_from_one_hospital_to_another) +attribute(ambulance_service_coverage, claim.non_emergency_transport_is_precertified) +attribute(ambulance_service_coverage, claim.is_the_only_safe_way_to_transport_you) +attribute(ambulance_service_coverage, claim.type_of_non_emergency_transportation) + +type(claim.first_hospital_can_provide_emergency_services, attributerelation) +domain(claim.first_hospital_can_provide_emergency_services, claim) +codomain(claim.first_hospital_can_provide_emergency_services, boolean) +unique(claim.first_hospital_can_provide_emergency_services, yes) +total(claim.first_hospital_can_provide_emergency_services, no) +changestyle(claim.first_hospital_can_provide_emergency_services, selector) + +type(claim.ambulance_service_from_one_hospital_to_another, attributerelation) +domain(claim.ambulance_service_from_one_hospital_to_another, claim) +codomain(claim.ambulance_service_from_one_hospital_to_another, boolean) +unique(claim.ambulance_service_from_one_hospital_to_another, yes) +total(claim.ambulance_service_from_one_hospital_to_another, no) +changestyle(claim.ambulance_service_from_one_hospital_to_another, selector) + +type(claim.is_the_only_safe_way_to_transport_you, attributerelation) +domain(claim.is_the_only_safe_way_to_transport_you, claim) +codomain(claim.is_the_only_safe_way_to_transport_you, boolean) +unique(claim.is_the_only_safe_way_to_transport_you, yes) +total(claim.is_the_only_safe_way_to_transport_you, no) +changestyle(claim.is_the_only_safe_way_to_transport_you, selector) + +type(claim.type_of_non_emergency_transportation, attributerelation) +domain(claim.type_of_non_emergency_transportation, claim) +codomain(claim.type_of_non_emergency_transportation, type_of_non_emergency_transportation) +unique(claim.type_of_non_emergency_transportation, yes) +total(claim.type_of_non_emergency_transportation, no) +changestyle(claim.type_of_non_emergency_transportation, selector) + +type(type_of_non_emergency_transportation, class) \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/metadata_consolidation_order.metadata b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/metadata_consolidation_order.metadata new file mode 100644 index 0000000..57b6ef0 --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/metadata_consolidation_order.metadata @@ -0,0 +1,6 @@ +--- +metadata: + - ../../../../Cardinal Care Core/metadata.metadata + - metadata.metadata + - ../../../../Cardinal Care Core/General Exclusions/metadata.metadata +--- \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/rules.hrf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/rules.hrf new file mode 100644 index 0000000..2bda5f6 --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/rules.hrf @@ -0,0 +1,57 @@ +--- +rules: + - ../../../../Cardinal Care Core/rules.hrf +--- + +covered_under_cardinal_care_24_25_benefit(C, ambulance_service_benefit) :- + claim.service_type(C, emergency_ambulance_service) & + is_covered_emergency_ambulance_service(C) + +% Assuming ambulance service to first hospital (i.e. NOT from one hospital to +% another) is covered *regardless* of whether the first hospital can provide +% emergency services. +is_covered_emergency_ambulance_service(C) :- + claim.is_ambulance_service_from_one_hospital_to_another(C, no) + +is_covered_emergency_ambulance_service(C) :- + claim.can_first_hospital_provide_emergency_services(C, no) & + claim.is_ambulance_service_from_one_hospital_to_another(C, yes) + +covered_under_cardinal_care_24_25_benefit(C, ambulance_service_benefit) :- + claim.service_type(C, non_emergency_ambulance_service) & + is_covered_non_emergency_ambulance_service(C) + +is_covered_non_emergency_ambulance_service(C) :- + is_covered_type_of_non_emergency_transportation(C) & + claim.is_the_only_safe_way_to_transport_you(C, yes) + +is_covered_type_of_non_emergency_transportation(C) :- + claim.type_of_non_emergency_transportation(C, T) & + member(T, [ + licensed_ambulance, + licensed_psychiatric_transport_van + ]) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Precertified if necessary +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +requires_precertification(non_emergency_ambulance_service) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Medical necessity +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Preventive care is a larger category of benefits, including immunizations +is_preventive_care_service(ServiceType) :- + ambulance_service(ServiceType) + +% Is a service under the ambulance service benefit +ambulance_service(emergency_ambulance_service) +ambulance_service(non_emergency_ambulance_service) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Limitations from Schedule of Benefits +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% No limitations listed in the PDBS \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/testing.epilogscript b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/testing.epilogscript new file mode 100644 index 0000000..4824df1 --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/testing.epilogscript @@ -0,0 +1,3 @@ +ruleset: rules.hrf +dataset: Example Datasets/ +query: covered(claim1) \ No newline at end of file diff --git a/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/world.hdf b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/world.hdf new file mode 100644 index 0000000..4d81657 --- /dev/null +++ b/Encoding/Benefits/Ambulance Service/Coverages/ambulance_service_coverage/world.hdf @@ -0,0 +1,7 @@ +%%%%%%%% Other Services - Ambulance Service %%%%%%%% +type(emergency_ambulance_service, cardinal_care_2024_2025_service) +type(non_emergency_ambulance_service, cardinal_care_2024_2025_service) + +type(licensed_ambulance, type_of_non_emergency_transportation) +type(licensed_psychiatric_transport_van, type_of_non_emergency_transportation) +type(other, type_of_non_emergency_transportation) \ No newline at end of file