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

Package needs more documentation #14

Open
DilumAluthge opened this issue Jun 11, 2021 · 1 comment
Open

Package needs more documentation #14

DilumAluthge opened this issue Jun 11, 2021 · 1 comment

Comments

@DilumAluthge
Copy link
Member

No description provided.

@DilumAluthge
Copy link
Member Author

DilumAluthge commented Jun 11, 2021

Here's an example I posted on Zulip:


So, you first need to download the RxNorm files. E.g. go to https://www.nlm.nih.gov/research/umls/rxnorm/docs/rxnormfiles.html and click on the RxNorm_full_03012021.zip link. It requires signing up for a free UMLS account.

Then, you download the RxNorm_full_03012021.zip file and extract it. Inside are a bunch of .RRF files.

Then follow the examples here: https://juliahealth.org/PharmaceuticalClassification.jl/dev/examples/

(Changing the paths to RXNREL.RRF and RXNSAT.RRF to point to the location of the files that you downloaded and extracted.)

Here's some example output. The graph takes a few minutes to generate, so we generate it once, and then we save it to file. Then in the future, we load the graph from file, which is faster than having to generate it each time.

julia> using PharmaceuticalClassification

julia> using Serialization

julia> rxnsat = "/Users/dilum/Downloads/rxnorm/rrf/RXNSAT.RRF"
"/Users/dilum/Downloads/rxnorm/rrf/RXNSAT.RRF"

julia> rxnrel = "/Users/dilum/Downloads/rxnorm/rrf/RXNREL.RRF"
"/Users/dilum/Downloads/rxnorm/rrf/RXNREL.RRF"

julia> graph = build_graph(; rxnrel, rxnsat);
Progress: 100%|███████████████████████████████████████████████████| Time: 0:01:46

julia> Serialization.serialize("my_graph_filename.serialized", graph)
julia> using PharmaceuticalClassification

julia> using Serialization

julia> graph = Serialization.deserialize("my_graph_filename.serialized")
PharmGraph{Int64, Float64}({1728093, 4865855} directed Int64 metagraph with Float64 weights defined by :weight (default weight 1.0))

julia> pars = parents(graph, PharmClass("NDC", "0591-2412-19"))
116-element Vector{PharmClass}:
 PharmClass("ATC1", "A")
 PharmClass("ATC2", "A10")
 PharmClass("ATC3", "A10B")
 PharmClass("ATC4", "A10BA")
 PharmClass("ATC5", "A10BA02")
 PharmClass("NDC", "000378600191")
 PharmClass("NDC", "000591272060")
 PharmClass("NDC", "00378-6001-91")
 PharmClass("NDC", "00378600191")
 PharmClass("NDC", "00591-2412-19")
 PharmClass("NDC", "00591-2720-60")
 PharmClass("NDC", "00591241219")
 PharmClass("NDC", "00591272060")
 PharmClass("NDC", "011788003860")
 PharmClass("NDC", "027241018960")
 PharmClass("NDC", "029033003206")
 PharmClass("NDC", "0378-6001-91")
 
 PharmClass("NDC", "68462-521-05")
 PharmClass("NDC", "68462-521-90")
 PharmClass("NDC", "68462052101")
 PharmClass("NDC", "68462052105")
 PharmClass("NDC", "68462052190")
 PharmClass("NDC", "68682-0018-90")
 PharmClass("NDC", "68682-018-90")
 PharmClass("NDC", "68682001890")
 PharmClass("NDC", "70010-497-09")
 PharmClass("NDC", "70010049709")
 PharmClass("NDC", "70247-018-60")
 PharmClass("NDC", "70247001860")
 PharmClass("RXCUI", "1807888")
 PharmClass("RXCUI", "1807894")
 PharmClass("RXCUI", "2391533")
 PharmClass("RXCUI", "6809")
 PharmClass("RXCUI", "860995")

julia> filter(x -> startswith(x.system, "ATC"), pars)
5-element Vector{PharmClass}:
 PharmClass("ATC1", "A")
 PharmClass("ATC2", "A10")
 PharmClass("ATC3", "A10B")
 PharmClass("ATC4", "A10BA")
 PharmClass("ATC5", "A10BA02")

In this example, 0591-2412-19 is a National Drug Code (NDC) for "Metformin Hydrochloride , 90 TABLET, FILM COATED, EXTENDED RELEASE in 1 BOTTLE": https://ndclist.com/ndc/0591-2412/package/0591-2412-19

The commands pars = parents(graph, PharmClass("NDC", "0591-2412-19")) and filter(x -> startswith(x.system, "ATC"), pars) give us the following output:

julia> filter(x -> startswith(x.system, "ATC"), pars)
5-element Vector{PharmClass}:
 PharmClass("ATC1", "A")
 PharmClass("ATC2", "A10")
 PharmClass("ATC3", "A10B")
 PharmClass("ATC4", "A10BA")
 PharmClass("ATC5", "A10BA02")

This shows the Anatomical Therapeutic Chemical (ATC) classes corresponding to our input NDC.

If you go to https://www.whocc.no/atc_ddd_index/ and put in each of those ATC values, you find that:

  1. The level 1 ATC of A is ALIMENTARY TRACT AND METABOLISM
  2. The level 2 ATC of A10 is DRUGS USED IN DIABETES
  3. The level 3 ATC of A10B is BLOOD GLUCOSE LOWERING DRUGS, EXCL. INSULINS
  4. The level 4 ATC of A10BA is Biguanides
  5. The level 5 ATC of A10BA02 is metformin.

So, in other words, PharmaceuticalClassification lets us do the following mappings:

  • From NDC (National Drug Code) to RxCUI (RxNorm Concept Unique Identifier)
  • From NDC to ATC (Anatomic Therapeutic Chemical) class levels 1 through 5
  • From RxCUI to ATC class levels 1 through 5

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