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

Scaffold Excel Generation Endpoint #3191

Merged
merged 5 commits into from Oct 31, 2019
Merged

Commits on Oct 25, 2019

  1. Add BMPxlsx library

    This library will be used to write an excel file
    with BMP values. Developed by the Academy of
    Natural Sciences. Source:
    
    https://github.com/TheAcademyofNaturalSciences/BMPxlsx
    rajadain committed Oct 25, 2019
    Copy the full SHA
    602f88b View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2019

  1. Scaffold worksheet endpoint

    This will be available at /api/modeling/worksheet/,
    the first modeling method available in the public API.
    This is done for future compatibility, where we expect
    all modeling methods to migrate to eventually. Also
    because the input this takes (just a shape) is closer
    to an Analyze method than the existing Modeling methods.
    rajadain committed Oct 31, 2019
    Copy the full SHA
    fe3470f View commit details
    Browse the repository at this point in the history
  2. Cut and pair input shape with HUC-12s

    The input shape is intersected with HUC-12s, and for as many
    it intersects, we make a pair of the HUC-12 with the clipping
    of the shape to that HUC-12.
    
    For every such pair, we will calculate a dictionary of values
    used to generate an Excel sheet.
    rajadain committed Oct 31, 2019
    Copy the full SHA
    55f0bb1 View commit details
    Browse the repository at this point in the history
  3. Add Spreadsheet Tool template

    This is also available in https://github.com/WikiWatershed/MMW-BMP-spreadsheet-tool/,
    although the version there is older than the one we are
    supposed to use, so the newer version is added directly
    to the repo.
    
    From a runtime perspective, it is better to have the template
    available immediately on disk for dynamic generation, rather
    than downloading it from GitHub every time. This protects us
    from GitHub outages.
    
    This does cause some redundancy, and the need to keep the two
    versions in sync. An alternative to this direct inclusion is
    to include the source repo as a pinned submodule, and update
    the submodule SHA reference when that repo is updated.
    
    However, given that the original repo has an older version
    of the file, I'm including the new version here for now. The
    strategy for maintenance going forward is a policy decision
    that should be made by the team.
    rajadain committed Oct 31, 2019
    Copy the full SHA
    5105b10 View commit details
    Browse the repository at this point in the history
  4. Add export endpoint for generating the worksheet

    The /api/modeling/worksheet endpoint will be used to
    generate a JSON blob of values, which will then be
    submitted to this endpoint to generate the actual
    spreadsheets.
    
    The expected input is still to be clarified, but will
    be something along the lines of this:
    
    [
    	{
    		"huc12": { ... },
    		"aoi": { ... },
    	},
    	{
    		"huc12": { ... },
    		"aoi": { ... },
    	},
    ]
    
    For every pair of values, we copy the worksheet template
    and fill in the values, save the new files in a temporary
    directory, zip them all up in memory, delete the directory,
    and return the zip file.
    rajadain committed Oct 31, 2019
    Copy the full SHA
    699cbc9 View commit details
    Browse the repository at this point in the history