Produced by Araxis Merge on 3/8/2018 10:11:37 AM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | PRE_PPS-N_v3.0.1.zip\PS_PPS_domain\src\main\java\gov\va\med\pharmacy\peps\domain\common\utility\client\rxnorm | RxNormClient.java | Fri Jan 12 15:42:38 2018 UTC |
2 | PRE_PPS-N_v3.0.1.zip\PS_PPS_domain\src\main\java\gov\va\med\pharmacy\peps\domain\common\utility\client\rxnorm | RxNormClient.java | Wed Mar 7 01:46:31 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 4 | 442 |
Changed | 3 | 8 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | package go v.va.med.p harmacy.pe ps.domain. common.uti lity.clien t.rxnorm; | |
2 | ||
3 | import jav a.util.Arr ayList; | |
4 | import jav a.util.Col lections; | |
5 | import jav a.util.Com parator; | |
6 | import jav a.util.Has hMap; | |
7 | import jav a.util.Lis t; | |
8 | import jav a.util.Map ; | |
9 | import jav a.util.UUI D; | |
10 | ||
11 | import org .springfra mework.htt p.client.H ttpCompone ntsClientH ttpRequest Factory; | |
12 | import org .springfra mework.web .client.Re stTemplate ; | |
13 | ||
14 | import gov .va.med.ph armacy.pep s.common.u tility.Con figFileUti lity; | |
15 | import gov .vha.isaac .rest.api1 .data.sear ch.RestSea rchResultP age; | |
16 | import gov .vha.isaac .rest.api1 .data.seme me.RestDyn amicSememe Version; | |
17 | import gov .vha.isaac .rest.api1 .data.seme me.RestSem emeDescrip tionVersio n; | |
18 | ||
19 | /** | |
20 | * This cl ass handle s the proc ess of kee ping RxNor m data up to date on the EPL_P RODUCTS ta ble. It us es two web service c alls to | |
21 | * ISAAC a nd the pro duct DAO t o populate the data into the a ppropriate columns. | |
22 | * | |
23 | * @author DN S D N S
|
|
24 | * | |
25 | */ | |
26 | public cla ss RxNormC lient { | |
27 | ||
28 | privat e static f inal UUID SUPPRESS_U UID = UUID .fromStrin g("3e51fab 1-34ec-534 6-af99-c62 baec1f675" ); | |
29 | privat e static f inal UUID NOT_SUPPRE SIBBLE_UUI D = UUID.f romString( "8277b5c7- 5720-5eea- b802-8ad3f 28c9bf7"); | |
30 | ||
31 | privat e static f inal UUID SAB_UUID = UUID.from String("bc c300c0-034 7-5c11-80c b-9fb7497e 44de"); | |
32 | privat e static f inal UUID RXNORM_UUI D = UUID.f romString( "d9e4f663- 497a-5da7- 8b4c-2846b 86c6971"); | |
33 | ||
34 | privat e static f inal UUID SCD_UUID = UUID.from String("76 de667d-54c a-55a4-ba7 2-21a7e257 c928"); | |
35 | privat e static f inal UUID PSN_UUID = UUID.from String("6e cd2b47-d1e e-571a-b21 c-7abda21c 9207"); | |
36 | privat e static f inal UUID SBD_UUID = UUID.from String("9b e227c1-c7e 2-582f-b39 1-13ae1ffb 3e7c"); | |
37 | privat e static f inal UUID BPACK_UUID = UUID.fr omString(" 02507be6-9 971-5c05-9 01a-cfcda4 eb0eb5"); | |
38 | privat e static f inal UUID GPACK_UUID = UUID.fr omString(" 4bbeba6f-d 765-54e0-9 c58-6fe0f7 4d73e2"); | |
39 | ||
40 | privat e static f inal Strin g NOT_SUPP RESSIBLE_S TRING = "N ot Suppres sible"; | |
41 | privat e static f inal int S CD_RANK = 5; | |
42 | privat e static f inal int P SN_RANK = 4; | |
43 | privat e static f inal int S BD_RANK = 3; | |
44 | privat e static f inal int G PACK_RANK = 2; | |
45 | privat e static f inal int B PACK_RANK = 1; | |
46 | ||
47 | privat e static f inal Strin g VUID_PAR AM = "VUID "; | |
48 | privat e static f inal Strin g UUID_PAR AM = "UUID "; | |
49 | ||
50 | privat e static f inal org.a pache.logg ing.log4j. Logger LOG = org.apa che.loggin g.log4j.Lo gManager.g etLogger( | |
51 | Rx NormClient .class); | |
52 | ||
53 | /** | |
54 | * Cal ls the ISA AC web ser vice passi ng a produ ct VUID an d returnin g the Code System Co de if the web servic e contains one for | |
55 | * the given VUI D. Returns null if n o code exi sts for th e VUID. | |
56 | * | |
57 | * @pa ram vuid S tring prop erty | |
58 | * @pa ram config File the c onfig file utility | |
59 | * @re turn Strin g | |
60 | */ | |
61 | public String ge tCode(Stri ng vuid, C onfigFileU tility con figFile) { | |
62 | LO G.debug("G etting cod e for VUID {}.", vui d); | |
63 | if (vuid != null) { | |
64 | Map<Stri ng, String > params = new HashM ap<String, String>() ; | |
65 | params.p ut(VUID_PA RAM, vuid) ; | |
66 | RestTemp late restT emplate = new RestTe mplate(); | |
67 | restTemp late.setRe questFacto ry(new Htt pComponent sClientHtt pRequestFa ctory()); | |
68 | ||
69 | RestSear chResultPa ge restSea rchResultP age = rest Template.g etForObjec t(configFi le.getIsaa cCodingCon ceptURL(), | |
70 | Rest SearchResu ltPage.cla ss, params ); | |
71 | ||
72 | if (rest SearchResu ltPage != null && re stSearchRe sultPage.g etResults( ) != null | |
73 | && r estSearchR esultPage. getResults ().length > 0 | |
74 | && r estSearchR esultPage. getResults ()[0].getR eferencedC oncept() ! = null) { | |
75 | ||
76 | UUID uuid = re stSearchRe sultPage.g etResults( )[0].getRe ferencedCo ncept().ge tIdentifie rs().getUu ids().get( 0); | |
77 | LOG. debug("ISA AC UUID is {}.", uui d); | |
78 | para ms.clear() ; | |
79 | para ms.put(UUI D_PARAM, S tring.valu eOf(uuid.t oString()) ); | |
80 | ||
81 | Rest DynamicSem emeVersion restDynam icSememeVe rsion[] = restTempla te | |
82 | .getForObj ect(config File.getIs aacCodingC omponentUR L(), RestD ynamicSeme meVersion[ ].class, p arams); | |
83 | ||
84 | if ( restDynami cSememeVer sion != nu ll && rest DynamicSem emeVersion .length > 0 | |
85 | && restDyn amicSememe Version[0] .getDataCo lumns() != null | |
86 | && !restDy namicSemem eVersion[0 ].getDataC olumns().i sEmpty()) { | |
87 | String obj ect = (Str ing) restD ynamicSeme meVersion[ 0].getData Columns(). get(0).get Data().toS tring(); | |
88 | return obj ect; | |
89 | } | |
90 | } | |
91 | } | |
92 | re turn null; | |
93 | } | |
94 | ||
95 | /** | |
96 | * Cal ls the ISA AC web ser vice passi ng a produ ct VUID an d returnin g the rela ted RXNorm informati on if the web servic e | |
97 | * con tains one for the gi ven VUID. Returns nu ll if no r ecord for that produ ct exists or the pie ces of dat a that it actually | |
98 | * fin ds. | |
99 | * | |
100 | * @pa ram vuid S tring prop erty | |
101 | * @pa ram config File the c onfig file utility | |
102 | * @re turn Strin g | |
103 | */ | |
104 | public RxN
|
|
105 | RxN
|
|
106 | if (vuid != null) { | |
107 | Map<Stri ng, String > params = new HashM ap<String, String>() ; | |
108 | params.p ut(VUID_PA RAM, vuid) ; | |
109 | RestTemp late restT emplate = new RestTe mplate(); | |
110 | restTemp late.setRe questFacto ry(new Htt pComponent sClientHtt pRequestFa ctory()); | |
111 | ||
112 | RestSear chResultPa ge restSea rchResultP age = rest Template.g etForObjec t(configFi le.getIsaa cCodingCon ceptURL(), | |
113 | Rest SearchResu ltPage.cla ss, params ); | |
114 | ||
115 | // Get t he product name. | |
116 | if (rest SearchResu ltPage != null && re stSearchRe sultPage.g etResults( ) != null | |
117 | && r estSearchR esultPage. getResults ().length > 0 | |
118 | && r estSearchR esultPage. getResults ()[0].getR eferencedC oncept() ! = null) { | |
119 | ||
120 | result = n ew RxN
|
|
121 | resu lt.setProd uctName(re stSearchRe sultPage.g etResults( )[0].getRe ferencedCo ncept().ge tDescripti on()); | |
122 | ||
123 | UUID uuid = re stSearchRe sultPage.g etResults( )[0].getRe ferencedCo ncept().ge tIdentifie rs().getUu ids().get( 0); | |
124 | para ms.clear() ; | |
125 | para ms.put(UUI D_PARAM, S tring.valu eOf(uuid.t oString()) ); | |
126 | ||
127 | // G et the des criptions to obtain the TTY in formation. | |
128 | Rest SememeDesc riptionVer sion[] des criptions = restTemp late | |
129 | .getForObj ect(config File.getIs aacCodingD escription sURL(), Re stSememeDe scriptionV ersion[].c lass, para ms); | |
130 | ||
131 | List <RestSemem eDescripti onVersion> potential Descriptio ns = getPo tentialDes cription(d escription s); | |
132 | ||
133 | if ( !potential Descriptio ns.isEmpty ()) { | |
134 | Collection s.sort(pot entialDesc riptions, new Descri ptionSorte r()); | |
135 | result.set Suppress(N OT_SUPPRES SIBLE_STRI NG); | |
136 | result.set Tty(typeTo String(pot entialDesc riptions.g et(0).getD escription ExtendedTy peConcept( ).getUuids ())); | |
137 | } | |
138 | ||
139 | } | |
140 | } | |
141 | ||
142 | if (result = = null){ | |
143 | LOG.debu g("No RXNo rm Data Fo und."); | |
144 | } | |
145 | ||
146 | re turn resul t; | |
147 | } | |
148 | ||
149 | /** | |
150 | * Get the poten tial descr iptions wh ere we can find the TTY inform ation in t he calling method. | |
151 | * @pa ram descri ptionVersi ons | |
152 | * @re turn | |
153 | */ | |
154 | privat e List<Res tSememeDes criptionVe rsion> get PotentialD escription (RestSemem eDescripti onVersion[ ] descript ionVersion s) { | |
155 | Ar rayList<Re stSememeDe scriptionV ersion> po tentialDes criptionVe rsions = n ew ArrayLi st<>(); | |
156 | fo r (RestSem emeDescrip tionVersio n d : desc riptionVer sions) { | |
157 | boolean sabIsRxNor m = false; | |
158 | boolean suppressIs N = false; | |
159 | for (Res tDynamicSe memeVersio n ns : d.g etNestedSe memes()) { | |
160 | if ( ns.getSeme meChronolo gy().getAs semblage() .getUuids( ).contains (SUPPRESS_ UUID) | |
161 | && ns.getD ataColumns ().get(0). getData(). toString() .equals(NO T_SUPPRESI BBLE_UUID. toString() )) { | |
162 | suppressIs N = true; | |
163 | } | |
164 | if ( ns.getSeme meChronolo gy().getAs semblage() .getUuids( ).contains (SAB_UUID) | |
165 | && ns.getD ataColumns ().get(0). getData(). toString() .equals(RX NORM_UUID. toString() )) { | |
166 | sabIsRxNor m = true; | |
167 | } | |
168 | if ( suppressIs N && sabIs RxNorm) { | |
169 | potentialD escription Versions.a dd(d); | |
170 | break; | |
171 | } | |
172 | } | |
173 | } | |
174 | re turn poten tialDescri ptionVersi ons; | |
175 | } | |
176 | ||
177 | privat e static S tring type ToString(L ist<UUID> uuids) { | |
178 | if (uuids.co ntains(SCD _UUID)) { | |
179 | return " SCD"; | |
180 | } | |
181 | if (uuids.co ntains(PSN _UUID)) { | |
182 | return " PSN"; | |
183 | } | |
184 | if (uuids.co ntains(SBD _UUID)) { | |
185 | return " SBD"; | |
186 | } | |
187 | if (uuids.co ntains(GPA CK_UUID)) { | |
188 | return " GPACK"; | |
189 | } | |
190 | if (uuids.co ntains(BPA CK_UUID)) { | |
191 | return " BPACK"; | |
192 | } | |
193 | re turn null; | |
194 | } | |
195 | ||
196 | privat e class De scriptionS orter impl ements Com parator<Re stSememeDe scriptionV ersion> { | |
197 | ||
198 | // Ranking: SCD > PSN > SBD > GP ACK > BPAC K | |
199 | pr ivate int getRank(Re stSememeDe scriptionV ersion d) { | |
200 | if (d.ge tDescripti onExtended TypeConcep t().getUui ds().conta ins(RxNorm Client.SCD _UUID)) { | |
201 | retu rn SCD_RAN K; | |
202 | } | |
203 | if (d.ge tDescripti onExtended TypeConcep t().getUui ds().conta ins(RxNorm Client.PSN _UUID)) { | |
204 | retu rn PSN_RAN K; | |
205 | } | |
206 | ||
207 | if (d.ge tDescripti onExtended TypeConcep t().getUui ds().conta ins(RxNorm Client.SBD _UUID)) { | |
208 | retu rn SBD_RAN K; | |
209 | } | |
210 | if (d.ge tDescripti onExtended TypeConcep t().getUui ds().conta ins(RxNorm Client.GPA CK_UUID)) { | |
211 | retu rn GPACK_R ANK; | |
212 | } | |
213 | if (d.ge tDescripti onExtended TypeConcep t().getUui ds().conta ins(RxNorm Client.BPA CK_UUID)) { | |
214 | retu rn BPACK_R ANK; | |
215 | } | |
216 | return 0 ; | |
217 | } | |
218 | ||
219 | @O verride | |
220 | pu blic int c ompare(Res tSememeDes criptionVe rsion d1, RestSememe Descriptio nVersion d 2) { | |
221 | return g etRank(d2) - getRank (d1); | |
222 | } | |
223 | ||
224 | } | |
225 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.