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

Renaming output columns #118

Closed
AnneSchoenauer opened this issue Jan 4, 2024 · 12 comments · Fixed by #137
Closed

Renaming output columns #118

AnneSchoenauer opened this issue Jan 4, 2024 · 12 comments · Fixed by #137
Assignees
Labels
enhancement New feature or request

Comments

@AnneSchoenauer
Copy link

Can we please rename the following columns for the output file. I assume this is something that should change in the tiltIndicatorAfter package? Is this correct? However, @maurolepore I think the function names already changed correct? So it is just to make sure that the output tables have the right names.

I am referring to these output tables here, which @SKruthoff gave Tilman and me on the 22nd of December.

  1. Emission profile product level:
    Renaming PCTR_risk_category in emission_profile.

  2. Emission profile company level:
    Renaming PCTR_risk_category in emission_profile.
    Renaming PCTR_share in emission_profile_share.

  3. Emission profile upstream product level (please note this was an empty file but I assume the following renaming):
    Rename 'ISTR_risk_category' into 'emission_usptream_profile'

  4. Emission profile upstream company level:
    Rename 'ISTR_share' into 'emission_usptream_profile_share'
    Rename 'ISTR_risk_category' into 'emission_usptream_profile'

  5. Sector profile product level
    Rename 'PSTR_risk_category' into 'sector_profile'
    Rename 'sector' and 'subsector' to 'sector_scenario' and 'subsector_scenario'
    Rename 'profile_ranking' into 'sert'

  6. Sector profile company level
    Rename 'PSTR_risk_category' into 'sector_profile'
    Rename 'PSTR_share' into 'sector_profile_share'

  7. Sector profile upstream product level
    Rename 'ISTR_risk_category' into 'sector_profile_upstream'

  8. Sector profile upstream company level
    Rename 'ISTR_risk_category' into 'sector_profile_upstream'
    Rename 'ISTR_share' into 'sector_profile_upstream_share

@maurolepore
Copy link
Contributor

maurolepore commented Jan 5, 2024

@AnneSchoenauer, sounds great. I've been looking forward to this.

Note the new names are use "emissions" in plural.

Here is a record of the rename in tiltIndicator: https://2degreesinvesting.github.io/tiltIndicator/reference/rename.html

We already use the new names in tiltIndicator, in tiltToyData, and in the new API of tiltIndicatorAfter but in tiltIndicatorAfter we still use the old names in a bunch of datasets and output columns (as you highlight here).

Note that the change can break existing code if we simply renames one thing to other. If we want to make the change in a backward compatible way to avoid disrupting other team-members, then we need to go through a more gentle deprecation process. For example, the output table could have the deprecated old name AND also the new name for some time, then after a few weeks or months we retire the deprecated name and leave only the new one. There are more elegant ways to do that but this would be the simplest.

@kalashsinghal
Copy link
Collaborator

Rename 'ISTR_risk_category' into 'sector_profile_upstream'

@AnneSchoenauer I can see that you removed *_risk_category suffix from the names. What's the reason behind removing this suffix?

Rename 'profile_ranking' into 'sert'

@AnneSchoenauer What does sert mean here? Also, should we also then change the function name profile_ranking inside the package?

@AnneSchoenauer
Copy link
Author

@kalashsinghal

The suffix is removed as @Tilmon and I decided that strictly speaking the variable is not a risk variable anymore but a profile variable. This change is a result of changing PCTR/ICTR/PSTR/ISTR to emission profiles and sector profiles.

sert means sector emission reduction targets. It is quite long that's why we called it sert. Do you want us to come up with a name that is more meaningful than sert but not too long as sector emission reduction targets?

Please leave the function's name as it is. It is just that the profile_ranking in the sector profile is super similiar methodological wise than the profile_ranking of the emission profile. However, sert makes more sense in the output files though.

@AnneSchoenauer
Copy link
Author

@kalashsinghal could you when you implement this please use Mauro's suggestions on backward compatibility here

@maurolepore
Copy link
Contributor

maurolepore commented Jan 11, 2024

@AnneSchoenauer,

@kalashsinghal and I discussed backward compatibility and we think a more elegant solution is this:

  1. Rename all the columns inside a single internal function, say rename_118(), that is called right at the end of each profile_*() functions.
  2. During a reasonable deprecation period (e.g. 2-12 weeks) allow internal users (e.g. the database team) to dissable rename_118() with an option, e.g. options("tiltIndicatorAfter.dissable_118"). For an example see here.

We plan to @mention the database-team in the relevant PR so they can try it before we merge it. If anything breaks they can share the broken code with us and we can help adapt it to the new output. And while we do that we can simply dissable rename_118() in their code so we can merge the PR.

What do you think?

@AnneSchoenauer
Copy link
Author

Yes, this is great!

@maurolepore
Copy link
Contributor

Great. Then we plan for Kalash to draft a PR then I help review it.

@kalashsinghal
Copy link
Collaborator

sert means sector emission reduction targets. It is quite long that's why we called it sert. Do you want us to come up with a name that is more meaningful than sert but not too long as sector emission reduction targets?

@AnneSchoenauer I can rename it to "sert", however it would make more sense to the user if the column name has words instead of abbreviations. Please let me know of your final decision! Thanks!

@AnneSchoenauer
Copy link
Author

Good point. @Tilmon what do you think about this? A different name could be sector_targets

@maurolepore
Copy link
Contributor

We start from "sector emissions reduction targets"

I think the name of the function that produces the column adds useful context. I think of it this way:

sector_profile <- profile_sector(...)
sector_profile$sector_emissions_reduction_targets

Here we see the word "sector" is a bit redundant. If we drop it we get this

sector_profile$emissions_reduction_targets

If that's still too long maybe emissions_reductions or reduction_targets? (emissions_targets sends the wrong message).

@AnneSchoenauer
Copy link
Author

AnneSchoenauer commented Jan 12, 2024

@maurolepore super valuable information - thanks!

@Tilmon I would prefer reduction_targets are you fine with this?

@kalashsinghal kalashsinghal mentioned this issue Jan 15, 2024
11 tasks
@Tilmon
Copy link
Collaborator

Tilmon commented Jan 15, 2024

Hi @maurolepore and @AnneSchoenauer , I'm fine with reduction_targets .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants