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

Ingest Google sheets #1

Open
jamdelion opened this issue Sep 7, 2022 · 1 comment
Open

Ingest Google sheets #1

jamdelion opened this issue Sep 7, 2022 · 1 comment

Comments

@jamdelion
Copy link
Member

No description provided.

@ZephSibley
Copy link
Member

The way I usually handle this kind of problem is by applying the Strategy pattern; https://refactoring.guru/design-patterns/strategy

Essentially there would be a class looking something like:

class GoogleSheetIngester {
    constructor(strategy) {
         this._strategy = strategy;
    }
    ingest(sheet_link_or_something) {
        // Logic here around getting the sheet data and serialising it into a standard format like JSON
        return this._strategy.ingest(sheet_data)
    }
}

class DeliverySheet:
    ingest(sheet_data) {
        // Handle the specific logic for the delivery sheet, keeping the knowledge of what to expect from that sheet inside this class.
    }
}

result = GoogleSheetIngester(DeliverySheet).ingest(sheet_link_or_something)

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

2 participants