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

Implement export of all clients #14

Open
kfogel opened this issue Jul 31, 2015 · 0 comments
Open

Implement export of all clients #14

kfogel opened this issue Jul 31, 2015 · 0 comments
Assignees

Comments

@kfogel
Copy link
Member

kfogel commented Jul 31, 2015

'Nuff said. We'll also want import too, but one thing at a time.

@kfogel kfogel self-assigned this Jul 31, 2015
kfogel added a commit that referenced this issue Jul 31, 2015
* app/views/index.jade: Add exportAll button.

* public/css/main.css (#searchForm #addNewClient): Style the button.

* public/js/index.js:
  (switchToSearch): Set text for new button.
  (exportAll): New function, called on click.  Just print JSON for now.
kfogel added a commit that referenced this issue Jul 31, 2015
First step: get all clients and console-log them as JSON.

* app/views/index.jade: Add exportAll button.

* public/css/main.css (#searchForm #addNewClient): Style the button.

* public/js/index.js:
  (switchToSearch): Set text for new button.
  (exportAll): New function, called on click.  Just print JSON for now.
kfogel added a commit that referenced this issue Jul 31, 2015
Get all enrollments and console-log them as JSON too.

This has only been tested with 0 enrollments so far, since we don't
have any enrollments sample data at the moment.  However, we know the
REST API call is correct because it get an empty array back.

* app/controllers/client.server.controller.js
  (exports.getEnrollments): New function.

* app/routes/client.server.routes.js: Add '/enrollments' route.

* public/js/index.js (exportAll): Get enrollments.
kfogel added a commit that referenced this issue Jul 31, 2015
Get downloads working from browser.  The downloads are still in JSON
format, not yet CSV.

* public/js/index.js: Create downloadable files.  Add long comment,
  based on IRC conversation, explaining why we're doing it this way.

* public/js/lib/FileSaverjs/: Add this third-party library from
  commit e3485a652 of https://github.com/eligrey/FileSaver.js, except
  replace upstream `FileSaver.min.js` with one made by yui-compressor.

* public/js/lib/Blob.js/: Add this third-party library from
  commit b0141af46 of https://github.com/eligrey/Blob.js, and create
  `Blob.min.js` using yui-compressor.

* app/views/index.jade: Include the above new libraries.
kfogel added a commit that referenced this issue Jul 31, 2015
Minor appearance tweak to Export button.

* public/js/index.js: Make export button text explain more.

* public/css/main.css (.container): Increase height to fit the wider
  export button which, because it is wider, is now on the bottom.
kfogel added a commit that referenced this issue Jul 31, 2015
Start determining the CSV output format.

* public/js/index.js: Start describing the CSV components.

* examples/Client.csv: An example CSV export, courtesy of Dave.
kfogel added a commit that referenced this issue Aug 5, 2015
* public/js/index.js: Export HMIS_Data.zip expanding to subfolder and
  file `HMIS_Data/Clients.csv`, the latter now finally in CSV format.
  Remove the experimental enrollments export code, as it's not that
  useful for completing the export of Universal Data Elements (UDE).

* public/js/lib/jszip/: Add this third-party library from commit
  e3485a652 of https://github.com/Stuk/jszip, except replace upstream
  `dist/jszip.min.js` with our own made by yui-compressor.

* app/views/index.jade: Require `jszip`.
kfogel added a commit that referenced this issue Aug 5, 2015
Include the required Export.csv file in the export now.  Make
Client.csv be much closer to the format described in the HMIS CSV
Specifications (4_0FINAL).  Note that this means deviating from the
example provided in `examples/Client.csv`, particularly in the way the
Race columns are handled but also in other columns; I think that
example file is not fully standards-compliant, so deviation is okay.
kfogel added a commit that referenced this issue Aug 5, 2015
* app/views/index.jade: Move Export button to top.

* public/js/index.js: Tweak text of Export button.

* public/css/main.css (.container): Increase height to accomodate the
  fact that we have two buttons now.  Probably commit b34aeba is
  when this change should have happend -- c.f. commit 72cada8.
kfogel added a commit that referenced this issue Aug 5, 2015
* public/js/index.js: Export VeteranStatus, and explain in a comment
  why VeteranInformation is not exported.  Export a placeholder for
  UserId, but with no data for now.  Fix the column header name for
  "ExportIdStr".  Stop double-quoting integer values.  Remove spurious
  blank line from a comment.
kfogel added a commit that referenced this issue Aug 5, 2015
* public/js/index.js (exportAll): Move the Export.csv stanza out of
  the "/clients" GET block and in to the top level of this function.
kfogel added a commit that referenced this issue Aug 5, 2015
This rearranges parts of the export code and adds new blocks to
produce Enrollment.csv and Exit.csv, both of which are specified by
the HMIS CSV standard to contain some of the Universal Data Elements.

* public/js/index.js (exportAll): Correct the "ID" vs "Id" situation.
  Move CSV string initializations to top.  Add new blocks for
  Enrollment.csv and Exit.csv.  Fix some mis-punctuated code that
  Javascript was too forgiving to punish me for.  In Client.cvs block,
  don't allow PersonalId to be null, and export it as a string instead
  of as a number.  Remove placeholder HUD HMIS DE#s from comment
  descriptions for fields that don't have DE#s.  Add a comment about
  how we're not sure whether OrganizationId even belongs here.
  Correctly conditionalize quoting of dateCreated and dateUpdated
  strings based on whether they're null or not.  Fix some missing
  semicolons.

BREAKAGE WARNING: After this commit, the export no longer works.  It
produces HMIS_Data.zip, but in that zip file, only Export.csv is fine;
the other three .csv files are all 0 bytes.  I'll bet this is a
multithreadedness issue about when the Javascript .done() callbacks
complete in response to API requests.  If I initialize the four
foo_csv variables to non-empty strings at the top of the function,
those test strings get exported even though the CSV data that we want
appended to them is absent.  This is because the CSV-appending happens
inside callbacks that are waiting for responses from the server, but
by the time those responses come, the exportAll() function has already
finished.  In the next commit I'll try a fix.
kfogel added a commit that referenced this issue Aug 5, 2015
* public/js/index.js (exportAll): Nest the successive API request
  blocks and the final zipfile block in the obvious way, to avoid the
  classic problem of being unable to wait for asynchronous callbacks.
kfogel added a commit that referenced this issue Aug 5, 2015
* public/js/index.js (exportAll): Make the ExportID look a little more
  like an ID by removing some punctuation.  Add OtherResidence field
  to Enrollment.csv.  Check if projectExitDate is null, even though
  the spec disallows that, because in our sample data it is null.
cecilia-donnelly added a commit that referenced this issue Aug 5, 2015
Add a missing column header and column to export (NameDataQuality).
Show zeroes where they are allowed -- that is, for elements that are
allowed to be Null, don't test for null values and substitute an empty
string.  Just pass the value.
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