From: Russell B. <ru...@wi...> - 2023-06-14 16:14:16
|
Yeah, sorry. It's been a very long time since I posted a question on HAPI FHIR and I couldn't find the forum. Then, there's the fact that I discovered that I had put totally bogus values into those fields which HAPI FHIR didn't catch in its parse, but refused to give them back when I asked for them. So, I fixed that and I'm working. Again, sorry for the multiple screw-ups. On 6/13/23 15:49, McClendon, Craig wrote: > > If I’m not mistaken, this is the mailing list for the HAPI HL7v2 library. > > This code below looks to be using HAPI FHIR – different library. > > See the get help section here for more info: https://hapifhir.io/ > > Incidentally, you are creating a new (empty) Patient object, then > trying to fetch the name. It doesn’t have one because you haven’t set > one. > > *From:* Russell Bateman <ru...@wi...> > *Sent:* Tuesday, June 13, 2023 1:54 PM > *To:* hl7...@li... > *Subject:* [External] [HAPI-devel] Unable to inspect gender and > birthdate in Patient > > This message is from an EXTERNAL SENDER - be CAUTIOUS, particularly > with links and attachments. > > ------------------------------------------------------------------------ > > In the code below, I have an incoming Patient which has all the fields > that interest me filled in (see debugger image, but if it doesn't come > through, it shows that patient is filled out for name, gender, > birthdate and address). > > However, when I attempt to inspect *gender* and *birthdate*, these are > *null* despite the API telling me they exist (which, of course, they > do--see attached image). Note that I create a new Patient, named > worthy, and experimentation demonstrates that my code below copies the > name and the address successfully to worthy. It's just trying to copy > gender and birthdate that result in null. If I stop at the lines with > *******, patient.getGender() and patient.getBirthDate() return null. > > There must be some very fundamental bit of understanding of which I'm > completely ignorant. > > { > worthy = new Patient(); > > // name > if( !patient.hasName() ) > patientTooThin( "name" ); > HumanName humanName = patient.getNameFirstRep(); > List< StringType > givens = humanName.getGiven(); > String family = humanName.getFamily(); > String first = null, middle = null; > for( StringType given : givens ) > { > if( isNull( first ) ) > first = given.toString(); > else if( isNull( middle ) ) > middle = given.toString(); > else > break; > } > > if( isNull( family ) || isNull( first ) ) > patientTooThin( "first or last name" ); > > worthy.setName( Collections.singletonList( humanName ) ); > > // gender ************* > if( !patient.hasGender() ) > patientTooThin( "gender" ); > > worthy.setGender( patient.getGender() ); // *************** > > // birthDate > if( !patient.hasBirthDate() ) > patientTooThin( "birth date" ); > > worthy.setBirthDate( patient.getBirthDate() ); // *************** > > // address > if( !patient.hasAddress() ) > patientTooThin( "address" ); > > worthy.setAddress( Collections.singletonList( > patient.getAddressFirstRep() ) ); > } > > > > ------------------------------------------------------------------------ > > This message is for the designated recipient only and may contain > privileged, proprietary, or otherwise confidential information. If you > have received it in error, please notify the sender immediately and > delete the original. Any other use of the e-mail by you is prohibited. > Where allowed by local law, electronic communications with Accenture > and its affiliates, including e-mail and instant messaging (including > content), may be scanned by our systems for the purposes of > information security, AI-powered support capabilities, and assessment > of internal compliance with Accenture policy. Your privacy is > important to us. Accenture uses your personal data only in compliance > with data protection laws. For further information on how Accenture > processes your personal data, please see our privacy statement at > https://www.accenture.com/us-en/privacy-policy. > ______________________________________________________________________________________ > > www.accenture.com |