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

feat(parser): add output references to for gen flows #2452

Merged
merged 5 commits into from
Oct 2, 2024

Conversation

chrismclarke
Copy link
Member

@chrismclarke chrismclarke commented Oct 1, 2024

PR Checklist

  • PR title descriptive (can be used in release notes)

Description

Following on from #2440, this PR reverts the change so that data_pipe and generator flows are again stored within the output jsons (and still copied to main app), but also adds an updated _output_flows property to each that creates a reference to the generated outputs for use in debugging

Review Notes

See example pre/post changes output on debug repo created via pr
https://github.com/IDEMSInternational/app-debug-content/pull/92/files

Dev Notes

There's a few extra changes made to the code just to make the functions more consistent between data_pipe and generator parsers. Now I've done that I can clearly see about 90% of the code is identical between them (which makes sense given they both primarily function to take a bunch of flow inputs and some parameters and produce flow outputs). I had thought to try to unify the two, but possibly overkill as the duplicate code should still be reasonably easy to maintain in both for now.

In the future maybe we could merge both under some sort of transformer flow type or similar, or maybe it will be clear enough that data_pipes focus on transforming data_list types and generators on anything else.

Git Issues

Closes #

Screenshots/Videos

If useful, provide screenshot or capture to highlight main changes

@github-actions github-actions bot added feature Work on app features/modules scripts Work on backend scripts and devops and removed feature Work on app features/modules labels Oct 1, 2024
Copy link
Collaborator

@esmeetewinkel esmeetewinkel left a comment

Choose a reason for hiding this comment

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

I inspected the two debug content sync PRs and all looks great, thanks.

Copy link
Collaborator

@jfmcquade jfmcquade left a comment

Choose a reason for hiding this comment

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

Looks good.

There's a few extra changes made to the code just to make the functions more consistent between data_pipe and generator parsers. [...] In the future maybe we could merge both under some sort of transformer flow type or similar, or maybe it will be clear enough that data_pipes focus on transforming data_list types and generators on anything else.

I suppose the question is really whether that would make sense from an authoring perspective – if conceptually it would make sense to unite them then I think that could be good. What do you think @esmeetewinkel? I do agree that for now the distinction makes sense as one operates on data_listss and the other on other flow types.

@esmeetewinkel
Copy link
Collaborator

What do you think @esmeetewinkel? I do agree that for now the distinction makes sense

To me generators and data pipes are quite different things, although I appreciate they might grow more similar as we extend functionality

... as one operates on data_lists and the other on other flow types.

I'm confused by this statement - generators can also operate on data lists. To me the distinction is

  • generators iteratively (looping over a data list) create content of any flow type, whereas
  • data pipes modify data lists

@chrismclarke
Copy link
Member Author

To me generators and data pipes are quite different things, although I appreciate they might grow more similar as we extend functionality

... as one operates on data_lists and the other on other flow types.

I'm confused by this statement - generators can also operate on data lists. To me the distinction is

  • generators iteratively (looping over a data list) create content of any flow type, whereas
  • data pipes modify data lists

You're right, that doesn't summarise very well. Data pipes also loop over a data_list, just like a generator, but only output to data_lists (they create new outputs instead of modifying the input, so behave in the same way as generators for reading inputs and writing outputs).

But yeah, in terms of the code the duplication is to both read in the source data and output the generated data, then both have a 1-line call to process the data - but then the specific processors are totally different (array map, filter, sort operations vs find/replace). So I guess if we ever wanted to combine we could always add a new pipe operation to handle replacement of templated variables, but also happy to keep separate

@chrismclarke chrismclarke merged commit effdb27 into master Oct 2, 2024
6 checks passed
@chrismclarke chrismclarke deleted the feat/generated-flow-references branch October 2, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scripts Work on backend scripts and devops
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants