<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Joey LeGrand on Medium]]></title>
        <description><![CDATA[Stories by Joey LeGrand on Medium]]></description>
        <link>https://medium.com/@jrlegrand?source=rss-f4597037d2b6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*HJq4_xlEhnNBpfyP</url>
            <title>Stories by Joey LeGrand on Medium</title>
            <link>https://medium.com/@jrlegrand?source=rss-f4597037d2b6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 22:50:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jrlegrand/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Modernizing pharmacy drug procurement with APIs]]></title>
            <link>https://medium.com/@jrlegrand/modernizing-pharmacy-drug-procurement-with-apis-4b1b42cafd5c?source=rss-f4597037d2b6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b1b42cafd5c</guid>
            <category><![CDATA[supply-chain]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[medication]]></category>
            <category><![CDATA[wholesale]]></category>
            <category><![CDATA[pharmacy]]></category>
            <dc:creator><![CDATA[Joey LeGrand]]></dc:creator>
            <pubDate>Thu, 28 Jan 2021 12:00:00 GMT</pubDate>
            <atom:updated>2021-04-09T14:26:14.875Z</atom:updated>
            <content:encoded><![CDATA[<p>Co-authors: <a href="https://www.linkedin.com/in/kentvbridgeman/">Kent Bridgeman</a> and <a href="https://www.linkedin.com/in/david-berkowitz-1162156/">David Berkowitz</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ix4HXRDPIDZ9HYsY.jpg" /><figcaption><em>Photo by National Cancer Institute</em></figcaption></figure><p>People may assume just because Amazon exists and has made shopping online effortless for consumers, that this has by now spread to all other industries that depend on buying things on a regular basis. In the case of pharmacy drug procurement, this is certainly not the case. One of the reasons that e-commerce websites like Amazon are so fast, up-to-date, and user-friendly is that they use something called an <strong>application programming interface (API)</strong> to provide instantaneous machine to machine communication. It is what allows a phone application to exchange information with Amazon and place an order through various requests.</p><p>APIs are built on a standardized foundation of requests and responses about the state of objects. There’s different kinds of requests you can make to an API, but the most common are <strong>GET and POST requests</strong>. If we use an API example from another industry important to commerce — the shipping industry — applications can make GET requests to check prices on shipping (the response would be a list of prices) and POST requests to purchase shipping labels (the request would actually create an order, and the response would be a confirmation of the order and any details specific to the label). Also, these APIs are made available to third party websites so other businesses can integrate with them — which is why it is so easy to check tracking information regardless of what company is shipping your products or why Amazon can generate your UPS return label if you are sending back a product.</p><p>So what do pharmacies use? Currently, the main way drugs are purchased by pharmacies from wholesalers is through a method called <strong>electronic data interface (EDI)</strong>. If we think of an API like a phone conversation, EDI is more like sending a fax. A key difference is that EDI is a one-way message with typically no automatic response. Another key difference is that while an API request and the object the request is about are bound together, an EDI is just a message with no real association to the objects referred to within the message. In other words, the EDI itself does not know anything about the product you are ordering, but an API would have access to all the available details about that product due to tight integration with the data model.</p><p>What would a world look like if modern API technology was applied to pharmacy drug procurement? We’re glad you asked. We put together some before and after workflow diagrams of what the current process is and how it could be improved with APIs. Long story short, there could be a lot less time spent by a buyer doing manual work interacting with various systems, automatic substitutions for products on drug shortage, and possibly even lower costs.</p><h3>Definitions</h3><ul><li>EDI: electronic data interface</li><li>API: application programming interface</li><li>PO: purchase order — order sent from the pharmacy</li><li>PAR: periodic automatic replenishment levels — minimum quantity of a product needed on hand</li><li>NDC: national drug code — in this case, identifies a specific package of a drug product</li><li>DC: distribution center — location where manufacturer stores drug products before they are shipped to pharmacy</li></ul><h3>Current state workflow with EDI</h3><p>This is a rough estimate of how pharmacy buyers currently go through a normal ordering workflow, and is certainly not meant to represent how every pharmacy handles this. There are many differences in vendors, wholesalers, and internal workflows that could result in variations. In this example, at least one product is unavailable or on drug shortage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/0*66-koaSFYBbHhJ15.jpg" /></figure><ol><li>Inventory system automatically generates a purchase order (PO) based on current on-hand quantity of products with specific national drug codes (NDCs) and defined minimum quantity of product needed on hand (also known as PAR)</li><li>Buyer reviews the automatically generated PO within inventory system and submits to wholesaler system (EDI 850)</li><li>Buyer logs in to wholesaler web portal to verify PO was received and information is accurate</li><li>Buyer places PO to wholesaler</li><li>In the event of a shortage, some NDCs will not be fulfilled by the wholesaler when the order is received and the invoice is available a day or more later</li><li>Buyer logs back into wholesaler web portal to search for therapeutically and operationally (i.e. same volume for mixtures) equivalent NDC with stock at the distribution center (DC) — potentially multiple times throughout the day if all equivalent NDCs are out of stock. Local inventory system typically has built in mapping to know what products would be equivalent; however, these systems aren’t typically interfaced with the wholesaler. Instead of utilizing the separate systems, buyer typically just has to know which products are equivalent and manually search by keyword or NDC to find them on wholesaler website</li><li>Buyer eventually finds equivalent NDC with stock listed as available at DC, and submits second order</li><li>Another day later (or more if the previous steps have to be repeated more than once), when the new NDC finally arrives, the NDC that was originally on shortage still shows up as below minimum quantity in inventory system, which means the following day it will show up again on the automatically generated PO from the inventory system</li><li>Buyer updates preferred NDC in inventory system so that original NDC is not automatically added to generated PO the following day (since it is on shortage)</li></ol><h3>Future state workflow with API</h3><p>Taking the same scenario as above (at least one product is unavailable or on drug shortage), but applying a modern API workflow, we can see how much less interaction is required by a buyer to achieve the same end result in likely much less time overall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/0*cONfuz2M90U2SSVx.jpg" /></figure><ol><li>Inventory system automatically generates a list based on current on-hand quantity of products with specific national drug codes (NDCs) and defined minimum quantity of product needed on hand (also known as PAR)</li><li>Inventory system makes GET request to wholesaler via API, which would return the following information from the manufacturer: 1.) Distribution center (DC) inventory count for each NDC, and 2.) Current pricing information for each NDC</li><li>For any NDC returned with zero (or very low) inventory count, the inventory system would check its own already existing database for all equivalent NDCs, and make another GET request to wholesaler via API for that entire list of equivalent NDCs</li><li>Now the list of NDCs in our order is completely comprised of either: 1.) Preferred NDCs with stock at the DC, 2.) For any NDCs unavailable or on shortage, a list of alternate NDCs with pricing and inventory information for the buyer to review and quickly select, 3.) For any NDCs with no available alternatives, a reliable indicator that the buyer will need to find that product elsewhere</li><li>Based on the response to the initial GET request, the inventory system knows that the original NDC is on shortage and replaces preferred NDC (with a flag for buyer approval)</li><li>Buyer reviews all changes in one sitting and submits order to wholesaler via a POST request on the API, which contains at minimum the NDCs and order quantities</li><li>Buyer receives nearly instantaneous response back from wholesaler via API acknowledging receipt and confirmation of order</li></ol><h3>Future state workflow with multiple APIs</h3><p>Everything would be the same as the API workflow above, but with multiple wholesalers all using an API (ideally the same API based on standards), an inventory system could make requests to multiple wholesalers at the same time and find the least expensive option and / or quickly find substitutions for products unavailable at a main wholesaler.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/0*rZAcerDwXjWS-ZTT.jpg" /></figure><h3>Conclusion</h3><p>The goal of this post is not to point fingers, but to make pharmacy employees start thinking about how their workflows could be more effective by applying technology they are familiar with from other industries. We have shown that APIs have the potential to reduce unnecessary inefficiencies in the pharmacy drug procurement process by modernizing the interfaces between inventory systems and wholesalers. The example we used is relatively simple, and did not even cover how APIs could improve more complex 340B or 503B purchasing workflows.</p><p>Any significant change will require buy-in from both inventory system vendors and wholesalers, but the industry awareness will need to start with pharmacy customers who know there can be a better way and start asking about it. Time saved dealing with these tedious processes can be instead devoted to patient care, and more reliable ordering could mean patients get their medications sooner — especially during times of drug shortage. Now that we have pointed out one area where APIs can add value in this space, what other pharmacy workflows could benefit from this type of real-time machine to machine communication?</p><p><em>Originally published at </em><a href="https://coderx.io/posts/modernizing-pharmacy-drug-procurement-with-apis"><em>https://coderx.io</em></a><em> on January 28, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b1b42cafd5c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sorting RxNorm API results with Python: An arbitrary adventure]]></title>
            <link>https://medium.com/@jrlegrand/sorting-rxnorm-api-results-with-python-an-arbitrary-adventure-4d748ef00e27?source=rss-f4597037d2b6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d748ef00e27</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[rxnorm]]></category>
            <category><![CDATA[vowels]]></category>
            <category><![CDATA[medication]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Joey LeGrand]]></dc:creator>
            <pubDate>Mon, 14 Sep 2020 13:00:00 GMT</pubDate>
            <atom:updated>2021-04-09T13:19:59.014Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/449/0*V7LQ5NoQCYSaCrsT.jpg" /></figure><p>I am sharing this because I jokingly told someone on a pharmacist Slack channel that it would be a good idea for a valuable, worthwhile pharmacy informatics resident project to sort all medications based on number of vowels and they took me seriously. I felt bad because I didn’t want to waste that resident’s time. Obviously there is zero face value in this type of list, but part of me still thought it was kind of a good exercise to get familiar with the RxNorm APIs and some basic Python sorting and CSV exporting functionality. So, as a sort of penance, I wrote the script myself.</p><p>RxNorm has a <a href="https://rxnav.nlm.nih.gov/PrescribableAPIREST.html">“Prescribable” API endpoint</a> that will only return prescribable drugs. Otherwise, you will get all drugs including veterinary medications and OTC medications. For those of you unfamiliar with RxNorm, it also classifies medications based on different levels called <a href="https://www.nlm.nih.gov/research/umls/rxnorm/docs/appendix5.html">“term types” or “TTY”</a>. For the purpose of this arbitrary example, I chose to go with the following:</p><ul><li>IN — ingredient</li><li>MIN — multiple ingredient</li><li>BN — brand name</li></ul><p>As a “tiebreaker” (if two meds have the same number of vowels), I chose to do a secondary sort based on the number of letters in the word (or the length of the “string” in programming lingo). Then, once I sorted the list, I output the list in CSV so I could play around with it. You can open the CSV in Excel and filter out any of the TTYs you don’t care about (i.e. if you only care about brand name drugs).</p><p>Here’s a link to the CSV: <a href="https://coderx.io/assets/data/vowels.csv">vowels.csv</a></p><p>In case you’re wondering, the top meds in each category are:</p><ul><li>IN with 46 vowels and 147 letters (RXCUI = 2392632) — sodium 2-acrylamido-2-methyl-1-propane sulfonate/sodium acrylate/n-isopropylacrylamide/trimethyl(3-methacrylamidopropyl)ammonium chloride copolymer</li><li>MIN with 509 vowels and 1543 letters (RXCUI = 1008785) — Streptococcus pneumoniae type 1 capsular polysaccharide antigen / Streptococcus pneumoniae type 10A capsular polysaccharide antigen / Streptococcus pneumoniae type 11A capsular polysaccharide antigen / Streptococcus pneumoniae type 12F capsular polysaccharide antigen / Streptococcus pneumoniae type 14 capsular polysaccharide antigen / Streptococcus pneumoniae type 15B capsular polysaccharide antigen / Streptococcus pneumoniae type 17F capsular polysaccharide antigen / Streptococcus pneumoniae type 18C capsular polysaccharide antigen / Streptococcus pneumoniae type 19A capsular polysaccharide antigen / Streptococcus pneumoniae type 19F capsular polysaccharide antigen / Streptococcus pneumoniae type 2 capsular polysaccharide antigen / Streptococcus pneumoniae type 20 capsular polysaccharide antigen / Streptococcus pneumoniae type 22F capsular polysaccharide antigen / Streptococcus pneumoniae type 23F capsular polysaccharide antigen / Streptococcus pneumoniae type 3 capsular polysaccharide antigen / Streptococcus pneumoniae type 33F capsular polysaccharide antigen / Streptococcus pneumoniae type 4 capsular polysaccharide antigen / Streptococcus pneumoniae type 5 capsular polysaccharide antigen / Streptococcus pneumoniae type 6B capsular polysaccharide antigen / Streptococcus pneumoniae type 7F capsular polysaccharide antigen / Streptococcus pneumoniae type 8 capsular polysaccharide antigen / Streptococcus pneumoniae type 9N capsular polysaccharide antigen / Streptococcus pneumoniae type 9V capsular polysaccharide antigen</li><li>BN with 17 vowels and 49 letters (RXCUI = 1438498) — Preparation H Suppositories Reformulated Oct 2013</li></ul><p>And here is the (heavily commented) script:</p><pre># import the requests library <br>import requests <br># import the csv library<br>import csv<br><br># define vowels<br>vowels=&#39;aeiou&#39;<br><br># function to count vowels in a string<br>def count_vowels(string):<br>    count = 0<br>    # for every character in the string<br>    for s in string.lower():<br>        # if that character is a vowel (as defined above)<br>        if s in vowels:<br>            # increase the count by one<br>            count = count + 1<br>    # return the total count<br>    return count<br><br># API endpoint<br># NOTE: RxNorm has a &quot;Prescribable&quot; API endpoint for prescribable drugs only<br>URL = &#39;https://rxnav.nlm.nih.gov/REST/Prescribe/allconcepts.json?tty=IN+MIN+BN&#39;<br><br># send GET request and save the response as response object <br>response = requests.get(url = URL) <br><br># extract data in json format <br>data = response.json()<br><br># get just the medication list of the data<br>meds = data[&#39;minConceptGroup&#39;][&#39;minConcept&#39;]<br><br># for each med, count the number of vowels and number of characters<br># add that info to each med object<br>for med in meds:<br>    med[&#39;vowel_count&#39;] = count_vowels(med[&#39;name&#39;])<br>    med[&#39;length&#39;] = len(med[&#39;name&#39;])<br><br># sort the medication list based on number of vowels (highest to lowest)<br># secondary sort based on number of characters (highest to lowest)<br>sorted_meds = sorted(meds, key = lambda x: (x[&#39;vowel_count&#39;], x[&#39;length&#39;]), reverse = True)<br><br># print out the first 10 meds as a spot check<br>print(sorted_meds[:10])<br><br># create a csv file called &#39;vowels.csv&#39;<br>with open(&#39;vowels.csv&#39;, &#39;w&#39;, newline=&#39;&#39;) as csvfile:<br>    # define the column headers<br>    fieldnames = [&#39;vowel_count&#39;, &#39;length&#39;, &#39;tty&#39;, &#39;name&#39;, &#39;rxcui&#39;]<br>    writer = csv.DictWriter(csvfile, fieldnames=fieldnames)<br>    # write the column headers to the csv file<br>    writer.writeheader()<br><br>    # write a row to the csv file for each med in sorted_meds<br>    for med in sorted_meds:<br>        writer.writerow(med)</pre><p><em>Originally published at </em><a href="https://coderx.io/posts/sorting-rxnorm-api-results-with-python-an-arbitrary-adventure"><em>https://coderx.io</em></a><em> on September 14, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d748ef00e27" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Work smarter not harder: Extracting 40,000 DailyMed labels]]></title>
            <link>https://medium.com/@jrlegrand/work-smarter-not-harder-extracting-40-000-dailymed-labels-6184e16daf28?source=rss-f4597037d2b6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6184e16daf28</guid>
            <category><![CDATA[medication]]></category>
            <category><![CDATA[dailymed]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[fda]]></category>
            <dc:creator><![CDATA[Joey LeGrand]]></dc:creator>
            <pubDate>Sat, 12 Sep 2020 13:30:00 GMT</pubDate>
            <atom:updated>2021-04-09T14:18:25.251Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Post inspired by CodeRx contributing member </em><a href="https://github.com/yevgenybulochnik"><em>Yevgeny Bulochnik</em></a><em> and his work on </em><a href="https://github.com/coderxio/dailymed-api/blob/master/extract_zips.py"><em>extract_zips.py</em></a><em>.</em></p><p>This post is specific to work <a href="https://github.com/coderxio/dailymed-api/graphs/contributors">members of the CodeRx team</a> are doing on the <a href="https://github.com/coderxio/dailymed-api">DailyMed API project</a>, but the fundamental concepts apply to a lot of things in any “knowledge worker” job, and certainly in many areas of healthcare as well. The specific issue we were facing is that <a href="https://dailymed.nlm.nih.gov/dailymed/spl-resources-all-drug-labels.cfm">DailyMed offers a full download of all its structured product labels (SPLs)</a>, but they are provided as four separate zip files which each have thousands of other zip files in them, which each have label images in addition to the label XML data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/0*lHWCaaUWkX6LoF29.jpg" /></figure><p>We need to unizp the main four files, and then unzip only the XML file (not the image files) from the 40,000 other zip files inside of them. The manual option for this work is horrible. Best case scenario: you could unzip the four files in your operating system of choice, then (at least with Windows 10) highlight all 40,000 files and right-click-drag them into a new folder and select to extract them there. You would have to click through 40,000 pop-up windows asking if you want to extract each file, and then you would still have to go into each unzipped folder to pull out the XML file. Certainly someone more adept at unzipping files this way could probably point out a more efficient way, but this is still “click heavy” and anyone who works in healthcare IT knows that clicks are the enemy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/0*9OBZIoZoek0swHAs.jpg" /></figure><p>Additionally, we need to do this every month because DailyMed publishes full releases with new and updated label information at least monthly. So anything we decide to do is going to be perpetuated at least 12 times per year. If there is manual work involved, you will need to train someone on the steps and make sure they do it the same way every time. Confronted with a problem like this, my instinct is to do more work up front to reduce maintenance and repetitive human actions down the line. This is where having a toolbox of skills related to automation and efficiency is very valuable. One of these tools is a programming language called Python. With fewer than 15 lines of code, I can do the same work above faster, more efficiently, and with zero clicks. Don’t believe me? Keep reading.</p><p>This isn’t a programming lesson, and if you’ve never seen Python code before, this will look scary. But I’ll explain it at a basic level so it makes a little more sense.</p><pre>from io import BytesIO<br>import zipfile<br>from pathlib import Path<br><br>current_file_directory = Path(__file__).parent.absolute()<br>zip_file_directory = current_file_directory / &#39;zip&#39;<br>xml_file_directory = zip_file_directory / &#39;xml&#39;<br><br>main_zip_file = list(zip_file_directory.glob(&#39;*.zip&#39;))[0]<br><br>with zipfile.ZipFile(main_zip_file) as zip_main:<br>    for spl_zip_files in zip_main.namelist():<br>        spl_zip_data = BytesIO(zip_ref.read(spl_zip_files))<br>        with zipfile.ZipFile(spl_zip_data) as zip_spl:<br>            for unzip_file in zip_spl.namelist():<br>                if unzip_file.endswith(&#39;xml&#39;):<br>                    zip_spl.extract(unzip_file, xml_file_directory)</pre><p>The first thing to know about Python is that a ton of people way smarter than I’ll ever be have done most of the heavy lifting in terms of building modules that you can just import into your scripts to do the hard work for things like unzipping files. The first few lines just import those modules into the script.</p><pre>from io import BytesIO<br>import zipfile<br>from pathlib import Path</pre><p>The next few lines just tell the script the file structure you are expecting and where to look for one of the four main zip files you downloaded from DailyMed. For simplicity, we are only working on one zip file, but you could loop through all four files just as easily.</p><pre>current_file_directory = Path(__file__).parent.absolute()<br>zip_file_directory = current_file_directory / &#39;zip&#39;<br>xml_file_directory = zip_file_directory / &#39;xml&#39;<br><br>main_zip_file = list(zip_file_directory.glob(&#39;*.zip&#39;))[0]</pre><p>Now for the fun part. You don’t need to know the specifics of what the code below does, but just think conceptually about how a script would loop through the files in the file structure image above.</p><pre>with zipfile.ZipFile(main_zip_file) as zip_main:<br>    for spl_zip_files in zip_main.namelist():<br>        spl_zip_data = BytesIO(zip_ref.read(spl_zip_files))<br>        with zipfile.ZipFile(spl_zip_data) as zip_spl:<br>            for unzip_file in zip_spl.namelist():<br>                if unzip_file.endswith(&#39;xml&#39;):<br>                    zip_spl.extract(unzip_file, xml_file_directory)</pre><p>We need to start with the main zip file.</p><pre>with zipfile.ZipFile(main_zip_file) as zip_main:<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/0*CrJHa-NYHgr12dQu.jpg" /></figure><p>Then, we need to get a list of all the zip files within the main zip file.</p><pre>...<br>    for spl_zip_files in zip_main.namelist():<br>        spl_zip_data = BytesIO(zip_ref.read(spl_zip_files))<br>        with zipfile.ZipFile(spl_zip_data) as zip_spl:<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/0*e9S1g3AbXPTH695X.jpg" /></figure><p>And finally, we need to look at all the files within each of those zip files and only unzip the files that end with “.xml” which would be the XML files we are looking for.</p><pre>...<br>            for unzip_file in zip_spl.namelist():<br>                if unzip_file.endswith(&#39;xml&#39;):<br>                    zip_spl.extract(unzip_file, xml_file_directory)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/0*c77oDUV6m7jXFtZk.jpg" /></figure><p>This script takes only a minute or two to run (even on my ancient pharmacy school issued laptop from 2006 that I use as a development server) and outputs a folder with all the XML files we need to work with for each zip file in the DailyMed full release. All with zero clicks.</p><p><em>Originally published at </em><a href="https://coderx.io/posts/work-smarter-not-harder-extracting-40000-dailymed-labels"><em>https://coderx.io</em></a><em> on September 12, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6184e16daf28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why build a DailyMed API?]]></title>
            <link>https://medium.com/@jrlegrand/why-build-a-dailymed-api-624a204b825f?source=rss-f4597037d2b6------2</link>
            <guid isPermaLink="false">https://medium.com/p/624a204b825f</guid>
            <category><![CDATA[medication]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[fda]]></category>
            <category><![CDATA[pharmacy]]></category>
            <category><![CDATA[dailymed]]></category>
            <dc:creator><![CDATA[Joey LeGrand]]></dc:creator>
            <pubDate>Fri, 04 Sep 2020 13:30:00 GMT</pubDate>
            <atom:updated>2021-04-09T14:17:39.858Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re reading this, you probably know what DailyMed is… but just in case you don’t, I’ll give a brief intro. <a href="https://dailymed.nlm.nih.gov/dailymed/">DailyMed</a> is the official provider of FDA label information — package inserts or stuctured product labels (SPLs). The website provides a “standard, comprehensive, up-to-date, look-up and download resource of medication content and labeling found in medication package inserts” which is honestly very easy to use and quite useful as a clinician or as anyone who uses medication labeling information.</p><p>What you might not know is that DailyMed also provides an <a href="https://en.wikipedia.org/wiki/API">application programming interface (API)</a> so that web applications can digest and understand the same label information. For instance, if I take a label for a random medication called Revlimid and wanted to know the packaging information for each national drug code (NDC), I could go to <a href="https://dailymed.nlm.nih.gov/dailymed/services/v2/spls/5fa97bf5-28a2-48f1-8955-f56012d296be/packaging.json">the packaging API endpoint</a>. This isn’t intended to be read by humans (though it is fairly straightforward), but it is super easy for a computer to understand this standard format (called <a href="https://en.wikipedia.org/wiki/JSON">JSON</a>) and use it in a web application. Packaging information is one of the several <a href="https://dailymed.nlm.nih.gov/dailymed/app-support-web-services.cfm">DailyMed web services</a> provided by the site.</p><pre>data: {<br>  spl_version: 34,<br>  products: [<br>    {<br>      packaging: [<br>        {<br>          ndc: &quot;59572-402-00&quot;,<br>          package_descriptions: [<br>            &quot;100  in 1 BOTTLE&quot;<br>          ],<br>        },<br>        {<br>          ndc: &quot;59572-402-28&quot;,<br>          package_descriptions: [<br>            &quot;28  in 1 BOTTLE&quot;<br>          ],<br>        },<br>      ],<br>      active_ingredients: [<br>        {<br>          strength: &quot;2.5 mg&quot;,<br>          name: &quot;LENALIDOMIDE&quot;,<br>        }<br>      ],<br>      product_name_generic: &quot;Lenalidomide&quot;,<br>      product_name: &quot;Revlimid&quot;,<br>      product_code: &quot;59572-402&quot;,<br>    },<br>    ...<br>  ...</pre><p>Great — so DailyMed is awesome and already has an API. So are we done here?</p><p>Not quite. You may notice, for instance that the API above provides active_ingredients but does not provide inactive_ingredients. However, <a href="https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=5fa97bf5-28a2-48f1-8955-f56012d296be">DailyMed&#39;s website</a> clearly contains this information. This may be good enough for us humans... but computers need this to look more like the format above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/0*X8ezKTVSzdGtRZom.png" /></figure><p>One thing I haven’t mentioned is that DailyMed also provides the ability to download every single product label in <a href="https://en.wikipedia.org/wiki/XML">XML</a>. If we were to download the specific XML file for this specific Revlimid label on the <a href="https://dailymed.nlm.nih.gov/dailymed/spl-resources-all-drug-labels.cfm">DailyMed drug label download page</a>, and then find the specific section within the 9530 lines of XML that contains inactive ingredient information, it would look like the code below. You may notice some similarities between the picture of the table on the website and the structure of the XML — look for the inactive ingredient names in both.</p><pre>...<br>&lt;manufacturedProduct&gt;<br>&lt;code code=&quot;59572-402&quot; codeSystem=&quot;2.16.840.1.113883.6.69&quot;/&gt;<br>&lt;name&gt;Revlimid&lt;/name&gt;<br>&lt;formCode code=&quot;C25158&quot; codeSystem=&quot;2.16.840.1.113883.3.26.1.1&quot; displayName=&quot;CAPSULE&quot;/&gt;<br>&lt;asEntityWithGeneric&gt;<br>    &lt;genericMedicine&gt;<br>        &lt;name&gt;Lenalidomide&lt;/name&gt;<br>    &lt;/genericMedicine&gt;<br>&lt;/asEntityWithGeneric&gt;<br>&lt;ingredient classCode=&quot;ACTIB&quot;&gt;<br>    &lt;quantity&gt;<br>        &lt;numerator value=&quot;2.5&quot; unit=&quot;mg&quot;/&gt;<br>        &lt;denominator value=&quot;1&quot; unit=&quot;1&quot;/&gt;<br>    &lt;/quantity&gt;<br>    &lt;ingredientSubstance&gt;<br>        &lt;code code=&quot;F0P408N6V4&quot; codeSystem=&quot;2.16.840.1.113883.4.9&quot;/&gt;<br>        &lt;name&gt;LENALIDOMIDE&lt;/name&gt;<br>        &lt;activeMoiety&gt;<br>            &lt;activeMoiety&gt;<br>            &lt;code code=&quot;F0P408N6V4&quot; codeSystem=&quot;2.16.840.1.113883.4.9&quot;/&gt;<br>            &lt;name&gt;LENALIDOMIDE&lt;/name&gt;<br>            &lt;/activeMoiety&gt;<br>        &lt;/activeMoiety&gt;<br>    &lt;/ingredientSubstance&gt;<br>&lt;/ingredient&gt;<br>&lt;ingredient classCode=&quot;IACT&quot;&gt;<br>    &lt;ingredientSubstance&gt;<br>        &lt;code code=&quot;3SY5LH9PMK&quot; codeSystem=&quot;2.16.840.1.113883.4.9&quot;/&gt;<br>        &lt;name&gt;ANHYDROUS LACTOSE&lt;/name&gt;<br>    &lt;/ingredientSubstance&gt;<br>&lt;/ingredient&gt;<br>&lt;ingredient classCode=&quot;IACT&quot;&gt;<br>    &lt;ingredientSubstance&gt;<br>        &lt;code code=&quot;OP1R32D61U&quot; codeSystem=&quot;2.16.840.1.113883.4.9&quot;/&gt;<br>        &lt;name&gt;MICROCRYSTALLINE CELLULOSE&lt;/name&gt;<br>    &lt;/ingredientSubstance&gt;<br>&lt;/ingredient&gt;<br>&lt;ingredient classCode=&quot;IACT&quot;&gt;<br>    &lt;ingredientSubstance&gt;<br>        &lt;code code=&quot;M28OL1HH48&quot; codeSystem=&quot;2.16.840.1.113883.4.9&quot;/&gt;<br>        &lt;name&gt;CROSCARMELLOSE SODIUM&lt;/name&gt;<br>    &lt;/ingredientSubstance&gt;<br>&lt;/ingredient&gt;<br>&lt;ingredient classCode=&quot;IACT&quot;&gt;<br>    &lt;ingredientSubstance&gt;<br>        &lt;code code=&quot;70097M6I30&quot; codeSystem=&quot;2.16.840.1.113883.4.9&quot;/&gt;<br>        &lt;name&gt;MAGNESIUM STEARATE&lt;/name&gt;<br>    &lt;/ingredientSubstance&gt;<br>&lt;/ingredient&gt;<br>...</pre><p>So we now know that the information on a given human-readable DailyMed label website is also stored in a somewhat structured format in computer-readable XML that is also provided on a regular basis by DailyMed. This is probably good enough for a lot of people that know about this XML and slog through it to find what they need for research or other purposes. But the file we downloaded to get the code above might change next month… or a new medication label could be uploaded to DailyMed tomorrow and what if we need inactive ingredient information from that?</p><p>What if we wanted to make the inactive ingredient information as easy to access as following a web link to some JSON like we can do for active ingredients? We could certainly ask DailyMed to do this… or we could do it ourselves! Inactive ingredient information is just one example of the type of data that is readily available in a product label, but (at least to my knowledge) not easy to find in an up-to-date, structured format elsewhere. There are certainly other things in a DailyMed medication label that healthcare professionals could benefit from if they were made available in a structured way to a web application. We plan on starting with inactive ingredients as a proof of concept and then going after other things. What medication product label information would you want to be available via an API?</p><p><em>Originally published at </em><a href="https://coderx.io/posts/why-build-a-dailymed-api"><em>https://coderx.io</em></a><em> on September 4, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=624a204b825f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>