Skip to content

Conversation

@landonreed
Copy link
Contributor

@landonreed landonreed commented May 27, 2020

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JSDoc and code is thoroughly commented
  • The description lists all applicable issues this PR seeks to resolve
  • The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing

Description

Adds a Feed Transformation Settings item to the Feed Source Settings tab:
http://localhost:9966/feed/$feed_id/settings/transformations

This new menu allows users to create feed transformations that correspond to changes in ibi-group/datatools-server#309. Currently, the only supported transformations (by design, until we flesh out some other use cases) are ReplaceFileTransformation and ReplaceFileFromStringTransformation.

image

Re: #545.

@landonreed landonreed marked this pull request as ready for review June 12, 2020 14:56
@codecov-commenter
Copy link

codecov-commenter commented Jun 12, 2020

Codecov Report

Merging #579 into mtc-20200310 will decrease coverage by 22.75%.
The diff coverage is 6.91%.

Impacted file tree graph

@@                Coverage Diff                @@
##           mtc-20200310     #579       +/-   ##
=================================================
- Coverage         38.42%   15.67%   -22.76%     
=================================================
  Files               315      323        +8     
  Lines             17255    16417      -838     
  Branches           5268     4991      -277     
=================================================
- Hits               6630     2573     -4057     
- Misses             9246    11824     +2578     
- Partials           1379     2020      +641     
Flag Coverage Δ
#end_to_end_tests ?
#unit_tests 15.67% <6.91%> (-0.15%) ⬇️
Impacted Files Coverage Δ
lib/common/util/config.js 70.90% <0.00%> (-9.10%) ⬇️
lib/editor/actions/trip.js 25.00% <0.00%> (-0.21%) ⬇️
lib/gtfsplus/components/GtfsPlusVersionSummary.js 0.00% <0.00%> (ø)
lib/manager/actions/user.js 16.10% <ø> (-29.74%) ⬇️
lib/manager/actions/versions.js 12.60% <0.00%> (-43.09%) ⬇️
lib/manager/components/FeedSourceSettings.js 0.00% <0.00%> (-53.63%) ⬇️
lib/manager/components/GeneralSettings.js 0.00% <0.00%> (ø)
...manager/components/transform/FeedTransformRules.js 0.00% <0.00%> (ø)
...manager/components/transform/FeedTransformation.js 0.00% <0.00%> (ø)
...components/transform/FeedTransformationSettings.js 0.00% <0.00%> (ø)
... and 282 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ed815f...f6d8ab8. Read the comment docs.

Copy link
Contributor

@evansiroky evansiroky left a comment

Choose a reason for hiding this comment

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

This UI looks simple enough. As it is, I have just a few recommendations for change. However, a larger issue is still trying to figure where in the process of creating feed versions to transformations take place. I feel like this is an important design and implementation choice that we oughta spend some time trying to figure out so that is easily understood. Right now, the whole idea of having to select from up to 6 different retrieval methods of which I'm not sure I fully understand how they all work makes me very confused.

@evansiroky evansiroky assigned landonreed and unassigned evansiroky Jun 13, 2020
Copy link
Contributor

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

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

Echoing @evansiroky's comments on further discussing the workflow.
The big transformation settings file should be broken up so each component class is defined is in its own file, so things are easier to find.

@binh-dam-ibigroup binh-dam-ibigroup removed their assignment Jun 24, 2020
Copy link
Contributor

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

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

Mostly cosmetic issues.

@landonreed landonreed assigned evansiroky and unassigned landonreed Jul 8, 2020
</h4>
<small>
Apply this transformation to GTFS feeds created through the following methods.
</small>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be good to have some documentation or a link to more documentation for users to see here so they can learn what each of these transformation "methods" are.

/**
* Returns human readable name for transformation type.
*/
export function getTransformationName (
Copy link
Contributor

Choose a reason for hiding this comment

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

This function seems very susceptible to funky additions and odd naming patterns for each transformation type. Already, I don't think this would work with a DeleteRecordsTransformation type. I think it'd be a little more maintainable if we used the strategy pattern and had each transformation type have it's own function to create the transformation name. Each of these functions could be composed of smaller sub-functions if needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, it'd be great for this function to have a unit test.

Comment on lines 14 to 20
let name = type
// Remove transformation from name.
.replace('Transformation', '')
// Regex finds/captures words in camel case string and splits camel-cased words.
// Derived from: https://stackoverflow.com/a/18379358/915811
.replace(/([a-z])([A-Z])/g, '$1 $2')
name = toSentenceCase(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Too fancy and complex. Also, not sure how well this would work with i18n. There's got to be a way to just use a lookup of transformation type to transformation human-readable name.

Copy link
Contributor

@evansiroky evansiroky left a comment

Choose a reason for hiding this comment

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

Build is failing due to a flow error and I have a recommendation to refactor the getTransformationName function.

@evansiroky evansiroky assigned landonreed and unassigned evansiroky Jul 10, 2020
@landonreed landonreed merged commit 3d2c3c0 into mtc-20200310 Jul 14, 2020
@landonreed landonreed deleted the gtfs-transform branch July 14, 2020 17:51
@landonreed landonreed mentioned this pull request Aug 12, 2020
8 tasks
@binh-dam-ibigroup binh-dam-ibigroup mentioned this pull request Jun 20, 2022
5 tasks
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.

5 participants