Skip to content

Instantly share code, notes, and snippets.

@amponce
Created October 18, 2023 18:22
Show Gist options
  • Save amponce/cc353dae45f2ca73b45147a853915518 to your computer and use it in GitHub Desktop.
Save amponce/cc353dae45f2ca73b45147a853915518 to your computer and use it in GitHub Desktop.
const data = {
expenses: {
expenseRecords: [
{ name: 'Rent', amount: '2000' },
{ name: "Renter's or home insurance", amount: '34' },
{ name: 'Mortgage payment', amount: '435' },
{ name: 'Property tax', amount: '345' },
],
creditCardBills: [
{
purpose: 'Credit card payment',
unpaidBalance: '345',
amountDueMonthly: '45',
},
],
},
utilityRecords: [
{ name: 'Electricity', amount: '345' },
{ name: 'Gas', amount: '435' },
{ name: 'Trash', amount: '354' },
],
installmentContracts: [],
otherExpenses: [
{ name: 'Entertainment', amount: '345' },
{ name: 'Family and child care', amount: '345' },
{ name: 'Health expenses', amount: '354' },
{ name: 'Food', amount: '345' },
{ name: 'Clothing', amount: '400' },
],
};
const sumValues = (arr, key) =>
arr.reduce((acc, item) => acc + Number(item[key]), 0);
const essentialPayments = sumValues(data.expenses.expenseRecords, 'amount');
const utilityBills = sumValues(data.utilityRecords, 'amount');
const creditCardBills = Number(
data.expenses.creditCardBills[0].amountDueMonthly,
); // Using minimum monthly payment
const otherLivingExpenses = sumValues(data.otherExpenses, 'amount');
const totalExpenses =
essentialPayments + utilityBills + creditCardBills + otherLivingExpenses;
console.log(`Total Expenses: $${totalExpenses}`);
{
"questions": {
"hasRepayments": false,
"hasDependents": "2",
"hasBeenAdjudicatedBankrupt": false,
"hasCreditCardBills": true,
"hasRecreationalVehicle": false,
"hasVehicle": true,
"hasRealEstate": false,
"isMarried": false,
"vetIsEmployed": true
},
"view:components": {
"view:contractsAdditionalInfo": {},
"view:dependentsAdditionalInfo": {},
"view:realEstateAdditionalInfo": {},
"view:maritalStatus": {},
"view:veteranInfo": {},
"view:vaBenefitsOnFile": {},
"view:vehicleInfo": {},
"view:recVehicleInfo": {},
"view:assetInfo": {}
},
"additionalData": {
"additionalComments": "435",
"bankruptcy": {}
},
"personalData": {
"veteranFullName": {
"first": "Mark",
"last": "Polarbear",
"middle": "Tux",
"suffix": "Jr."
},
"dateOfBirth": "1950-10-04",
"address": {
"livesOnMilitaryBaseInfo": {},
"country": "USA",
"street": "341 Fenimore St",
"street2": "Unit 1",
"city": "FPO",
"state": "AE",
"postalCode": "17402"
},
"telephoneNumber": "7033218521",
"emailAddress": "nope@nope.org",
"veteranContactInformation": {
"email": "test@user.com",
"mobilePhone": {
"areaCode": "510",
"countryCode": "1",
"createdAt": "2020-06-12T16:56:37.000+00:00",
"extension": "",
"effectiveEndDate": null,
"effectiveStartDate": "2020-07-14T19:07:45.000+00:00",
"id": 146766,
"isInternational": false,
"isTextable": null,
"isTextPermitted": null,
"isTty": null,
"isVoicemailable": null,
"phoneNumber": "9224444",
"phoneType": "HOME",
"sourceDate": "2020-07-14T19:07:45.000+00:00",
"sourceSystemUser": null,
"transactionId": "92c49d39-22b2-4bd6-92b4-0b7e7c63c6a9",
"updatedAt": "2020-07-14T19:07:46.000+00:00",
"vet360Id": "1273780"
},
"address": {
"addressLine1": "1200 Park Ave",
"addressLine2": "c/o Pixar",
"addressPou": "CORRESPONDENCE",
"addressType": "DOMESTIC",
"city": "Emeryville",
"countryName": "United States",
"countryCodeIso2": "US",
"countryCodeIso3": "USA",
"countryCodeFips": null,
"countyCode": null,
"countyName": null,
"createdAt": "2020-05-30T03:57:20.000+00:00",
"effectiveEndDate": null,
"effectiveStartDate": "2020-07-10T20:10:45.000+00:00",
"id": 173917,
"province": null,
"sourceDate": "2020-07-10T20:10:45.000+00:00",
"sourceSystemUser": null,
"stateCode": "CA",
"transactionId": "7139aa82-fd06-45ea-a217-9654869924bd",
"updatedAt": "2020-07-10T20:10:46.000+00:00",
"validationKey": null,
"vet360Id": "1273780",
"zipCode": "94608",
"zipCodeSuffix": null
}
},
"spouseFullName": {},
"employmentHistory": {
"veteran": {
"employmentRecords": [
{
"type": "Full time",
"from": "2021-01-XX",
"to": "",
"isCurrent": true,
"employerName": "Reddit",
"grossMonthlyIncome": "8000",
"deductions": [
{
"name": "State tax",
"amount": "434"
},
{
"name": "Federal tax",
"amount": "222"
},
{
"name": "Local tax",
"amount": "33"
}
]
},
{
"type": "Full time",
"from": "2020-01-XX",
"to": "2022-03-XX",
"isCurrent": false,
"employerName": "Intuit",
"grossMonthlyIncome": "",
"deductions": []
}
]
},
"spouse": {},
"newRecord": {
"type": "",
"from": "",
"to": "",
"isCurrent": false,
"employerName": "",
"grossMonthlyIncome": "",
"deductions": []
}
},
"dependents": [
{
"dependentAge": "11"
},
{
"dependentAge": "12"
}
]
},
"personalIdentification": {
"ssn": "4437",
"fileNumber": "4437"
},
"selectedDebtsAndCopays": [
{
"resolutionWaiverCheck": true,
"resolutionOption": "waiver",
"fileNumber": "796104437",
"payeeNumber": "00",
"personEntitled": "STUB_M",
"deductionCode": "44",
"benefitType": "CH35 EDU",
"diaryCode": "618",
"diaryCodeDescription": "Account returned from Treasury Cross Servicing. Account is at TOP. TOP offsets will be applied to account as Federal funds become available.",
"amountOverpaid": 26000,
"amountWithheld": 0,
"originalAr": 100,
"currentAr": 80,
"debtHistory": [
{
"date": "12/19/2014",
"letterCode": "681",
"description": "Account returned from Treasury Cross Servicing. Account is at TOP. TOP offsets will be applied to account as Federal funds become available."
},
{
"date": "04/11/2013",
"letterCode": "080",
"description": "Debt referred to Treasury for Cross servicing"
},
{
"date": "12/11/2012",
"letterCode": "510",
"description": "Demand letters returned. Unable to verify address with third party. Account forced to TOP and/or CS."
},
{
"date": "10/17/2012",
"letterCode": "212",
"description": "Bad Address - Locator Request Sent"
},
{
"date": "09/28/2012",
"letterCode": "117",
"description": "Second Demand Letter"
},
{
"date": "09/18/2012",
"letterCode": "100",
"description": "First Demand Letter - Inactive Benefits - Due Process"
}
],
"id": 1,
"debtType": "DEBT",
"resolutionComment": ""
}
],
"socialSecurity": {
"spouse": {}
},
"additionalIncome": {
"addlIncRecords": [
{
"name": "Alimony",
"amount": "324"
},
{
"name": "Child support",
"amount": "234"
},
{
"name": "Caretaker income",
"amount": "324"
},
{
"name": "Unemployment income",
"amount": "234"
},
{
"name": "Rental income",
"amount": "24"
},
{
"name": "Social Security",
"amount": "444"
}
],
"spouse": {}
},
"benefits": {
"spouseBenefits": {}
},
"assets": {
"monetaryAssets": [
{
"name": "Cash",
"amount": "23"
},
{
"name": "Checking accounts",
"amount": "23"
},
{
"name": "Savings accounts",
"amount": "23"
}
],
"automobiles": [
{
"make": "Chevy",
"model": "Tahoe",
"year": "2003",
"resaleValue": "2322"
}
],
"otherAssets": [
{
"name": "Collectibles, or collection(s)",
"amount": "345"
},
{
"name": "Fine art",
"amount": "345"
},
{
"name": "Jewelry and gems",
"amount": "34"
}
]
},
"expenses": {
"expenseRecords": [
{
"name": "Rent",
"amount": "2000"
},
{
"name": "Renter's or home insurance",
"amount": "34"
},
{
"name": "Mortgage payment",
"amount": "435"
},
{
"name": "Property tax",
"amount": "345"
}
],
"creditCardBills": [
{
"purpose": "Credit card payment",
"creditorName": "",
"originalAmount": "",
"unpaidBalance": "345",
"amountDueMonthly": "45",
"dateStarted": "",
"amountPastDue": "345"
}
]
},
"utilityRecords": [
{
"name": "Electricity",
"amount": "345"
},
{
"name": "Gas",
"amount": "435"
},
{
"name": "Trash",
"amount": "354"
}
],
"installmentContracts": [],
"otherExpenses": [
{
"name": "Entertainment",
"amount": "345"
},
{
"name": "Family and child care",
"amount": "345"
},
{
"name": "Health expenses",
"amount": "354"
},
{
"name": "Food",
"amount": "345"
},
{
"name": "Clothing",
"amount": "400"
}
],
"view:enhancedFinancialStatusReport": true,
"view:streamlinedWaiver": true,
"view:streamlinedWaiverAssetUpdate": true,
"income": [
{
"veteranOrSpouse": "VETERAN"
}
],
"gmtData": {
"isEligibleForStreamlined": false,
"pensionThreshold": 16037,
"nationalThreshold": 39849,
"gmtThreshold": null,
"error": "Invalid zipcode",
"incomeUpperThreshold": 76875,
"assetThreshold": 3331.25,
"discretionaryIncomeThreshold": 640.625
},
"agreed": true,
"AGREED": false
}
@amponce
Copy link
Author

amponce commented Oct 18, 2023

From the PDF:

Rent or Mortgage Payment: $2435.00
Food: $345.00
Utilities and Heat: $1134.00
Other Living Expenses (includes Entertainment, Family and child care, Health expenses, Clothing, Renter's or home insurance, Property tax): $1823.00
Monthly Payments on Installment Contracts and Other Debts: $45.00
Adding these up: $2435 + $345 + $1134 + $1823 + $45 = $5782.00

From the JSON:

Rent: $2000.00
Renter's or home insurance: $34.00
Mortgage payment: $435.00
Property tax: $345.00
Utilities (Electricity, Gas, Trash): $345 + $435 + $354 = $1134.00
Credit card bill: (Considering only the "Amount due monthly"): $45.00
Other Expenses (Entertainment, Family and child care, Health expenses, Food, Clothing): $345 + $345 + $354 + $345 + $400 = $1789.00
Adding these up: $2000 + $34 + $435 + $345 + $1134 + $45 + $1789 = $5782.00

Review and submit page

Housing expenses:

Rent: $2,000.00
Renter's or home insurance: $34.00
Mortgage payment: $435.00
Property tax: $345.00
Sum: $2814.00
Utility bills:

Electricity: $345.00
Gas: $435.00
Trash: $354.00
Sum: $1134.00
Credit card bills:

Minimum monthly payment: $45.00

Other living expenses:

Entertainment: $345.00
Family and child care: $345.00
Health expenses: $354.00
Food: $345.00
Clothing: $400.00
Sum: $1789.00
Adding these all up:
$2814 + $1134 + $45 + $1789 = $5782.00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment