Basically, we are developing an open-source feature to upload medical data to FileCoin to decentralize the long-term or "cold" storage of medical data. This can be helpful with researchers, healthcare systems are required by law to keep a CT scan on file for 7 years. The storage cost can be costly so providing a feature and a service like to into OpenVessel Platform via API can really help the USA healthcare system, I can upload CT scans to a database already through a flask backend so we're halfway there but the problem is coding for the FIleCoin or IFPS system.

Medical Images uploaded to FileCoin by OpenVessels showcase

How it's made

We are simply passing DICOM files to JSON format then passing the upload to Web3. Storage API to manage the FileCoin upload and return CID. TLDR we are web requesting between flask and javascript, I really want a python client library instead but that's ok we can hack it afterward. The specifics behind this and what impressed my team is the potential of the idea. In healthcare imaging data is the fastest area of data growth occurring across the world. So we can upload DICOM files or medical data to a platform very easily with little development time involved but the cost of storage is high each DICOM file is 512 kb and this in total with 184 DICOM files can be about 134 MB for a single patient, so for many scans on a single patient or the hundreds of patients processed with medical images this can costly. The technical part - First the flask server starts its initialized app and all its routes and endpoints for each upload made to the platform it generates a session_id use to query and insert delete data out of SQLite. So when we visit the browsers or webpage jinja2 render engine in flask loads the flask data and its javascript. Javascript functionality and modules are not inherit in flask so we have to "hack" webpack with flask framework to past it a bundle.js file called FileCoin.js. This javascript file simply picks up the session_id from the HTML page containing specific session_id to AJAX request the flask backend to get data and return a JSON format data of the DICOM files to Javascript function, this passes the medical data into blob that is then pass to Web3.Storage client object to pack it as a CAR to send to FileCoin and handle deals automatically for us via the Web3.Storage API and its javascript library. After the client object is done it passes back a CID that is AJAX request to flask to store CID into SQLite database for user events. On the flask side we have to write the logic to query the database everytime a cid is POST request on its endpoint or when we reterive data we pass the CID back to JS code to handle the reterivel which POST JSON data back to flask app to insert missing or deleted data.

Technologies used