Giter Club home page Giter Club logo

auviewer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

auviewer's Issues

Rename api.listAvailableProjects

Rename api.listAvailableProjects to api.listProjects, and add a deprecation warning to the original function handle. This aligns better with user expectations and method naming patterns used elsewhere in the API.

Standardize console output to use logging library

Four main tasks here:

  • Virtually all current logging.info statements likely should be converted to logging.debug
  • Virtually all print statements should likely be converted to logging.info
  • The default logging level in init.py should likely be changed to info
  • The debug-state logging level in init.py should likely be changed to debug

Uncaught TypeError on "Show/Hide Graphs" button

"Show/Hide Graphs" button click does not load "Available Graph Interface" pop up.

It shows an error on inspect console window:
Uncaught TypeError: Cannot read properties of null (reading 'show')
at HTMLButtonElement.onclick (project?id=1:6)

Capture

Implement a Task Queue

Implement a task queue for downsampling files (in future, it may be used for other jobs such as featurization).

Refer to #14 for the processes which will use the task queue.

Ideally, the task queue will create no new dependencies outside of Python, such that the viewer may still be installed with only the pip install command and run as a pure python module.

Optionally, we may add instructions for additional installation/configuration outside of Python for better performance or robustness (e.g. Redis).

Make annotations templatable

A single annotation form structure is currently hard-coded into the viewer. Generalize this such that any annotation template structure can be specified (i.e. make it possible to specify any set of field names, types, and value options).

The current implementation is:

  1. User completes annotation form input and clicks Create
  2. Client (JS) code reads the values into a class instance which represents the annotation on the client side
  3. Client code submits the data object as json to the backend server.
  4. Server stored the annotation in the database such that the label (form field values) is stored as json in a single database column, and other things like file, series, and start & stop times are represented as columns in the database.

And also, there is obviousy the corresponding requisite functionality for annotation retrieval, rendering, and updating.

Because the backend treats the label (all form data) as a single json string and has no specific functionality (to my recollection) for what is inside the label (the form structure), it is only the client-side javascript code which needs to be generalized.

Delete file & dependent data in database with command line argument

Leaving this here as a nice-to-have for future:

  1. Delete file & patterns/annotations from database
    1. Since the default behavior of deleting a file from disk is to leave patterns & annotations intact, there should be a way to delete a file from the database using a command line argument.
    2. The -df or --deletefile flag with a filename argument should delete the file and its patterns & annotations from the database.
      1. Example: auv -df somefile.h5

Changes to File.f and File.pf

We've incurred some regressions, and some functionality has also changed. Therefore, we wish to set the functionality of File.f and File.pf to the following:

  • Anytime self.f property is accessed, it checks if file is opened and, if not, loads the file (which includes loading metadata, etc.)
  • Anytime self.pf property is accessed, [same as above]

After changes, please test that the following still works:

  • Loading viewer with an un-downsampled file results in the file being
  • Using the -ds flag to downsample a file works properly

One caveat:

  • During a downsampling job, it first loads the file. This would result in also loading the processed file (e.g. when Series loads DownsampleSet which in turn retrieves number of downsamples available). This needs to be suppressed, e.g. with a flag of some sort, in order to work properly.

Incorrect File Count Displayed

The projects list on the index page is displaying an incorrect file count for a project. Reproduction details available internally.

Improve viewer startup time

The viewer currently takes too long to startup. Please improve the startup time. Possible strategies include:

  • Improving file load time (diagnose what is taking the most time during the file load process)
  • Not opening all files on startup

Virtual projects

Currently, a project is defined by a folder within the projects folder in the viewer's data directory on disk, and its files (original & processed) are contained therein. However, sometimes a user may want to create a virtual project, e.g. a project which consists of files already contained in another project. A common example would be where multiple studies are occurring on a single set of files (or different subsets of a single master set of files).

Please add the ability to create virtual projects in the viewer such that the virtual project contains all or some of the files of a different project.

Make Downsample Parameters a Local File Property

Currently, the downsample parameters (M and stepMultiplier, see here) are configured at the application level, and the processed files which contain the downsample data are assumed to be in sync with these parameters.

Please change this so that these parameters are configured per-file and embedded as metadata in the processed files, such that the parameters can vary between files.

Make Current Assignment Overlay Former Assignments

On the canvas underlay renderer, the current assignment alert is set to overlay most other things. However, if there is a previously annotated assignment, it might overlay the current assignment. Change this so that the current assignment is rendered above all other underlay items.

Generalize Display of Events

If you modify auviewer/file.py line 291 (link) to 'clinical/medications' instead of 'ehr/medications' and then run the viewer against the sample file (as outlined in the Getting Started with Development documentation), you will see a hard-coded display of this specific events series:

