From 195d2a9eba2a23d1345730bb57850da33ef7fca9 Mon Sep 17 00:00:00 2001 From: Zhirui Li Date: Wed, 19 Jun 2024 04:00:40 -0400 Subject: [PATCH 1/5] medical expenses --- .DS_Store | Bin 6148 -> 6148 bytes policyengine_canada/.DS_Store | Bin 0 -> 6148 bytes policyengine_canada/parameters/.DS_Store | Bin 0 -> 6148 bytes policyengine_canada/parameters/gov/.DS_Store | Bin 0 -> 6148 bytes .../parameters/gov/provinces/.DS_Store | Bin 0 -> 6148 bytes .../gov/provinces/yt/medical/.DS_Store | Bin 0 -> 6148 bytes .../gov/provinces/yt/medical/rate.yaml | 12 ++++++++++ .../yt/medical/yt_medical_expenses.py | 21 ++++++++++++++++++ 8 files changed, 33 insertions(+) create mode 100644 policyengine_canada/.DS_Store create mode 100644 policyengine_canada/parameters/.DS_Store create mode 100644 policyengine_canada/parameters/gov/.DS_Store create mode 100644 policyengine_canada/parameters/gov/provinces/.DS_Store create mode 100644 policyengine_canada/parameters/gov/provinces/yt/medical/.DS_Store create mode 100644 policyengine_canada/parameters/gov/provinces/yt/medical/rate.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/medical/yt_medical_expenses.py diff --git a/.DS_Store b/.DS_Store index d24f89c6afb83036dbf1094e7ecb2ba71832922e..80da0b691cbb2dfb7d3f33d170dd65ed0eb29719 100644 GIT binary patch literal 6148 zcmeHK&2G~`5S~o~u?bX>C{iy-mbg|SK*f)^q-jEl#E(>0Z~zqSIHXn`JBl5mDvFdd zyaTVml_%j{IKemTt%#jQsyIY|cBI{Jy*o3z^G$X)OGKhE_U;f>h{!-;EM7r%j_^2_ zB`K($O`woI4yZ-X=p`LcbxB)yXa+O`e;Wh5cdybuJ*7Q*fqnaX{|?A&2T|7zA{RP* zKzv21{*;0i(I$22m>deJPdy4K0#@l1Jp&4|w&G^acIzD54!nev&JZlUnV&C~OojT`rZ(Qn~cbK8_}K;w0m^;f&t!*Ad8b&)Sar%I{4&m970KOdLP# zjiiC^^`P?hwI6!Xq!EonFP64;I$)ZH*{N(#rw{MecB}{YYO@_{`iR@R_jhMA)3|Z# z_T$6ONiYbbPlya6aKT8qrtl0n(HG=wG4&TT`Dl;AAPPCPya1C9k;*-4BDF1~b7_yr z-}z!942qGugvLl~73DOWIKj(b)W_%AL{Vy#*EXY`NHd@r_*WR<^T9%4tSg+SD3143&46a$zhXcXn|8B-kks9}6dd2R7Rq}R q7S@}mC{0kQ>sU7UD&9tsf-#F5z`DYDis*spKLU~lU1CJ*u~2NHo}wTV0|Nsi1A_oVN^x>dQht8U#6s=K1|lqzKeLEVW@cCC rfQfGwfgc5S>j^5;p}R1gIAzOI)iGpyESZLMR8W1i=ANuwzp!9B&jS4N(*+XZR2N z1+M%O{tG8~Gu|TGF}Dh#YA4!#>-D_x`t7VYOGK(S3vLs&iKvOfSl>ZaVSJy<=~eXT12}v zBn?iAHSYnZXz{u)^S+gMbqe4QPBFf^QSxh1C{cM#5!#i})t3@$mqr*>0RI?o9h zS~<;YH*Y<9KKK}q68#zP4paF4i(NE$3OqlR?{?CkB(Y9dJLWc^QAqEh_yh`<)#4n= zt91q0z8uF#6xa3zp#t6|f4N9|idP;G!^g4X!hk zPX{VF0s!mi7DJo=EHKA4*fqG$5O-iIqXILkGDi%R(b4Z3zplY`h8dldIeaMdWMxh$ zN}i7RuDFxxW@u}xfK{NVz*ctI=KcTa-_QR=lD)DDSOw0N0;+!0KkDI?%-*{3a=h2N tDDP0%*l(SoP*9oeSQ@+)@1cm{p34nj*Wfxs^uX*N0g=I0R)K%2z;Epu2weaG literal 0 HcmV?d00001 diff --git a/policyengine_canada/parameters/.DS_Store b/policyengine_canada/parameters/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..b9bad746e60c33408b93aaa79c4f180bfed36f31 GIT binary patch literal 6148 zcmeHK!EVz)5S>j@5))O*0i+x)^;)%Qi3+F}6Uu>WjmiN~u$w5gaJ*IQB!?)H&-7z@ z?U(d-;LYv^5mJst3Yw8--|Xy+?R{(Q?hujcO$SFrEh1__87m%|2ZYC2H>Bb`HK5{W z=*u|OF?#$sk!@gr*RDz<(lmRYuC3o2j2!$hVkY9E;(31UR{1WzPLsUobnaE9THAS2 zuY2`o{Y!YI=V1{Q)4Uf=K5_4Z)@i)5qxd2j&ik!rZ*^8gNj99Agk&&8$mfqqHqi5) zo@RsGFGUeFa02801&V9OYA`(vZI zW#28ID+~w&kIw+_4?dJJa9CP2TL&6b0s#3MX#}>p`~!V<00W1mMR*{}rUGrMawUdx zwS%(h7!O>0Y0;*WGH=Fn+?$oFP?Re@lyAaG1s0_h284li2CBB(;`9IA-|PSNBeuc7dTxs!F3Jh};BbJZiHq;3GJ{!QmVQCQ_h+G5= L4blh$|CE8BxM*Qe literal 0 HcmV?d00001 diff --git a/policyengine_canada/parameters/gov/.DS_Store b/policyengine_canada/parameters/gov/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e3cd25dc03284252f420b54847d6823a1daab427 GIT binary patch literal 6148 zcmeHKO;5r=5S;}S8e+mh6OK*15=A9`#7jjyc(q0kYOn>OjkQZ?fde7wS$~XIe~Eub zXLc781mn%G%p|*Sc6Z*k``Ya80D!3X+ZzBS04QJ~%ve~>F&d{bV;R$vLliWJZ26(| zu|?Cd{RIW++hw5zJ@Aghsqc4yBWth9)Iu!iVw8jd1P~#k1MvsO)7K1t7;478dh)D__iCxwmrYCSKBy>t64ITBlNm{>1nEv!F9gYL?2Q(e7roV()BK#}#|DM}BR)HXd7rmDTnAljdD` zAIS%`S`he0D_b%+fk$-aXfbemQ7EGu9Gx&H3`SOf6<`H^n*wH^DinX)i}Cxg0<6G~ zD?s~$jfK!Lm}*p82UaQtK%{G=GW6BuAJL``M8{yN5qr>trXp&pFe!#Gxr5Mj9Cu87 zs!`KHs3+q*=E=fjD8i&3!dBrR9F1JF0<6Ha0$JTG(fNP$dHz35;ub5w3j8YtM6TgB z>bN9xw$3b$&RQGGH5M|8OEtbz&{0P*#?nz-#-a@SZE_GDgQ-UBLF0>nl7TB$;9C`V E1K=%X^8f$< literal 0 HcmV?d00001 diff --git a/policyengine_canada/parameters/gov/provinces/.DS_Store b/policyengine_canada/parameters/gov/provinces/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..885a25187533f364b1985330470762fcddd0c96c GIT binary patch literal 6148 zcmeHK!H&}~5FKX=ZCC+4fV3B+NL*J?V8w#Cgzj?SN)Q|Xm1J8%v{}0}DHWUFmG@uFPCFLyByBT*dAXc#(2|$B;pBy!Y*9|-o&LzCMP62e!A})zb*^0PcEj#=_e1j8ERrg% z=H)P*y`$D^V~T9;r`el)vKaMm9T;7uxt`28ARkYV^8RhE$7V4!b3HCOHn9U?*b7Jf zo#pb$!@+K}|7ftM91Ft#ln4*SHLT9i4~yzA;Ll!3)U8S>%fYy0EivzW<#HT|0yOC zj0J0pID)2ZD54Eja>YfARPGzZ>LRUIDMbrBXn34wJ(nrX*+UMsjr4Mp!;#AtPRGkwdVO}I{z5o1~XoRa^mU;px-bi4 z#Z)mHGC~QKO0?8apBTZ?*&pk;R52S`IzpM5b?VIDkC#wpXMZfi5t5->XTTZgGH`Cq zky(}(GVi>hbqujT2ijnpTqMB}m?3jNL{fDP><*ClB2 aD4*j}#cZf5>M!X;zX%jU+&BX#VBia>c`Z}` literal 0 HcmV?d00001 diff --git a/policyengine_canada/parameters/gov/provinces/yt/medical/rate.yaml b/policyengine_canada/parameters/gov/provinces/yt/medical/rate.yaml new file mode 100644 index 000000000..6a7e0c69c --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/medical/rate.yaml @@ -0,0 +1,12 @@ +description: Yukon multiplies the net income by the follwoing rate under the medical expense credit. + +metadata: + period: year + unit: /1 + label: Yukon medical expense credit net income rate + reference: + - title: Yukon 2023 non-refundable tax credits medical expenses + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5011-c/5011-c-23e.pdf#page=2 + +values: + 2023-01-01: 0.03 diff --git a/policyengine_canada/parameters/gov/provinces/yt/medical/yt_medical_expenses.py b/policyengine_canada/parameters/gov/provinces/yt/medical/yt_medical_expenses.py new file mode 100644 index 000000000..d00f92747 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/medical/yt_medical_expenses.py @@ -0,0 +1,21 @@ +from policyengine_canada.model_api import * + + +class yt_medical_expenses(Variable): + value_type = float + entity = Person + label = "Yukon medical expenses" + definition_period = YEAR + defined_for = ProvinceCode.YT + + def formula(person, period, parameters): + income = person("individual_net_income", period) + p = parameters(period).gov.provinces.yt.medical + rate = p.rate + income_fraction = income * rate + reduction_cap = p.reduction_cap + return min_(income_fraction, reduction_cap) + +# reference: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5011-c/5011-c-23e.pdf +# random stuff + \ No newline at end of file From 702c5a50065d089d069e5d1cb9c3874c18bad5aa Mon Sep 17 00:00:00 2001 From: Zhirui Li Date: Wed, 19 Jun 2024 04:05:48 -0400 Subject: [PATCH 2/5] Remove .DS_Store files and update .gitignore --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 2 ++ policyengine_canada/.DS_Store | Bin 6148 -> 0 bytes policyengine_canada/parameters/.DS_Store | Bin 6148 -> 0 bytes policyengine_canada/parameters/gov/.DS_Store | Bin 6148 -> 0 bytes .../parameters/gov/provinces/.DS_Store | Bin 6148 -> 0 bytes .../gov/provinces/yt/medical/.DS_Store | Bin 6148 -> 0 bytes 7 files changed, 2 insertions(+) delete mode 100644 .DS_Store delete mode 100644 policyengine_canada/.DS_Store delete mode 100644 policyengine_canada/parameters/.DS_Store delete mode 100644 policyengine_canada/parameters/gov/.DS_Store delete mode 100644 policyengine_canada/parameters/gov/provinces/.DS_Store delete mode 100644 policyengine_canada/parameters/gov/provinces/yt/medical/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 80da0b691cbb2dfb7d3f33d170dd65ed0eb29719..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK&2G~`5S~o~u?bX>C{iy-mbg|SK*f)^q-jEl#E(>0Z~zqSIHXn`JBl5mDvFdd zyaTVml_%j{IKemTt%#jQsyIY|cBI{Jy*o3z^G$X)OGKhE_U;f>h{!-;EM7r%j_^2_ zB`K($O`woI4yZ-X=p`LcbxB)yXa+O`e;Wh5cdybuJ*7Q*fqnaX{|?A&2T|7zA{RP* zKzv21{*;0i(I$22m>deJPdy4K0#@l1Jp&4|w&G^acIzD54!nev&JZlUnV&C~OojT`rZ(Qn~cbK8_}K;w0m^;f&t!*Ad8b&)Sar%I{4&m970KOdLP# zjiiC^^`P?hwI6!Xq!EonFP64;I$)ZH*{N(#rw{MecB}{YYO@_{`iR@R_jhMA)3|Z# z_T$6ONiYbbPlya6aKT8qrtl0n(HG=wG4&TT`Dl;AAPPCPya1C9k;*-4BDF1~b7_yr z-}z!942qGugvLl~73DOWIKj(b)W_%AL{Vy#*EXY`NHd@r_*WR<^T9%4tSg+SD3143&46a$zhXcXn|8B-kks9}6dd2R7Rq}R q7S@}mC{0kQ>sU7UD&9tsf-#F5z`DYDis*spKLU~lU1fgc5S>j^5;p}R1gIAzOI)iGpyESZLMR8W1i=ANuwzp!9B&jS4N(*+XZR2N z1+M%O{tG8~Gu|TGF}Dh#YA4!#>-D_x`t7VYOGK(S3vLs&iKvOfSl>ZaVSJy<=~eXT12}v zBn?iAHSYnZXz{u)^S+gMbqe4QPBFf^QSxh1C{cM#5!#i})t3@$mqr*>0RI?o9h zS~<;YH*Y<9KKK}q68#zP4paF4i(NE$3OqlR?{?CkB(Y9dJLWc^QAqEh_yh`<)#4n= zt91q0z8uF#6xa3zp#t6|f4N9|idP;G!^g4X!hk zPX{VF0s!mi7DJo=EHKA4*fqG$5O-iIqXILkGDi%R(b4Z3zplY`h8dldIeaMdWMxh$ zN}i7RuDFxxW@u}xfK{NVz*ctI=KcTa-_QR=lD)DDSOw0N0;+!0KkDI?%-*{3a=h2N tDDP0%*l(SoP*9oeSQ@+)@1cm{p34nj*Wfxs^uX*N0g=I0R)K%2z;Epu2weaG diff --git a/policyengine_canada/parameters/.DS_Store b/policyengine_canada/parameters/.DS_Store deleted file mode 100644 index b9bad746e60c33408b93aaa79c4f180bfed36f31..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK!EVz)5S>j@5))O*0i+x)^;)%Qi3+F}6Uu>WjmiN~u$w5gaJ*IQB!?)H&-7z@ z?U(d-;LYv^5mJst3Yw8--|Xy+?R{(Q?hujcO$SFrEh1__87m%|2ZYC2H>Bb`HK5{W z=*u|OF?#$sk!@gr*RDz<(lmRYuC3o2j2!$hVkY9E;(31UR{1WzPLsUobnaE9THAS2 zuY2`o{Y!YI=V1{Q)4Uf=K5_4Z)@i)5qxd2j&ik!rZ*^8gNj99Agk&&8$mfqqHqi5) zo@RsGFGUeFa02801&V9OYA`(vZI zW#28ID+~w&kIw+_4?dJJa9CP2TL&6b0s#3MX#}>p`~!V<00W1mMR*{}rUGrMawUdx zwS%(h7!O>0Y0;*WGH=Fn+?$oFP?Re@lyAaG1s0_h284li2CBB(;`9IA-|PSNBeuc7dTxs!F3Jh};BbJZiHq;3GJ{!QmVQCQ_h+G5= L4blh$|CE8BxM*Qe diff --git a/policyengine_canada/parameters/gov/.DS_Store b/policyengine_canada/parameters/gov/.DS_Store deleted file mode 100644 index e3cd25dc03284252f420b54847d6823a1daab427..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKO;5r=5S;}S8e+mh6OK*15=A9`#7jjyc(q0kYOn>OjkQZ?fde7wS$~XIe~Eub zXLc781mn%G%p|*Sc6Z*k``Ya80D!3X+ZzBS04QJ~%ve~>F&d{bV;R$vLliWJZ26(| zu|?Cd{RIW++hw5zJ@Aghsqc4yBWth9)Iu!iVw8jd1P~#k1MvsO)7K1t7;478dh)D__iCxwmrYCSKBy>t64ITBlNm{>1nEv!F9gYL?2Q(e7roV()BK#}#|DM}BR)HXd7rmDTnAljdD` zAIS%`S`he0D_b%+fk$-aXfbemQ7EGu9Gx&H3`SOf6<`H^n*wH^DinX)i}Cxg0<6G~ zD?s~$jfK!Lm}*p82UaQtK%{G=GW6BuAJL``M8{yN5qr>trXp&pFe!#Gxr5Mj9Cu87 zs!`KHs3+q*=E=fjD8i&3!dBrR9F1JF0<6Ha0$JTG(fNP$dHz35;ub5w3j8YtM6TgB z>bN9xw$3b$&RQGGH5M|8OEtbz&{0P*#?nz-#-a@SZE_GDgQ-UBLF0>nl7TB$;9C`V E1K=%X^8f$< diff --git a/policyengine_canada/parameters/gov/provinces/.DS_Store b/policyengine_canada/parameters/gov/provinces/.DS_Store deleted file mode 100644 index 885a25187533f364b1985330470762fcddd0c96c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK!H&}~5FKX=ZCC+4fV3B+NL*J?V8w#Cgzj?SN)Q|Xm1J8%v{}0}DHWUFmG@uFPCFLyByBT*dAXc#(2|$B;pBy!Y*9|-o&LzCMP62e!A})zb*^0PcEj#=_e1j8ERrg% z=H)P*y`$D^V~T9;r`el)vKaMm9T;7uxt`28ARkYV^8RhE$7V4!b3HCOHn9U?*b7Jf zo#pb$!@+K}|7ftM91Ft#ln4*SHLT9i4~yzA;Ll!3)U8S>%fYy0EivzW<#HT|0yOC zj0J0pID)2ZD54Eja>YfARPGzZ>LRUIDMbrBXn34wJ(nrX*+UMsjr4Mp!;#AtPRGkwdVO}I{z5o1~XoRa^mU;px-bi4 z#Z)mHGC~QKO0?8apBTZ?*&pk;R52S`IzpM5b?VIDkC#wpXMZfi5t5->XTTZgGH`Cq zky(}(GVi>hbqujT2ijnpTqMB}m?3jNL{fDP><*ClB2 aD4*j}#cZf5>M!X;zX%jU+&BX#VBia>c`Z}` From 116e11c6b4fc0c60d1c76bac9b16d5295528f6dc Mon Sep 17 00:00:00 2001 From: Zhirui Li Date: Thu, 27 Jun 2024 10:28:21 -0400 Subject: [PATCH 3/5] changes after the first pull request --- .../income/credits/medical_expenses}/rate.yaml | 6 +++++- .../income/credits}/yt_medical_expenses.py | 11 ++++------- 2 files changed, 9 insertions(+), 8 deletions(-) rename policyengine_canada/parameters/gov/provinces/yt/{medical => tax/income/credits/medical_expenses}/rate.yaml (57%) rename policyengine_canada/parameters/gov/provinces/yt/{medical => tax/income/credits}/yt_medical_expenses.py (62%) diff --git a/policyengine_canada/parameters/gov/provinces/yt/medical/rate.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/medical_expenses/rate.yaml similarity index 57% rename from policyengine_canada/parameters/gov/provinces/yt/medical/rate.yaml rename to policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/medical_expenses/rate.yaml index 6a7e0c69c..5659bf360 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/medical/rate.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/medical_expenses/rate.yaml @@ -1,12 +1,16 @@ -description: Yukon multiplies the net income by the follwoing rate under the medical expense credit. +description: Yukon multiplies the net income by the following rate under the medical expense credit. metadata: period: year unit: /1 label: Yukon medical expense credit net income rate reference: + - title: Yukon 2022 non-refundable tax credits medical expenses + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5011-c/5011-c-22e.pdf#page=2 - title: Yukon 2023 non-refundable tax credits medical expenses href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5011-c/5011-c-23e.pdf#page=2 values: + 2022-01-01: 0.03 2023-01-01: 0.03 + diff --git a/policyengine_canada/parameters/gov/provinces/yt/medical/yt_medical_expenses.py b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses.py similarity index 62% rename from policyengine_canada/parameters/gov/provinces/yt/medical/yt_medical_expenses.py rename to policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses.py index d00f92747..7dacfd037 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/medical/yt_medical_expenses.py +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses.py @@ -1,21 +1,18 @@ from policyengine_canada.model_api import * -class yt_medical_expenses(Variable): +class yt_medical_expense_credit(Variable): value_type = float entity = Person label = "Yukon medical expenses" definition_period = YEAR defined_for = ProvinceCode.YT + reference = "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5011-c/5011-c-23e.pdf" def formula(person, period, parameters): income = person("individual_net_income", period) p = parameters(period).gov.provinces.yt.medical rate = p.rate - income_fraction = income * rate + income_fraction = income * p.rate reduction_cap = p.reduction_cap - return min_(income_fraction, reduction_cap) - -# reference: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5011-c/5011-c-23e.pdf -# random stuff - \ No newline at end of file + return min_(income_fraction, p.reduction_cap) \ No newline at end of file From 67a50e824ef6960bfce702d4cdd27943982e4ea4 Mon Sep 17 00:00:00 2001 From: Zhirui Li Date: Thu, 27 Jun 2024 10:56:30 -0400 Subject: [PATCH 4/5] add in unit tests --- .../credits/yt_medical_expenses_tests.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses_tests.py diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses_tests.py b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses_tests.py new file mode 100644 index 000000000..685beeafe --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses_tests.py @@ -0,0 +1,35 @@ +- name: Yukon medical expense credit net income below reduction cap 2022 + period: 2022 + input: + people: + p1: + individual_net_income: 10_000 + household: + members: p1 + province_code: YT + output: + yt_medical_expense_credit: 300 # 10_000 * 0.03 + +- name: Yukon medical expense credit zero net income 2022 + period: 2022 + input: + people: + p1: + individual_net_income: 0 + household: + members: p1 + province_code: YT + output: + yt_medical_expense_credit: 0 + +- name: Yukon medical expense credit net income below reduction cap 2023 + period: 2023 + input: + people: + p1: + individual_net_income: 20_000 + household: + members: p1 + province_code: YT + output: + yt_medical_expense_credit: 600 # 20_000 * 0.03 \ No newline at end of file From 756a07162de6635218a17f3e71beaf80c3c31f6e Mon Sep 17 00:00:00 2001 From: Zhirui Li Date: Thu, 11 Jul 2024 01:36:43 -0400 Subject: [PATCH 5/5] new changes --- .../income/credits/medical_expenses/rate.yaml | 2 +- ...ests.py => yt_medical_expenses_tests.yaml} | 23 +++++++++++-------- .../tax/income/credits/yt_medical_expenses.py | 4 +--- 3 files changed, 15 insertions(+), 14 deletions(-) rename policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/{yt_medical_expenses_tests.py => yt_medical_expenses_tests.yaml} (65%) rename policyengine_canada/{parameters => variables}/gov/provinces/yt/tax/income/credits/yt_medical_expenses.py (85%) diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/medical_expenses/rate.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/medical_expenses/rate.yaml index 5659bf360..df004c1df 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/medical_expenses/rate.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/medical_expenses/rate.yaml @@ -3,7 +3,7 @@ description: Yukon multiplies the net income by the following rate under the med metadata: period: year unit: /1 - label: Yukon medical expense credit net income rate + label: Yukon medical expense credit rate reference: - title: Yukon 2022 non-refundable tax credits medical expenses href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5011-c/5011-c-22e.pdf#page=2 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses_tests.py b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses_tests.yaml similarity index 65% rename from policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses_tests.py rename to policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses_tests.yaml index 685beeafe..678c63ee0 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses_tests.py +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses_tests.yaml @@ -4,9 +4,10 @@ people: p1: individual_net_income: 10_000 - household: - members: p1 - province_code: YT + households: + household: + members: [p1] + province_code: YT output: yt_medical_expense_credit: 300 # 10_000 * 0.03 @@ -16,9 +17,10 @@ people: p1: individual_net_income: 0 - household: - members: p1 - province_code: YT + households: + household: + members: [p1] + province_code: YT output: yt_medical_expense_credit: 0 @@ -28,8 +30,9 @@ people: p1: individual_net_income: 20_000 - household: - members: p1 - province_code: YT + households: + household: + members: [p1] + province_code: YT output: - yt_medical_expense_credit: 600 # 20_000 * 0.03 \ No newline at end of file + yt_medical_expense_credit: 600 # 20_000 * 0.03 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_medical_expenses.py similarity index 85% rename from policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses.py rename to policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_medical_expenses.py index 7dacfd037..a2f8067e9 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/yt_medical_expenses.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_medical_expenses.py @@ -7,12 +7,10 @@ class yt_medical_expense_credit(Variable): label = "Yukon medical expenses" definition_period = YEAR defined_for = ProvinceCode.YT - reference = "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5011-c/5011-c-23e.pdf" + reference = "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5011-c/5011-c-23e.pdf" # page 23 def formula(person, period, parameters): income = person("individual_net_income", period) p = parameters(period).gov.provinces.yt.medical - rate = p.rate income_fraction = income * p.rate - reduction_cap = p.reduction_cap return min_(income_fraction, p.reduction_cap) \ No newline at end of file