Skip to content

Commit

Permalink
Add eligible_for_rates_subsidy
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidPratten committed Jan 30, 2023
1 parent 8156e94 commit 90186ed
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The examples are chosen to illustrate the benefits (and/or challenges) of queryi
- [Birthday Money](Birthday%20Money.ipynb)
- [Australian COVID vaccinations up-to-date and eligibility](COVID_vaccinations.ipynb)
- [Australian COVID vaccinations mandatory for work roles](COVID_vaccinations_and_work.ipynb)
- [Eligibility for rates subsidy](eligible_for_rates_subsidy.ipynb)
- [Range](Range.ipynb)

## Interactive Q&A with Rules as Code
Expand Down
137 changes: 137 additions & 0 deletions eligible_for_rates_subsidy.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%reload_ext jetisu.query_idr_magic"
]
},
{
"cell_type": "markdown",
"source": [
"# Eligibility for rates subsidy\n",
"\n",
"A person is eligible for a rates subsidy if, on the relevant date:\n",
"1. the person is a ratepayer; and\n",
"1. the property for which the rates are paid is a residential property; and\n",
"1. the property is the usual place of residence of the ratepayer.\n"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": 18,
"outputs": [
{
"data": {
"text/plain": "<IPython.core.display.Markdown object>",
"text/markdown": "```\n\npredicate eligible_for_rates_subsidy(var bool: is_ratepayer,\n var bool: is_residential_property,\n var bool: usual_place_of_residence,\n var bool: is_retirement_subsidy,\n var bool: is_eligible) =\nlet {\n constraint is_eligible = (is_ratepayer /\\ is_residential_property /\\ usual_place_of_residence);\n constraint is_eligible -> not is_retirement_subsidy;\n }\nin true;\n```"
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%jetisu_show\n",
"eligible_for_rates_subsidy"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "markdown",
"source": [
"## I am a ratepayer, the property is residential and it is my usual place of residence. Am I eligible?"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": 19,
"outputs": [
{
"data": {
"text/plain": "<IPython.core.display.Markdown object>",
"text/markdown": "|is_eligible|is_retirement_subsidy|\n|----|----|\n|True|False|"
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%jetisu_query\n",
"select is_eligible, is_retirement_subsidy\n",
" from eligible_for_rates_subsidy\n",
" where is_ratepayer and is_residential_property and usual_place_of_residence;"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "markdown",
"source": [
"## For the people who are eligible, what can we say about their status as a ratepayer, the kind of property under discussion and if they are resident at the property?"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": 20,
"outputs": [
{
"data": {
"text/plain": "<IPython.core.display.Markdown object>",
"text/markdown": "|is_ratepayer|is_residential_property|usual_place_of_residence|\n|----|----|----|\n|True|True|True|"
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%jetisu_query\n",
"select is_ratepayer,\n",
" is_residential_property,\n",
" usual_place_of_residence\n",
" from eligible_for_rates_subsidy\n",
" where is_eligible;"
],
"metadata": {
"collapsed": false
}
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
10 changes: 10 additions & 0 deletions jetisu/eligible_for_rates_subsidy.mzn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
predicate eligible_for_rates_subsidy(var bool: is_ratepayer,
var bool: is_residential_property,
var bool: usual_place_of_residence,
var bool: is_retirement_subsidy,
var bool: is_eligible) =
let {
constraint is_eligible = (is_ratepayer /\ is_residential_property /\ usual_place_of_residence);
constraint is_eligible -> not is_retirement_subsidy;
}
in true;

0 comments on commit 90186ed

Please sign in to comment.