Commit 57c91dd
authored
## Summary
<!-- Use "Fixes" to automatically close issue upon PR merge. Use "Work
for" when UAT is required. -->
Fixes #6835
## Changes proposed
<!-- What was added, updated, or removed in this PR. -->
Add a new `array_decomposition` transform option to
`conditional_transformers.py` to process budget form data in accordance
with SF424A XSD.
Add configuration to sf424a
Add tests
## Context for reviewers
<!-- Technical or background context, more in-depth details of the
implementation, and anything else you'd like reviewers to know
We store the budget form data as an array where each line item contains
the budget summary, budget categories, non federal resources and federal
fund estimates. We need to support iterating through this array and
pulling parts out of it to transform it.
For more examples, info: see schema at
https://apply07.grants.gov/apply/forms/schemas/SF424A-V1.0.xsd
Note that full XSD validation won't work until the full XML config is
configured for the SF424A.
## Validation steps
<!-- Manual testing instructions, as well as any helpful references
(screenshots, GIF demos, code examples or output). -->
See new / updated unit tests.
From the command line, create a JSON file like:
```
{
"activity_line_items": [
{
"activity_title": "Personnel Costs",
"non_federal_resources": {
"applicant_amount": "5000.00",
"state_amount": "10000.00",
"other_amount": "2500.00",
"total_amount": "17500.00"
}
},
{
"activity_title": "Equipment",
"non_federal_resources": {
"applicant_amount": "3000.00",
"state_amount": "7500.00",
"other_amount": "1500.00",
"total_amount": "12000.00"
}
}
],
"total_non_federal_resources": {
"applicant_amount": "8000.00",
"state_amount": "17500.00",
"other_amount": "4000.00",
"total_amount": "29500.00"
}
}
```
Then run:
`docker compose run --rm grants-api poetry run flask task generate-xml
--file sf424a.json --form SF424A --output sf424a_output.xml`
And see XML file:
```
<?xml version='1.0' encoding='utf-8'?>
<SF424A:BudgetInformation xmlns:SF424A="http://apply.grants.gov/forms/SF424A-V1.0" xmlns:glob="http://apply.grants.gov/system/Global-V1.0" SF424A:FormVersion="2.0">
<SF424A:BudgetSections>
<SF424A:NonFederalResources>
<SF424A:ResourceLineItem SF424A:activityTitle="Personnel Costs">
<SF424A:BudgetApplicantContributionAmount>5000.00</SF424A:BudgetApplicantContributionAmount>
<SF424A:BudgetStateContributionAmount>10000.00</SF424A:BudgetStateContributionAmount>
<SF424A:BudgetOtherContributionAmount>2500.00</SF424A:BudgetOtherContributionAmount>
<SF424A:BudgetTotalContributionAmount>17500.00</SF424A:BudgetTotalContributionAmount>
</SF424A:ResourceLineItem>
<SF424A:ResourceLineItem SF424A:activityTitle="Equipment">
<SF424A:BudgetApplicantContributionAmount>3000.00</SF424A:BudgetApplicantContributionAmount>
<SF424A:BudgetStateContributionAmount>7500.00</SF424A:BudgetStateContributionAmount>
<SF424A:BudgetOtherContributionAmount>1500.00</SF424A:BudgetOtherContributionAmount>
<SF424A:BudgetTotalContributionAmount>12000.00</SF424A:BudgetTotalContributionAmount>
</SF424A:ResourceLineItem>
<SF424A:ResourceTotals>
<SF424A:BudgetApplicantContributionAmount>8000.00</SF424A:BudgetApplicantContributionAmount>
<SF424A:BudgetStateContributionAmount>17500.00</SF424A:BudgetStateContributionAmount>
<SF424A:BudgetOtherContributionAmount>4000.00</SF424A:BudgetOtherContributionAmount>
<SF424A:BudgetTotalContributionAmount>29500.00</SF424A:BudgetTotalContributionAmount>
</SF424A:ResourceTotals>
</SF424A:NonFederalResources>
</SF424A:BudgetSections>
</SF424A:BudgetInformation>`
```
1 parent 10d5974 commit 57c91dd
File tree
9 files changed
+1697
-272
lines changed- api
- src
- cli
- form_schema/forms
- services/xml_generation
- transformers
- validation
- tests/src/services/xml_generation
9 files changed
+1697
-272
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
| |||
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
37 | | - | |
| 44 | + | |
38 | 45 | | |
39 | 46 | | |
40 | 47 | | |
| |||
60 | 67 | | |
61 | 68 | | |
62 | 69 | | |
63 | | - | |
| 70 | + | |
64 | 71 | | |
65 | 72 | | |
66 | | - | |
67 | | - | |
| 73 | + | |
| 74 | + | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| |||
80 | 87 | | |
81 | 88 | | |
82 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
83 | 99 | | |
84 | 100 | | |
85 | 101 | | |
86 | 102 | | |
87 | | - | |
| 103 | + | |
88 | 104 | | |
89 | 105 | | |
90 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
783 | 783 | | |
784 | 784 | | |
785 | 785 | | |
| 786 | + | |
786 | 787 | | |
787 | 788 | | |
788 | | - | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
789 | 799 | | |
790 | 800 | | |
791 | 801 | | |
792 | 802 | | |
793 | 803 | | |
794 | 804 | | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
795 | 848 | | |
796 | 849 | | |
797 | 850 | | |
| |||
831 | 884 | | |
832 | 885 | | |
833 | 886 | | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
834 | 985 | | |
835 | 986 | | |
836 | 987 | | |
| |||
0 commit comments