image

The relevant places in code where this is done are:

  • getEvents() function in file.py on line 271
    • This function is called in the getInitialPayload() function in file.py, which is in turn called in the initial_file_payload() http handler function in serve.py (which handles the initial_file_payload API request)
  • Within the File.prepareData() JS function in static/www/js/classes/file.js starting at line 931
  • File.renderEventGraphs() function in static/www/js/classes/file.js on line 1216

You can see where the events data comes through from the initial_file_payload method in the browser console:

image

We need to generalize this behavior to handle any event series. Actually, the js code may already be fully generalized or mostly so. The backend code needs to be changed, however, to identify and assemble all series which can be rendered as events.

The viewer uses the audata library to read from the audata file format (audata is basically a file format superimposed on hdf5). One good place to start here is by familiarizing yourself with using the audata library to open the sample file. From the auviewer (outer) directory, try this Python (I have not checked this, but it should be something like this):

import audata as aud
af = aud.File.open('examples/sample_patient.h5')

# print the default representation of the medications dataset
print(af['/clinical/medications'])

# pull the entire medications series as a pandas dataframe, and then print it
df = af['/clinical/medications']).get()
print(df)

So, generally the proof-of-concept code in the viewer which renders the medications event series treats each row in the medications table as a medication.

My suggestion for now would be to start by adding a way to specify a list of series to treat as events in the template.

Later, we can do fancier things like:

  • Improve the visualization
  • Add different ways to represent/render events
  • Auto-magically try to guess which series are event series even if they haven't been specified
  • Allow the user to toggle between representation types (numeric series vs event series) in the browser

File & Folder Add/Change Handling

Use cases:

  1. User adds new project folder
    1. Create new project in the database
    2. Instantiate the project in memory
    3. If there are any original files in the directory, handle with the "new original file" process described below.
  2. User adds new original file to project folder
    1. Add file to the database unless it exists already
    2. Instantiate the original file in memory
    3. If the processed file does not exist, add the downsampling job to the downsampling task queue
    4. When downsampling is complete, file will be fully available in the UI
  3. User replaces original file
    1. Delete old processed file, if it exists
    2. Add the downsampling job to task the downsampling task queue
    3. When downsampling is complete, file will be fully available in the UI
  4. User deletes original file
    1. Try to delete the file in the database
      1. The delete query should fail if it has incoming foreign key references (e.g. from patterns or annotations). This is expected and desired behavior. If the file has these items, it will be left intact in the database. Otherwise, it will get deleted.
    2. Delete the file from memory
      1. If the file does not get deleted from the database, it should not appear in the UI (since it exists in the database but not on disk). Also see: Load project spec below.
    3. Delete the processed file, if it exists
  5. User adds processed file
    1. [ This use case is intentionally not handled. There is no good reason the administrator would do this other than rare edge cases. ]
  6. User replaces processed file.
    1. [ This use case is intentionally not handled. There is no good reason the administrator would do this other than rare edge cases. ]
  7. User deletes processed file
    1. [ This use case is intentionally not handled. There is no good reason the administrator would do this other than rare edge cases. ]
  8. While auviewer is not running, user replaces original file
    1. [ We plan to track last-modified-date of each file in the database as well as a hash. If last-mod-date changes, then we will re-compute hash and check. If hash has also changed, we will re-downsample & update last-mod-date & hash. If not, we will update last-mod-date only. ]
    2. Upon startup & detection, follow the same procedure as User replaces original file above.

Related functionality, to-be state:

  1. Load project (e.g. load project on viewer startup)
    1. Load files from database
    2. If original file does not exist on disk, skip/ignore it (it should not be loaded into memory and should not be listed in the UI)
    3. [We believe this is what is happening right now, but the spec is included for completeness.]

Error on retrieving meds (file.py)

After selecting a new project when I selected a file (sample_patient.h5) to load, the console showed an error. TypeError: 'NoneType' object is not subscriptable.

nb: I found 'medication' & 'low_rate' dataset under group 'clinical' using HDFView.

Console error

Default username/password

There is currently a hard-coded default username & password. Please change this to prompt on first load for a default username & password.

Downsampling Changes with Task Queue

Now that we're implementing a task queue, let's modify the downsampling workflow to the following:

Effectively, when the viewer starts up, it should not load any files, however it should check whether each file has been downsampled and, if not, add a downsampling job for the file to the task queue.

Let's implement this as follows:

  1. In File.py -> File.init(), remove processNewFiles and processOnly flags
  2. In File.py -> File.init(), at end of function, check whether processed file exists (please use pathlib.Path library since we've standardized codebase on that) and, if it does not exist, add downsampling job to the task queue. However, it still should not open the original or processed file on load (in order to not bloat process startup time).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.