About : standard furniture java end table
Title : standard furniture java end table
standard furniture java end table
speaker: all right. thank you all very much.it's been exciting for me to be here at pycon. i'm a south carolina native so we came a littleway to get here. and so i want to talk to you today about some of the work we've beendoing at pokitdok to help both move faster and help facilitate more change more quicklyby using python and also running that faster by using pypy to execute that python code.so if we flip to the slides here, i kind of did a quick outline. if we were to do thistalk in python, we might have a few function calls or method calls here that would discussa little bit about health care for those that aren't familiar with that. we'll talk about some of these standard transactionsthat are exchanged as part of conducting a
healthcare transaction. and then we'll alsotalk about some of the things that we're doing to build things quickly in python and runningit fast with pypy. and i did a version of this talk and then i kind of went back throughit and i realized that without an appropriate context manager, some of the things may notmake sense. so we'll spend a few moments at the beginning applying a context manager tosome of this to hopefully better introduce it and give folks a little bit different perspective. so let's travel down the road to pycon. iknow everyone traveled a little bit different road to get here and during their life. soi grew up in clifton, south carolina and just down the road from my house you'll see signslike this. this is a tractor and you see a
lot of tractors kind of moving about. andi grew up in south carolina, spent all my life there. and in high school i had a reallygood teacher and that man taught me that ignorance breeds ignorance and i want you to kind ofkeep this quote in your mind and imagine you know there's the guy from south carolina wearingoveralls that's giving you this quote from a public school in south carolina. so let'skeep that in mind as we go through this talk. and i also want to take a brief moment torecognize some folks that were instrumental in getting me into computing. when i grewup i didn't really have a computer. i didn't really do much with computing until i gotto college. and these were some of the three professors that helped me out a lot, dr. olds,dr. varn, and dr. shiflett. she was actually
the chairman of the department. so as i wascoming up, most of my interaction was with her. so i didn't realize there weren't reallythat many women in computing until i got out into industry. and so i just wanted to thankher. she recently retired. and i think should be well pleased to see a lot of the folksthat have shown up at pycon that are, i think, ready to pick up her torch that she carriedfor so many years to inspire other folks to do big things in computing. and so based on some of their work, i gotinto rural computing. a lot of the best problem solvers i met in graduate school and afteri found out they all came from small towns in the south and south carolina and reallyall over the world. they have a different
perspective sometimes and i wanted to do moreto get to encourage those folks to do more in computing. and so i would come home andcomplain to my wife a lot that there weren't meetups and there weren't other things thata lot of folks maybe in the bay area or other places enjoy and have access to. and so iwanted to do more of that in our small town in south carolina and in other towns likeit. so i got together with some other folks and we started a non-profit to equip, educate,and encourage more folks to do things with computing. and as a result of that, we kindof live near another city that's known as the hub city. it's where all the trains intersectedfor all the old textile mills and it's called the hub city because it was a hub for that.
and so we kind of started our own little pythonuser group a few years back and i told him i would do this. i want to put trey baileyfrom cow pens, south carolina on the board. we didn't have a very good spot to meet up,but this is the back of an old furniture store that allowed us to put our projector up andreview some code. and so throughout this process, i was working to kind of build up more awarenessfor some of the really good folks doing things in rural areas, and but a lot of folks didn'treally understand that. they kept thinking i was trying to introduce folks to do betterpowerpoint presentations and whatnot. as you can tell from some of the slides, i'm notthe person you really want to talk to if you are looking to make a super duper presentation.but along my path and industry, i met up with
a couple of folks that were really inspirationalfor me. and so as i was facing problems encouraging more people to do things in the rural areasand those folks not really understanding, i met up with lisa and ted. and at the timethey were working on a number of projects, and i asked them. i said, hey i would liketo work with you all, because my family was also going through some health care problemsat the time. and so i got this passion for helping folks in rural areas and i also understandthere's a lot of complications everyone deals with in healthcare. and so in 2011 i joinedup with the ted and lisa as the first engineer officially to sign on the dotted line to jointhe company. and i've been working with a lot of really good folks over the years withthem. and i just can't say enough about these
folks. when i speak about them, it's likethey're my extended family, not really like a company. so i just appreciate all that they'vedone to help me. and now health care. so i can't say it quite like john oliver wouldbut we're gonna try to do our best. and as a many of you all know, it impacts all ofus regardless of our gender, or religion, or race, or anything like that. so it's avery important problem that we all should be focused on. one of the things that get folks riled upsometimes about health care is who pays. do i pay? do you pay? does someone else pay?is there some coordination of paying? and it all gets really complicated. and then whenyou add technology into some of these health
care problems, folks get further frustratedbecause a lot of things in healthcare aren't as easy as like maybe uploading a photo ofyour dinner. and it's hard for some of the established folks to change because they'veacquired a number of systems over the years and they don't talk to each other and theydon't necessarily have time to redo everything. so they're trying to keep things running.and it's difficult for new folks to enter because there's this tremendous barrier thatyou have to cross to get into the healthcare business. and so that kind of makes a lotof folks sad. and they kind of shrug, maybe walk off and don't necessarily consider doingthings in health care. but there are a lot of things that we can help fix even if we'renot politicians or are not actively involved
in policy-making decisions, things like that,like if we're working in tech. we can make it easier for you to check your own healthcareinformation. have i met my deductible? am i covered for this service? we can make iteasier for healthcare providers to get paid, those providers that are really good providersthat are out there trying to make a difference and just want to help folks without this extraadministrative burden. and this list could go on and on and on. soone of those professors i showed you earlier, dr. olds, he told me one day, he was like,brian you know one of the great things about standards is that there's so many of them.and in health care that's absolutely true. the more i started working in health care,the more people started rattling off these
transactions set codes to me. give me a 271,270, 276, 277, and they just go on down the list and after a while you just kind of glazeover and you're not quite sure what's going on. but trust me, all these really do mapto something that really happens. but i wanted to point out too that i tried to put the numberof pages in some of these claims, like for claims there, are some of these specificationslike in just the professional claim specification, not anyone's particular implementation guide,that's seven hundred and four pages. so if you're having trouble sleeping at night, youdon't want to take additional medications or anything, i can recommend that you go toread that and it'll put you to sleep pretty quick.
so some of the folks back at pokitdok haveworked really hard to try to help folks visualize how these transactions fit together becauseit gets really complicated very quickly. and for folks that have really good technicalideas but they're new to health care, we've been trying to help them implement their ideasmore quickly. and so as you can see here, you enroll in benefits. once you're enrolledyou can check your eligibility. you can potentially get authorized for a service. and after thatyou can file claims, check the status of those claims. you could do that in a whole kindof loop. and then if you don't like your plan, you can change and re-enroll and go throughthat process again. so let's look at some of the x12 raw data.
and here's just a sample snippet that i kindof grabbed and wanted to use to introduce folks to these transactions that might notbe familiar with them. so each x12 healthcare transaction, like the other x12 transactionsthat exist for other industries, have this notion of an envelope. so there are thesetwo records that kind of book end all the data in between. and inside that envelope,there's a functional grouping of transaction sets. and then inside that grouping, there'sa transaction set and there can be one or more of these transactions sets. so you can kind of see, i've indented it onthis slide but there's this notion of this looping they can happen. so these files canbe really really small and just contain one
transaction. they can be really really bigand contain a whole bunch. and so let me show you what the guts of one of these transactionsmight look like. here's a claim. this is one of my own claims, because, you know, a lotof this data is hipaa protected, but i can give you all my data that i want. it's ok.so this is one that i had recently just for a routine physical, and it's just a snippet.but you can see in here like the sv1 segment id there, that's like a line item on a receipt.so if you go buy something at the store, they'll give you a receipt and say you got this productor this service. and so in the healthcare claim, it's verymuch like that. i got this procedure 99214 and i paid $70 bucks for it and so on. a lotof times though these transactions aren't
even this well formed. a lot of times it willbe on one line. and so you end up like trying to scroll forever to figure out what's goingon. it's just not a very intuitive way to work through some of this stuff. so at pokitdok,one of the things we've been doing is -- and we work in python quite a bit. so we've beenworking to make sure that we can easily convert to and from a dictionary representation ofthese transactions. because it's easier for us to work with and review and even talk withour edi team and other folks in the healthcare business about this data. and they don't haveto get mired up in all of those older transactions unless they want to. and so folks that draw and visualize thingsbetter than i do helped make this for some
customers at pokitdok to help them kind ofunderstand the flow of transactions through our system and other systems that may be doingsimilar kind of transactions. and one of the main things i just kind of want to highlighthere if you can see it, is there's a couple of indicators as this workflow progressesthat says what may be about 24 hours before you get back an acknowledgement for this claimtransmission. or it might be one to two weeks before you hear whether or not your claimis made it into this adjudication process and it might be a paid. and then if there'sadditional paperwork required, it may take even longer. and so a lot of times i'll askfolks, well, why does it take one to two weeks? or what happens between this point and thispoint? and one of the answers i get a lot
is, well, that's just the way we've alwaysdone it. and you might expect in the south they say that for other things too, maybeincorrectly. and i just wanted to kind of mention this. that my grandma, she made thebest fried okra i've ever had. and i've never found anybody else that had any fried okralike grandma. that's about the only thing that that's the way we've always done it shouldbe used for. so if it's your grandma's fried okra, it's okay. if it's something in healthcare or something in another industry, you always want to make an examination of it andsee if you can do a little bit better. or if it's a new group, you want to, you know,treat them well. you may not know anything about them.
and so just another quick little summary here.in healthcare there's a couple things that the challenge us along the way. a lot of folksare too big to move quickly. my brother recently shared a video on youtube with me of a v8chainsaw that was out here i think in portland or in washington state. and i was really impressedby it. my brother thought it was great. but it's a v8 engine on a big chainsaw and ittakes a couple of big folks to move it around to get it over the log that they're cuttingup. and that's kind of what i visualize when folks say they can only use enterprise productsto do things. when we move with python, we move a lot quicker. but, you know, a lot offolks unfortunately get so caught up in these specs that i just walked you through, theynever get to actually implementing anything
or making the first transaction get acrossthe wire. and i was telling some folks at lunch thatthat's kind of like the allen iverson segment, you know, when he was talking about practice,he just talked about practice, not the actual game. unfortunately in health care, a lotof folks talk about specs and don't ever make it to the actual transactions. and in thesouth, this would compare to like pulling weeds all day in the corner of a field andnever getting the field cut. so at pokitdok, some of the folks i've beenchatting with about how we work and how i might explain it to folks, especially in ruralareas. it's kind of like tractors and weed eaters and we're trying to, in each developmentsprint we're trying to get the field cut but
make it still look good so it'd be a nicepastoral scene that folks want to come by and admire. so one day i was walking throughmy field between my house and my brother's house. we live on some land in south carolina.and he comes home with this on his trailer. and i said, man what are you gonna do withthat? what is that? he goes, man, this is a field mower. he goes, i'm calling my buddyreed. we gonna hook that up to the four-wheeler and we gonna get after this field and cutit all down and make it real nice. and i was like, oh my goodness. but sure enough, theseguys are some of the best problem solvers i know and they came up and that evening.within minutes that field was cut and then i started thinking about how we operate atpokitdok with some of the python stuff. we
really have been kind of operating like theseguys have been making quick work of the work that they've been given. and so let's talkabout how python might help facilitate some of that. so i look at python like the diamondplate truck toolbox. so if you know folks that have big trucks or trucks, a lot of timesyou'll see this kind of truck box on the back. and this is from my brother's truck. so ifhe rolls up to help you on a problem, he doesn't say, i'm gonna come back in six to 18 monthsand i'll get with you then. he says, i got that in the truck. i'm gonna help you rightnow. and i feel like that's how i view python and some of the stuff we've been doing. andas many of you probably know, python is really good for large and small projects.
a lot of folks in health care will sometimeskind of come at me with, well it's just a scripting language. well we built the wholeplatform with it, right? a large system, large application. it's got a really good standardlibrary for a lot of the common things that you might run across and health care. you'vegot all sorts of really good language features like decorators, generators, context managers.it's just easy to tote around like my backpack. so how can we tractor with python? i'm interactiveall day. i don't know if you went to scopatz's talk the other day, but he's got some goodstuff with python and bash and merging those things together. so i'm interactive all the time. i operateone line at a time. and that's been a big
help to me to quickly know, does this work?does this not work? and this is kind of like the workflow i do every day. if someone callsup and says, hey we need to get this done real fast, i kind of work through interactiveevaluations, come up with snippets and test. and i sling them right up there into a buffer.and then those snippets evolve into a library of functions. and then i ship it and circleback around so we can get something out there to meet folks' needs. and when you ship itand circle back around, it's kind of like you're driving a big truck. you kind of haveto turn that big wheel and come back around. so how do you weed eat? well there's a lotof folks on our team like dixon whitmire. he's one of the best guys i know at doingsome of this. so if i sling stuff up there
and it's working pretty well but there's opportunitiesfor improvement, dixon can come back through or any of the other folks on the team andreduce any kind of duplication. those functions may become classes. they willoptimize code based on some real word metrics we've been gathering. and here's an importantthing. it's ok to call that tractor back if not enough was fixed up. i know a lot of folksdon't want to have technical debt linger and we don't either. and so this is how we dowith it. the weed eater crew can always call you back and say hey, let's fix this up. so let's look at a couple of samples herethat we've got that we've just kind of discovered or stumbled across with how we process x12with python. one of the first things i like
to point out to folks is we use context managersa lot. and so you noticed that other slide where there's an x 12 file, there's an x 12functional group, and a transaction set. each of those have corresponding trailers wherethey have to keep up with like the segment counts and other information about what wascontained in that file. but by using these context managers, we can just focus on writingout segments and doing many business-specific things. and when we kick out of that contextmanager, the trailers and the counts and everything just kind of naturally flow along. the same thing popped up with decorators.as you saw earlier, all these segments exist and they're all over the place. and dependingon the context that they occur in, they may
have different meanings associated with them.and so in this case, here's an example from a 271 response that contains your eligibilityinformation, in this case the deductible. so rather than having these funky if blocksthat go on for miles, we break those up into functions, decorate them so that we can applyjust those when we encounter a segment that we are processing. so in this case we'll pickup the ev segment. we'll take the evo one element when it's a c and then this functionalfire. and that's kind of the logic we'll load up based on the transaction set to convertthese raw edi transactions into our dictionaries that we work with internally. we make heavyuse of generators because i don't know if you've picked up anything off the shelf beforeand it's highly touted as being an edi mapper
or whatnot, and then you throw the first bigswole file to it and just totally hit -- goes out of memory and blows up. well with pythonas you know, we can use generators to stream this data in. so we can work with it moreefficiently and keep a lower memory footprint. so we stream in these segments and we canwork with them in a raw mode kind of just like a plain dictionary with that raw segmentdata. but we can also chain these generators together so i can stream in my segments, bustthose up into dictionaries and then take those segment dictionaries and then map them intointernal models. so that when i'm working within that context, i never even really lookat the raw edi. i'm just yielding these internal dictionaries that represent transactions.
so unless there's some sort of core issue,i'm always working with these higher level transactions and i can make pretty quick workof those. and as an example of that, a lot of folks will tout these x12 standards onand on and on, but then in practice let's say for like the enrollment world, a lot oftimes what ends up happening is they ship your data around in spreadsheets or csv files,not the x12 834 that they preached a lot to you about. and so one of the things that we'vedone even related to eligibility data is, folks will say hey, we've got customers thatwould like to use your api's to access their eligibility data. but we can't send you an x 12 271 for whateverreason. but i can send you a spreadsheet or
i can send you a csv. and so you can importcsv from the standard library. you can create a little generator that can take the dictionaryrepresentation that row, we can quickly map it to our internal model, and then we canstring it back out as x12, as if it had come to us that way. and then we can host thatdata for them. our customers can use the api's. they never know that there was a problem behindthe scenes with x12. so that's been a really cool thing for us to use there. and if you'venoticed, all this stuff fits on a slide. so we'll get to an example in a minute that won'tfit on the slide. so buckle your safety belts. we're going toaccelerate and hit the last part of this talk. so i know you're wondering about, well wheredoes pypy come in? so in the south you hear
a lot of stuff that may sound ignorant sometimes.and i hear it in the healthcare world when they talk about python. so you'll hear stufflike, but my mamma's brother's neighbor's co-worker's best friend said python was tooslow and you can't scale. and i'm like, i do my scooby-doo on that. i'm like, "ruff?"i'm like, what are you talking about? i don't even know that makes sense, but you hear thata lot, right? and a lot of organizations both at the upper level and even lower level willsay, well we're not going to consider that. and i think that's a mistake sometimes. solet's see how can we make this go faster? we're gonna bring in py power we're goingto take a python code, run it with pypy and we're going to accelerate. and if you've everseen the movie sling blade, this is what i
imagine when i get to this slide. you know,you've got a perfectly good lawn mower here. all these folks are standing around it sayingwell, it ain't working. and then sling blade or billy bob comes over and he just goes,it ain't got any gas in it. and so that's kind of what i think a lot of these folksare missing, right? they just ain't got any gas in their lawn mower. so we switched topypy and we've seen really good results from that. we're going to check that out here ina second. but one thing i wanted to point out here.while we were working through a big project and running it with pypy, we did hit a fewthings that i didn't expect. and in one case, i had some tests that broke due to some uidegeneration and i couldn't quite figure it
out. but i took a moment and i posted on theirissue tracker. i'm like hey, hey folks. how you doing? i appreciate all your work andi want to thank you for it. and i just ran across this and i'm not sure what to do withit. so, you know, working in healthcare i don'teven know if i expected a response for 6 to 8 18 months or whatever. well, sure enoughthat same day alex gaynor, a guy i don't even know what i've heard a lot about and i respect,he shows up. he says, man that looks pretty bad. i'm going to fix it right now. and thensure enough that same day service happened. he fixed it in pypy and we kept rolling. ijust wanted to mention that a lot of times, and this is something my dad always told usgrowing up that my grandma passed down was
that, you know, it doesn't cost you anythingto be nice to somebody. and that's something that's stuck with me for a long time. andyou see a lot of times and in the tech world, you'll have a lot of people talking down toeach other on pull requests and on other things. i don't think that's right, right? we shouldn'ttreat each other that way. and i've found that i get a lot better results. my pull requestsget processed or my issues get worked if i say, how you doing? in the south we say, how's your mamma andthem? but we don't do that -- i don't do that on the pull requests. but and then i thankthem. i say thank you all for your hard work. and a lot of people put in big-time work onthe stuff and i don't even understand half
of it, right, so i respect what they're doing. so let's get to the main event. i know i'mrunning out of time here. let me give you a real world example maybe you can take backsome of your folks that may not believe in python or may not believe in pypy and in someof the work there. let's take some real-world stuff here. so if you're familiar with healthcare, you know that each health care provider gets a unique id. they call it an npi. andit's used all over these x 12 transactions. it's used all over the place. and just asan example, that 146 etc., that's actually me. you can go get your own npi if you workin healthcare, and you can make your specialty like healthcare data technician or whateverthe code is. so there's -- they use the luhn
algorithm to do a checksum on this, kind oflike you might do a credit card. and i'm not going to go into that algorithm, but there'sa good write-up on wikipedia about that. but really it's just designed to catch accidentalerrors. you know, there's a lot of typos that, you know, if somebody's manually enteringsomething. and we want to catch that before we relay it on to a trading partner or payerfor processing. so on that wikipedia page, they had a python snippet, an example implementationof the luhn algorithm that someone had posted. so i was like, that's pretty cool. let's justdo some timings of that, just to show folks well, what kind of speed ups might you geton a real world kind of thing with pypy. so i did a few rounds of time-its and with python2.7, it came out it at maybe like 9.74 microseconds
per loop. python 3.5 was a little bit fasterin these tests. and ran it with pypy and it went down to 1.54. so that's pretty significant. i didn't do anything but just take a snippetof python code and ran it with a different interpreter. well one of my co-workers, jaredcorderon, i call him jc for short. he's a south carolina native also but he doesn'ttalk quite like i do. he's a little bit more refined, i would say. but he's got a big mathbackground, a phd in math i think actually. and he came over and we were working on somenew pharmacy api and he said, hey man i think i can make that go a little bit faster. andso he says, you know, i think that's just really some integer arithmetic, maybe a lookuptable or something. here, take these four
functions and try it out. so i'm like, youknow. and it still fits on the slide. he's got a bunch of comments on if you look atthe companion, so you can get the full detail there. and so while we were talking i was like, let'ssee how that does. and look at that. pretty i mean -- this is even in the non, the nonjit'd c python, it went from like 9 to 2.21. so you got a pretty good speed up, you know,just thinking a little bit more about how you solve the problem. there's a little bitof an increase in python 3.5. i haven't had a chance to look into that yet, but theremay be something else going on there that i didn't expect. but in pypy, look. it waslike it almost like a three times improvement
there just by kind of swapping out your algorithm.and so i was like, man, jc that's awesome. so and then he was like, let's see. how longwould it take to validate all the npis? let's say we got tomorrow, every every a healthcareprovider in the us that here's a claim this process it. let's validate all that stuff. so another little quick snippet, again, itfits on the screen. taking jc's implementation and we're going to take the may release ofthe npi data. there's a public data set out there. anybody can get it. and if your healthcareprovider, don't put your cell phone in there, because its public data. then you'll get allthese calls and you won't know where they're coming from. so that's just a heads up onthat. we will get asked that a lot. well how'd
you get my phone number? well it's in thisdata set. it's public. it's out there on the internet, you know. so anyway i wanted to have this little snippet.i wanted to run jc's algorithm a bunch to see what would happen there. and just outof fun, in curiosity, a lot of folks just say, you know, we can't use python. we usejava. we need speed or whatnot. and i was like, all right, so let's do a java versiontoo. and it's been a while since i've written any java so you all might be able to do abetter one i did. so that's another reason i kind of pulled in the apache commons thereto get their luhn algorithm. i thought that might be a little bit more fine-tuned. butyou notice this doesn't fit on the screen.
you have to go out and check the companionto see the rest of that. so let's compare them. and these are all rough calculations, right,like we might do in the field, my brother just tinkering with something. run the javaversion. i ran this over and over and over and over again, got similar timings, ran jc'salgorithm in pypy. it always beat it every time. a lot of people don't think about that,right, because they never stop to learn about anybody new or anything new and i just wantedto kind of highlight that to maybe let those folks consider something new. basically tosay, algorithms still matter. and a lot of folks don't think about that. so let's takeit to the house. just a quick summary of what
we are going to wrap up with here, thingsi want you to kind of maybe take back with you. interactive development in a jit, ithelps you tractor and go fast. and python and pypy are one way to do that. and one ofmy co-workers and friends, god, he would like me to remind you that closure could also beused in this case. but since we're at pycon, i'm talking about python. but yes, there areother alternatives out there. and folks should consider those too because those may fit,you know, better with your organization. but in general folks should be more open-mindedabout the tools and techniques they could use to solve some of these really importantproblems that we all face and that impact us all. there's a couple of follow-up references.brett cannon, i got to chat with him the other
day. they're doing some cool stuff with pigeonto make it easier for folks to bolt on the jits of the future and he's got a really goodsummary, good survey of other python interpreters if this is kind of interesting to you. andhe doesn't much better a job at recapping all that i could ever do. if you're more interestedin the luhn algorithm in those npi checksums, you can check that out. and i've got a littlerepo on github and i've got a docker image out there too if you want to take this andrun it on your machine to see what's up. and thank y'all. i really appreciate it. [applause] speaker: thank you very much brian. unfortunately,we don't have enough time for questions so
what i would encourage you is to talk to brianon the hallway or open an open space. thank you very much, brian. speaker: thank you.