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

steps should only save their model by default #1573

Open
fredkingham opened this issue Jul 18, 2018 · 0 comments
Open

steps should only save their model by default #1573

fredkingham opened this issue Jul 18, 2018 · 0 comments

Comments

@fredkingham
Copy link
Contributor

At the moment pathways save the world which has lead to several surprising events.

pseudo code resolution looks like the below.

class Step:
    def pre_save(self, data, raw_data, user, patient, episode):
        return data[self.model.get_api_name()] = self.get_model_data(raw_data)

class Pathway:

    def pre_save(self, data, raw_data, user, patient, episode): pass

    def save(self, raw_data, user, patient, episode):
        data = {}
        for step in self.get_steps():
             data = step.pre_save(data, raw_data, user, patient, episode)

        data = self..pre_save(data, raw_data, user, patient, episode)
        patient.bulk_update(data, user, episode)

If a step does not have a model it should blow up.

We can probably run the has Pathway.remove_unchanged_subrecords function and compare the new to_save dictionary with the old one and make sure that we were not relying on some inference logic and explode if so.

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

No branches or pull requests

1 participant