Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug/account-type-id #84

Merged
merged 17 commits into from
Oct 2, 2023
Merged

bug/account-type-id #84

merged 17 commits into from
Oct 2, 2023

Conversation

fivetran-catfritz
Copy link
Contributor

@fivetran-catfritz fivetran-catfritz commented Sep 25, 2023

PR Overview

This PR will address the following Issue/Feature:

This PR will result in the following new package version:

  • v0.10.0
  • Breaking change since are changing how records are categorized and some may be different than before (for example, if a prior issue was now corrected).

Please detail what change(s) this PR introduces and any additional information that should be known during the review of this PR:

  • Updated the following models to reference account_type_id instead of type_name:
    • int_netsuite2__tran_with_converted_amounts
    • netsuite2__balance_sheet
    • netsuite2__income_statement
    • netsuite2__transaction_details
  • This change was implemented because type_name was previously utilized to categorize records, which was causing issues for users that customized the type_name values. Utilizing the unique identifier account_type_id instead produces more accurate results in the final models.
  • Removed accepted_values test from column account_type_names in model netsuite2__transaction_details since logic is now based on account_type_id instead, and type names can be changed by the user.
  • Updated documents with descriptions for account_type_id

** ❗ Note - references to "prepaid" were removed since they became moot when moving to using ids.

PR Checklist

Basic Validation

Please acknowledge that you have successfully performed the following commands locally:

  • dbt compile
  • dbt run –full-refresh
  • dbt run
  • dbt test
  • dbt run –vars (if applicable)

Before marking this PR as "ready for review" the following have been applied:

  • The appropriate issue has been linked and tagged
  • You are assigned to the corresponding issue and this PR
  • BuildKite integration tests are passing

Detailed Validation

Please acknowledge that the following validation checks have been performed prior to marking this PR as "ready for review":

  • You have validated these changes and assure this PR will address the respective Issue/Feature.
  • You are reasonably confident these changes will not impact any other components of this package or any dependent packages.
  • You have provided details below around the validation steps performed to gain confidence in these changes.
  • See internal ticket for validation.

Standard Updates

Please acknowledge that your PR contains the following standard updates:

  • Package versioning has been appropriately indexed in the following locations:
    • indexed within dbt_project.yml
    • indexed within integration_tests/dbt_project.yml
  • CHANGELOG has individual entries for each respective change in this PR
  • README updates have been applied (if applicable)
  • DECISIONLOG updates have been updated (if applicable)
  • Appropriate yml documentation has been added (if applicable)

dbt Docs

Please acknowledge that after the above were all completed the below were applied to your branch:

  • docs were regenerated (unless this PR does not include any code or yml updates)

If you had to summarize this PR in an emoji, which would it be?

🆔

@fivetran-catfritz fivetran-catfritz linked an issue Sep 28, 2023 that may be closed by this pull request
4 tasks
@fivetran-catfritz fivetran-catfritz self-assigned this Sep 28, 2023
Copy link
Contributor

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fivetran-catfritz these changes look great. This is a HUGE enhancement to the package by making it more accurate and robust to handle changing Netsuite2 environments. Thanks for the due diligence in updating these models and also documenting your validation efforts. I was also able to confirm that for every period and for every account in our internal data that the totals match between the current version of the package and your changes for IS and BS.

I do have just a few minor and final requests and suggestions. Would you be able to address these. Then this should be good to go for approval!

CHANGELOG.md Outdated
- netsuite2__balance_sheet
- netsuite2__income_statement
- netsuite2__transaction_details
- This change was implemented because `type_name` was previously utilized to categorize records, which was causing issues for users that customized the `type_name` values. Utilizing the unique identifier `account_type_id` instead produces more accurate results in the final models.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just clarify here that we are referencing the above bullet and that this is only for Netsuite2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recall Jamie found a Netsuite doc that showed this mapping. Would we be able to share that in the CHANGELOG so customers are aware of how we were informed around the proper pairings for these changes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Can you also include the link somewhere just for reference so customers know where we found the mapping.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

lower(accounts.type_name) like 'accounts payable%' as is_accounts_payable,
lower(accounts.type_name) like 'accounts receivable%' as is_accounts_receivable,
lower(accounts.account_type_id) = 'acctpay' as is_accounts_payable,
lower(accounts.account_type_id) = 'acctrec' as is_accounts_receivable,
lower(accounts.name) like '%intercompany%' as is_account_intercompany,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we didn't update this account name. I agree with you that it seems this is the correct move as there is not a lookup key for these fields. But would you be able to just add some clarification in this thread for posterity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point. I hadn't really considered it, but I looked into it, and there is a flag in a column called eliminate in the accounts source table that is meant to flag an account as intercompany. See the netsuite docs for field eliminate. See also this doc (and search for "eliminate").

I added this to the source and tried this out, however unlike my other changes, this does produce different results from our current model. For example our data has some accounts marked as eliminate = T, but the account name does not contain intercompany. Thinking this needs to be a new issue for further investigation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for investigating! This is interesting, however I would prefer we do not make the update here as you can see internally that the changes without the eliminate update tie out, but with the eliminate update they do not. I don't feel there is a need for a new issue as there currently is not an existing issue around this.

Let's discuss at standup what our internally procedures may to flag something like this. I don't feel it is necessary to be an issue, but we also don't have enough information to create a FR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From discussion, we will leave this flag as-is for now, but will come back to it.

Copy link
Contributor

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fivetran-catfritz these changes look good! I just have two very minor updates to request before we kick off this for release review.

CHANGELOG.md Outdated
- netsuite2__balance_sheet
- netsuite2__income_statement
- netsuite2__transaction_details
- The above change was implemented for Netsuite2 because `type_name` was previously utilized to categorize records, which was causing issues for users that customized the `type_name` values. Utilizing the unique identifier `account_type_id` instead produces more accurate results in the final models. Below is a list of the account type name and type id pairings used:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the link here for where the pairings came from.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

lower(accounts.name) like '%intercompany%' as is_account_intercompany,
coalesce(parent_account.name, accounts.name) as parent_account_name,
lower(accounts.type_name) like '%expense' as is_expense_account, -- includes deferred expense
lower(accounts.type_name) like '%income' as is_income_account,
lower(accounts.account_type_id) in ('expense', 'othexpense', 'deferexpense') as is_expense_account, -- includes deferred expense
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably remove the comment here as it is a bit obvious with these updates.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@fivetran-catfritz fivetran-catfritz merged commit 06e4923 into main Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Income Statement model not accounting for renamed account types
2 participants