%3CLINGO-SUB%20id%3D%22lingo-sub-1985386%22%20slang%3D%22en-US%22%3EUsing%20a%20Python%20Flask%20application%20with%20an%20Azure%20ML%20generated%20API%20endpoint%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1985386%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.linkedin.com%2Fin%2Fivanmedranovelazquez%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EGuest%20Post%20by%20Ivan%20Medrano%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22IvanM.jpg%22%20style%3D%22width%3A%20200px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F240162i7E57BF8C860A2FA1%2Fimage-size%2Fsmall%3Fv%3D1.0%26amp%3Bpx%3D200%22%20role%3D%22button%22%20title%3D%22IvanM.jpg%22%20alt%3D%22IvanM.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20am%20a%20graduate%20student%20at%20%3CA%20href%3D%22https%3A%2F%2Fwww.northwestern.edu%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3ENorthwestern%20University%3C%2FA%3E%20in%20the%20Data%20Science%20program%20and%20a%20developer%20with%20expertise%20in%20the%20Azure.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EFor%20this%20project%20I%20created%20a%20simple%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Flearn%2Fmodules%2Fpython-flask-build-ai-web-app%2F%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EPython%20and%20Flask%3C%2FA%3E%20interface%20as%20a%20container%20for%20our%20Azure%20experiment.%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorLee%20Stott_0%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2285061538-f7352780-b174-11ea-8001-b0561c5bad73%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F240167iF87AB49D4619BCAB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2285061538-f7352780-b174-11ea-8001-b0561c5bad73%22%20alt%3D%2285061538-f7352780-b174-11ea-8001-b0561c5bad73%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20interface%20interacts%20with%20an%20API%20that%20is%20generated%20through%20the%20Azure%20ML%20Ops%20portal.%20Azure%20uses%20a%20great%20interface%20which%20is%20reminiscent%20of%20SSIS%20in%20its%20simplicity.%20The%20different%20parts%20of%20the%20pipeline%20are%20represented%20visually%2C%20each%20piece%20can%20be%20dragged%20onto%20a%20canvas%20and%20manipulated%20with%20a%20mouse.%20This%20is%20one%20of%20the%20important%20things%20I%20point%20out%20in%20my%20video%2C%20as%20reducing%20the%20technical%20barriers%20to%20data%20science%20can%20help%20us%20focus%20on%20the%20work%20of%20modelling%20and%20domain%20knowledge.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%3CDIV%20class%3D%22video-embed-center%20video-embed%22%3E%3CIFRAME%20class%3D%22embedly-embed%22%20src%3D%22https%3A%2F%2Fcdn.embedly.com%2Fwidgets%2Fmedia.html%3Fsrc%3Dhttps%253A%252F%252Fwww.youtube.com%252Fembed%252Fq3Qx53vLIvM%253Ffeature%253Doembed%26amp%3Bdisplay_name%3DYouTube%26amp%3Burl%3Dhttps%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253Dq3Qx53vLIvM%26amp%3Bimage%3Dhttps%253A%252F%252Fi.ytimg.com%252Fvi%252Fq3Qx53vLIvM%252Fhqdefault.jpg%26amp%3Bkey%3Db0d40caa4f094c68be7c29880b16f56e%26amp%3Btype%3Dtext%252Fhtml%26amp%3Bschema%3Dyoutube%22%20width%3D%22600%22%20height%3D%22337%22%20scrolling%3D%22no%22%20title%3D%22YouTube%20embed%22%20frameborder%3D%220%22%20allow%3D%22autoplay%3B%20fullscreen%22%20allowfullscreen%3D%22true%22%3E%3C%2FIFRAME%3E%3C%2FDIV%3E%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWith%20a%20tool%20like%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmachine-learning%2Fconcept-model-management-and-deployment%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EML%20Ops%3C%2FA%3E%2C%20we%20can%20integrate%20machine%20learning%20into%20enterprise%20level%20applications%20without%20having%20to%20worry%20about%20optimizing%20our%20code.%20We%20can%20focus%20on%20choosing%20the%20right%20model%20for%20the%20job%20and%20ensuring%20the%20data%20is%20clean%2C%20then%20provide%20the%20enterprise%20developers%20with%20an%20API%20to%20work%20with.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEven%20though%20the%20application%20was%20light%20weight%20I%20decided%20to%20use%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-gb%2Fservices%2Fdevops%2F%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Devops%3C%2FA%3E%20for%20source%20control.%20This%20helped%20keep%20all%20the%20changes%20organized%20and%20safe%20in%20the%20cloud.%20Its%20not%20something%20that%20I%20have%20seen%20Data%20Scientists%20do%20a%20lot%2C%20even%20in%20my%20graduate%20program%2C%20all%20the%20code%20is%20usually%20kept%20in%20a%20storage%20space%20or%20a%20local%20drive.%20Developers%20discovered%20a%20long%20time%20that%20source%20control%20is%20vital%20for%20the%20success%20of%20any%20large%20project.%20Even%20if%20you%20are%20working%20with%20a%20single%20page%20R%20Shiny%20application%2C%20I%20would%20recommend%20getting%20comfortable%20with%20GIT%20or%20any%20other%20source%20control%20technology.%20The%20benefits%20will%20be%20in%20the%20pain%20that%20you%20avoided%20in%20the%20future.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOne%20service%20I%20did%20not%20use%20in%20my%20project%20but%20spoke%20about%20in%20my%20presentation%20is%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fdata-factory%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Data%20Factory%3C%2FA%3E.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AzureDataFactory.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F240164i8AE835914E85DA93%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22AzureDataFactory.PNG%22%20alt%3D%22AzureDataFactory.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EWith%20this%20tool%20we%20could%20automate%20our%20data%20pipeline.%20For%20example%2C%20if%20we%20wanted%20to%20deploy%20our%20project%20to%20a%20production%20environment%2C%20we%20would%20need%20a%20way%20to%20update%20our%20data%20regularly.%20We%20could%20use%20ADF%20to%20access%20an%20API%20on%20a%20schedule%20and%20refresh%20our%20data.%20We%20could%20then%20move%20the%20data%20into%20an%20Azure%20Blob%20Storage%20item%20and%20access%20it%20from%20our%20ML%20Ops%20portal.%20Azure%20Data%20Factory%20would%20also%20allow%20us%20to%20trigger%20the%20experiment%20or%20notebook%20that%20we%20created%20to%20update%20our%20model%20results.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAll%20these%20tools%20working%20together%20helped%20me%20build%20something%20very%20resilient%20in%20a%20very%20quick%20span%20of%20time.%20The%20project%20helped%20me%20get%20a%20good%20understanding%20of%20%3CA%20href%3D%22https%3A%2F%2Fwww.hl7.org%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EHL7%3C%2FA%3E%20data%20used%20in%20the%20medical%20industry.%20It%20was%20very%20enlightening%20writing%20python%20scripts%20to%20extract%20data%20from%20the%20documents.%20The%20data%20is%20stored%20in%20documents%20and%20is%20non-relational.%20The%20scripts%20had%20to%20flatten%20the%20data%20so%20we%20could%20correlate%20events%20to%20drugs.%20For%20example%2C%20a%20patient%20goes%20into%20the%20doctor%20for%20a%20check%20up%20and%20gets%20prescribed%20several%20drugs.%20Each%20of%20those%20things%20exist%20as%20different%20items%20on%20the%20patients%E2%80%99%20medical%20record%20so%20they%20must%20be%20tied%20together%20after%20normalizing.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20project%20also%20helped%20me%20understand%20some%20of%20the%20issues%20with%20applying%20classification%20algorithms%20to%20medical%20data%2C%20specifically%20pharmaceuticals.%20Some%20drugs%20cannot%20be%20properly%20classified%20due%20to%20the%20nature%20of%20how%20broad%20they%20are.%20If%20you%20think%20about%20painkillers%2C%20those%20can%20be%20used%20to%20treat%20a%20wide%20range%20of%20symptoms%20and%20illnesses.%20An%20experiment%20to%20tie%20drugs%20to%20illnesses%20in%20a%201%20to%201%20comparison%20would%20have%20very%20low%20accuracy%20scores%20for%20drugs%20like%20these%20but%20would%20work%20very%20well%20with%20specialty%20drugs.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EResources%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMy%20Course%20work%20repo%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fixmedrano%2FMSDS_434%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eixmedrano%2FMSDS_434%3A%20Github%20repo%20for%20MSDS%20434%20final%20project%3C%2FA%3E%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3ENoah%20Gift%2C%20Academic%20at%20Northeastern%20Flask%20ML%20Azure%20Services%20Tutorial%20-%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnoahgift%2Fflask-ml-azure-serverless%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Enoahgift%2Fflask-ml-azure-serverless%3A%20Deploy%20Flask%20Machine%20Learning%20Application%20on%20Azure%20App%20Services%20(github.com)%3C%2FA%3E%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-617058470%22%20id%3D%22toc-hId-617058472%22%3E%26nbsp%3B%3C%2FH1%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1985386%22%20slang%3D%22en-US%22%3E%3CP%3EUsing%20Azure%20and%20cloud%20tools%20working%20together%20helped%20me%20build%20something%20very%20resilient%20in%20a%20very%20quick%20span%20of%20time.%20The%20project%20helped%20me%20get%20a%20good%20understanding%20of%20%3CA%20href%3D%22https%3A%2F%2Fwww.hl7.org%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EHL7%3C%2FA%3E%20data%20used%20in%20the%20medical%20industry.%20It%20was%20very%20enlightening%20writing%20python%20scripts%20to%20extract%20data%20from%20the%20documents.%20The%20data%20is%20stored%20in%20documents%20and%20is%20non-relational.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1985386%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Eazure%20ml%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFlask%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Elearning%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EProject%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Epython%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Estudent%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Etraining%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

Guest Post by Ivan Medrano.

 

IvanM.jpg

 

I am a graduate student at Northwestern University in the Data Science program and a developer with expertise in the Azure.


For this project I created a simple Python and Flask interface as a container for our Azure experiment.

 

85061538-f7352780-b174-11ea-8001-b0561c5bad73

 

The interface interacts with an API that is generated through the Azure ML Ops portal. Azure uses a great interface which is reminiscent of SSIS in its simplicity. The different parts of the pipeline are represented visually, each piece can be dragged onto a canvas and manipulated with a mouse. This is one of the important things I point out in my video, as reducing the technical barriers to data science can help us focus on the work of modelling and domain knowledge.

 

 

With a tool like the ML Ops, we can integrate machine learning into enterprise level applications without having to worry about optimizing our code. We can focus on choosing the right model for the job and ensuring the data is clean, then provide the enterprise developers with an API to work with.

 

Even though the application was light weight I decided to use Azure Devops for source control. This helped keep all the changes organized and safe in the cloud. Its not something that I have seen Data Scientists do a lot, even in my graduate program, all the code is usually kept in a storage space or a local drive. Developers discovered a long time that source control is vital for the success of any large project. Even if you are working with a single page R Shiny application, I would recommend getting comfortable with GIT or any other source control technology. The benefits will be in the pain that you avoided in the future.

 

One service I did not use in my project but spoke about in my presentation is Azure Data Factory.

AzureDataFactory.PNG

With this tool we could automate our data pipeline. For example, if we wanted to deploy our project to a production environment, we would need a way to update our data regularly. We could use ADF to access an API on a schedule and refresh our data. We could then move the data into an Azure Blob Storage item and access it from our ML Ops portal. Azure Data Factory would also allow us to trigger the experiment or notebook that we created to update our model results.

 

All these tools working together helped me build something very resilient in a very quick span of time. The project helped me get a good understanding of HL7 data used in the medical industry. It was very enlightening writing python scripts to extract data from the documents. The data is stored in documents and is non-relational. The scripts had to flatten the data so we could correlate events to drugs. For example, a patient goes into the doctor for a check up and gets prescribed several drugs. Each of those things exist as different items on the patients’ medical record so they must be tied together after normalizing.

 

The project also helped me understand some of the issues with applying classification algorithms to medical data, specifically pharmaceuticals. Some drugs cannot be properly classified due to the nature of how broad they are. If you think about painkillers, those can be used to treat a wide range of symptoms and illnesses. An experiment to tie drugs to illnesses in a 1 to 1 comparison would have very low accuracy scores for drugs like these but would work very well with specialty drugs.

 

Resources 

 

My Course work repo ixmedrano/MSDS_434: Github repo for MSDS 434 final project 

Noah Gift, Academic at Northeastern Flask ML Azure Services Tutorial -noahgift/flask-ml-azure-serverless: Deploy Flask Machine Learning Application on Azure App Services ...