error when add multiple OBX segments to NHapi.Model.V25.Group.VXU_V04_ORDER - nhapi

I am working on creating HL7 VXU V04 type message using NHapi V2.5.
Below is the required message outcome( from NIST site:http://hl7v2-iz-testing.nist.gov/mu-immunization/)
The issue I am running into is how to create four OBX segments("NHapi.Model.V25.Segment.OBX ") and add it to the "NHapi.Model.V25.Group.VXU_V04_ORDER" ?
Below is my code, Line#5 works, it create multiple ORDER but if i try to do the same to create multiple OBSERVATION (Line#8), I get the below error:
"Can't create repetition #1 of Structure OBSERVATION - this Structure is non-repeating"
As per HL7 specifications OBSERVATION is repeating structure, Anyone please help here?
Any pointers or any suggestions are greatly appreciated.
NHapi.Model.V25.Message.VXU_V04 vxuMsg = new VXU_V04();
PipeParser parser = new PipeParser();
for (int i = 0; i < person.Immunizations.Count; i++)
{
NHapi.Model.V25.Group.VXU_V04_ORDER orc = (NHapi.Model.V25.Group.VXU_V04_ORDER)vxuMsg.GetStructure("ORDER", i);
for (int j = 0; j < 2; j++)
{
NHapi.Model.V25.Group.VXU_V04_OBSERVATION observation = (NHapi.Model.V25.Group.VXU_V04_OBSERVATION)orc.GetStructure("OBSERVATION", j);
NHapi.Model.V25.Segment.OBX obx1 = (NHapi.Model.V25.Segment.OBX)obx.GetStructure("OBX");
}
NHapi.Model.V25.Segment.RXA im = orc.RXA;
NHapi.Model.V25.Segment.ORC oc = orc.ORC;
NHapi.Model.V25.Segment.RXR rxr = orc.RXR;
}
Required message outcome
MSH|^~\&|Test EHR Application|X68||NIST Test Iz Reg|201207010822||VXU^V04^VXU_V04|NIST-IZ-001.00|P|2.5.1|||AL|ER
PID|1||D26376273^^^NIST MPI^MR||Snow^Madelynn^Ainsley^^^^L|Lam^Morgan|20070706|F||2076-8^Native Hawaiian or Other Pacific Islander^CDCREC|32 Prescott Street Ave^^Warwick^MA^02452^USA^L||^PRN^PH^^^657^5558563|||||||||2186-5^non Hispanic or Latino^CDCREC
PD1|||||||||||02^Reminder/Recall - any method^HL70215|||||A|20120701|20120701
NK1|1|Lam^Morgan^^^^^L|MTH^Mother^HL70063|32 Prescott Street Ave^^Warwick^MA^02452^USA^L|^PRN^PH^^^657^5558563
ORC|RE||IZ-783274^NDA|||||||I-23432^Burden^Donna^A^^^^^NIST-AA-1||57422^RADON^NICHOLAS^^^^^^NIST-AA-1^L
RXA|0|1|20120814||140^Influenza, seasonal, injectable, preservative free^CVX|0.5|mL^MilliLiter [SI Volume Units]^UCUM||00^New immunization record^NIP001|7832-1^Lemon^Mike^A^^^^^NIST-AA-1|^^^X68||||Z0860BB|20121104|CSL^CSL Behring^MVX|||CP|A
RXR|C28161^Intramuscular^NCIT|LD^Left Arm^HL70163
OBX|1|CE|64994-7^Vaccine funding program eligibility category^LN|1|V05^VFC eligible - Federally Qualified Health Center Patient (under-insured)^HL70064||||||F|||20120701|||VXC40^Eligibility captured at the immunization level^CDCPHINVS
OBX|2|CE|30956-7^vaccine type^LN|2|88^Influenza, unspecified formulation^CVX||||||F
OBX|3|TS|29768-9^Date vaccine information statement published^LN|2|20120702||||||F
OBX|4|TS|29769-7^Date vaccine information statement presented^LN|2|20120814||||||F

Dim vxuMsg As NHapi.Model.V25.Message.VXU_V04 = New VXU_V04()
Dim orc As NHapi.Model.V25.Group.VXU_V04_ORDER = DirectCast(vxuMsg.GetStructure("ORDER", 0), NHapi.Model.V25.Group.VXU_V04_ORDER)
Dim observation As NHapi.Model.V25.Group.VXU_V04_OBSERVATION = orc.GetOBSERVATION(0) 'DirectCast(orc.GetStructure("OBSERVATION", 0), NHapi.Model.V25.Group.VXU_V04_OBSERVATION)
Dim orderobservation As VXU_V04_ORDER = vxuMsg.GetORDER(0)
Dim obx1 As NHapi.Model.V25.Segment.OBX = DirectCast(observation.GetStructure("OBX"), NHapi.Model.V25.Segment.OBX)
obx1 = orderobservation.GetOBSERVATION(0).OBX
obx1.SetIDOBX.Value = "1"
obx1.ValueType.Value = "CE"
obx1.ObservationIdentifier.Identifier.Value = "64994-7"
obx1.ObservationIdentifier.Text.Value = "Vaccine funding program eligibility category"
obx1.ObservationIdentifier.NameOfCodingSystem.Value = "LN"
obx1.ObservationSubID.Value = "1"
Dim ce As New CE(oru01)
ce.Identifier.Value = "V05"
ce.Text.Value = "VFC eligible - Federally Qualified Health Center Patient(under-insured)"
ce.NameOfCodingSystem.Value = "HL70064"
obx1.GetObservationValue(0).Data = ce
obx1.ObservationResultStatus.Value = "F"
obx1.DateTimeOfTheObservation.Time.Value = "20120701"
obx1.GetObservationMethod(0).Identifier.Value = "VXC40"
obx1.GetObservationMethod(0).Text.Value = "Eligibility captured at the immunization level"
obx1.GetObservationMethod(0).NameOfCodingSystem.Value = "CDCPHINVS"
Dim obx2 As NHapi.Model.V25.Segment.OBX = obx1
obx2 = orderobservation.GetOBSERVATION(1).OBX
obx2.SetIDOBX.Value = "2"
obx2.ValueType.Value = "CE"
obx2.ObservationIdentifier.Identifier.Value = "30956-7"
obx2.ObservationIdentifier.Text.Value = "vaccine type"
obx2.ObservationIdentifier.NameOfCodingSystem.Value = "LN"
obx2.ObservationSubID.Value = "2"
Dim ce2 As New CE(oru01)
ce2.Identifier.Value = "88"
ce2.Text.Value = "Influenza, unspecified formulation"
ce2.NameOfCodingSystem.Value = "CVX"
obx2.GetObservationValue(0).Data = ce2
obx2.ObservationResultStatus.Value = "F"
Dim obx3 As NHapi.Model.V25.Segment.OBX = obx1 'DirectCast(observation.GetStructure("OBX"), NHapi.Model.V251.Segment.OBX)
obx3 = orderobservation.GetOBSERVATION(2).OBX
obx3.SetIDOBX.Value = "3"
obx3.ValueType.Value = "TS"
obx3.ObservationIdentifier.Identifier.Value = "29768-9"
obx3.ObservationIdentifier.Text.Value = "Date vaccine information statement published"
obx3.ObservationIdentifier.NameOfCodingSystem.Value = "LN"
obx3.ObservationSubID.Value = "2"
Dim ts3 As New TS(oru01)
ts3.Time.Value = "20120702"
obx3.GetObservationValue(0).Data = ts3
obx3.ObservationResultStatus.Value = "F"

Related

<IPython.core.display.HTML object> instead of graph

I am trying to achieve the following Twitter-Visualization project in iPython: http://www.amypeniston.com/web/visualizing-twitter-data
For the last step, my code is:
%pylab
dogs = pd.read_csv(' C:/Users/Alex/mongodb/bin/outputTweets.csv')
dogs['created_at'] = pd.to_datetime(pd.Series(dogs['created_at']))
dogs.set_index('created_at', drop=False, inplace=True)
dogs.index = dogs.index.tz_localize('GMT').tz_convert('EST')
dogs.index = dogs.index - DateOffset(hours = 12)
dogs.index
dogs1m = dogs['created_at'].resample('1t', how='count')
v.core.initialize_notebook()
area = v.Area(dogs1m)
area.colors(brew='Spectral')
area.display()
However, all I get in return is:
IPython.core.display.HTML object

Getting Error In Journal Entry Quickbooks

I am trying to add a journal entry. But it returns like an error
Uncaught IdsException: [0]: 2014-01-29 08:13:07 - D:\DummyApps\v3-php-sdk-2.0.1\v3-php-sdk-2.0.1\DataService\DataService.php - 341 - CheckNullResponseAndThrowException -
Response Null or Empty thrown in D:\DummyApps\v3-php-sdk-2.0.1\v3-php-sdk-2.0.1\Core\CoreHelper.php on line 95'
I am using QuickBooks PHP SDK. My code is below:
// Prep Data Services
$dataService = new DataService($serviceContext);
if (!$dataService)
exit("Problem while initializing DataService.\n");
$linedet = new IPPJournalEntryLineDetail();
$linedet->PostingType = 'Credit';
$linedet->AccountRef = 9;
$line = new IPPLine();
$line->Id = 0;
$line->Description = 'test journal';
$line->Amount = 2.00;
$line->DetailType= 'test ';
$line->JournalEntryLineDetail = $linedet;
$linedet2 = new IPPJournalEntryLineDetail();
$linedet2->PostingType = 'Debit';
$linedet2->AccountRef = 9;
$line2 = new IPPLine();
$line2->Id = 1;
$line2->Description = 'test journal';
$line2->Amount = 2.00;
$line2->DetailType= 'test ';
$line2->JournalEntryLineDetail = $linedet2;
// Add a journal
$journalObj = new IPPJournalEntry();
$journalObj->SyncToken = '1';
$journalObj->DocNumber = '1';
$journalObj->TxnDate = '2014-12-30';
$journalObj->RefNumber = 't123';
$journalObj->PrivateNote = 'Just testing';
$journalObj->Line = array($line, $line2);
$journalObj->Adjustment = TRUE;
$journalObj->IsAdjustment = TRUE;
$resultingObj = $dataService->Add($journalObj );
Please help me....I am stuck here.
Thanks in Advance
I found the error here.
The 'DetailType' in the line object must have 'JournalEntryLineDetail'

How to copy one spreadsheet's cell to another spreadsheet

I tried coding like spreadsheet API batch copy https://developers.google.com/google-apps/spreadsheets/#updating_multiple_cells_with_a_batch_request, The sample is base on same spreadsheet, I added a target cell but always get same error
com.google.gdata.client.batch.BatchInterruptedException: Batch Interrupted (some operations might have succeeded) : a response has already been sent for batch operation update id='R1C1'
My code like this
SpreadsheetService spreadsheetService = getSpreadsheetService(currentEmail);
WorksheetFeed feed = spreadsheetService.getFeed(getWorksheetFeedURL(sourceId), WorksheetFeed.class);
SpreadsheetEntry targetFeed = spreadsheetService.getEntry(getSpreadsheetFeedURL(targetId), SpreadsheetEntry.class);
SpreadsheetEntry sourceFeed = spreadsheetService.getEntry(getSpreadsheetFeedURL(sourceId), SpreadsheetEntry.class);
for(WorksheetEntry entry:feed.getEntries()){
WorksheetEntry targetWorksheet = spreadsheetService.insert(targetFeed.getWorksheetFeedUrl(), entry);
FeedURLFactory urlFactory = FeedURLFactory.getDefault();
URL cellFeedUrl = urlFactory.getCellFeedUrl(sourceFeed.getKey(), "od6", "private", "full");
URL targetFeedUrl = urlFactory.getCellFeedUrl(targetFeed.getKey(), "od6", "private", "full");
CellFeed cellFeed = spreadsheetService.getFeed(targetFeedUrl, CellFeed.class);
List<CellAddress> cellAddrs = new ArrayList<CellAddress>();
for (int row = 1; row <= entry.getRowCount(); ++row) {
for (int col = 1; col <= entry.getColCount(); ++col) {
cellAddrs.add(new CellAddress(row, col));
}
}
Map<String, CellEntry> cellEntries = getCellEntryMap(spreadsheetService, cellFeedUrl, cellAddrs);
CellFeed batchRequest = new CellFeed();
for (CellAddress cellAddr : cellAddrs) {
URL entryUrl = new URL(targetFeedUrl.toString() + "/" + cellAddr.idString);
CellEntry batchEntry = new CellEntry(cellAddr.row, cellAddr.col, cellAddr.idString);
String inputValue = cellEntries.get(cellAddr.idString).getCell().getInputValue();
batchEntry.changeInputValueLocal(inputValue);
batchEntry.setId(String.format("%s/%s", targetFeedUrl.toString(), cellAddr.idString));
System.out.println(targetFeedUrl.toString()+": "+cellAddr.idString+" "+ inputValue);
BatchUtils.setBatchId(batchEntry, cellAddr.idString);
BatchUtils.setBatchOperationType(batchEntry, BatchOperationType.UPDATE);
batchRequest.getEntries().add(batchEntry);
}
spreadsheetService.setHeader("If-Match", "*");
// Submit the update
Link batchLink = cellFeed.getLink(ILink.Rel.FEED_BATCH, ILink.Type.ATOM);
CellFeed batchResponse = spreadsheetService.batch(new URL(batchLink.getHref()), batchRequest);
boolean isSuccess = true;
for (CellEntry entry1 : batchResponse.getEntries()) {
String batchId = BatchUtils.getBatchId(entry);
if (!BatchUtils.isSuccess(entry1)) {
isSuccess = false;
BatchStatus status = BatchUtils.getBatchStatus(entry);
}
}
spreadsheetService.setHeader("If-Match", null);
Batch copy:
What is the fastest way to update a google spreadsheet with a lot of data through the spreadsheet api?
There is a Bug with cell references such as $A5.
They will not write to the spreadsheet. While both A5 and $A$5 work, references with just one $ in cause a problem. I forget the fine detail.

OpenOffice Draw macro to find replace text

I'm looking to find replace text within multiple PDF documents using Draw. Thus far I've managed to open the PDF however
mydoc.createReplaceDescription
appears not to be a valid property / method on a Draw doc. Although oddly this is used in many examples for writer and calc.
Are there any alternatives?
Okay after some playing around with the recorder in the Writer I managed to record a macro that seems to be more general purpose than the createReplaceDiscription I was trying earlier.
It's got a lot of bumf that I guess could be cleaned up but it works...
REM ***** BASIC *****
Sub Main
End Sub
sub WriterFindReplace
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(18) as new com.sun.star.beans.PropertyValue
args1(0).Name = "SearchItem.StyleFamily"
args1(0).Value = 2
args1(1).Name = "SearchItem.CellType"
args1(1).Value = 0
args1(2).Name = "SearchItem.RowDirection"
args1(2).Value = true
args1(3).Name = "SearchItem.AllTables"
args1(3).Value = false
args1(4).Name = "SearchItem.Backward"
args1(4).Value = false
args1(5).Name = "SearchItem.Pattern"
args1(5).Value = false
args1(6).Name = "SearchItem.Content"
args1(6).Value = false
args1(7).Name = "SearchItem.AsianOptions"
args1(7).Value = false
args1(8).Name = "SearchItem.AlgorithmType"
args1(8).Value = 0
args1(9).Name = "SearchItem.SearchFlags"
args1(9).Value = 65536
args1(10).Name = "SearchItem.SearchString"
args1(10).Value = "<<THE WORD YOUR FINDING>>"
args1(11).Name = "SearchItem.ReplaceString"
args1(11).Value = "<< THE WORD YOUR USING TO REPLACE>>"
args1(12).Name = "SearchItem.Locale"
args1(12).Value = 255
args1(13).Name = "SearchItem.ChangedChars"
args1(13).Value = 2
args1(14).Name = "SearchItem.DeletedChars"
args1(14).Value = 2
args1(15).Name = "SearchItem.InsertedChars"
args1(15).Value = 2
args1(16).Name = "SearchItem.TransliterateFlags"
args1(16).Value = 1280
args1(17).Name = "SearchItem.Command"
args1(17).Value = 3
args1(18).Name = "Quiet"
args1(18).Value = true
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1())
end sub

FedEx Webservice for printing Multiple shipping labels

I am trying to connect to the FedEx shipping webservice v8.
Everything works fine when I only have one RequestedPackageLineItems set. When I add two items I get the following error.
"Invalid package count or invalid package sequence number."
My Code is as follows
ProcessShipmentRequest request = CreatePendingShipmentRequest();
ShipService service = new ShipService();
ProcessShipmentReply reply = service.processShipment(request);
...
private static ProcessShipmentRequest CreatePendingShipmentRequest()
{
ProcessShipmentRequest request = new ProcessShipmentRequest();
request.WebAuthenticationDetail = new WebAuthenticationDetail();
request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential();
request.WebAuthenticationDetail.UserCredential.Key = "XXX";
request.WebAuthenticationDetail.UserCredential.Password = "XXX";
request.ClientDetail = new ClientDetail();
request.ClientDetail.AccountNumber = "XXX";
request.ClientDetail.MeterNumber = "XXX";
request.TransactionDetail = new TransactionDetail();
request.TransactionDetail.CustomerTransactionId = "*** Ground Domestic Shipping Request v8 using C# ***";
request.Version = new VersionId();
//Inside this method I set request.RequestedShipment.PackageCount = "2";
SetShipmentDetails(request);
SetPackageLineItems(request);
return request;
}
private static void SetPackageLineItems(ProcessShipmentRequest request)
{
request.RequestedShipment.RequestedPackageLineItems = new RequestedPackageLineItem[2];
request.RequestedShipment.RequestedPackageLineItems[0] = new RequestedPackageLineItem();
request.RequestedShipment.RequestedPackageLineItems[0].SequenceNumber = "1";
request.RequestedShipment.RequestedPackageLineItems[0].Weight = new Weight();
request.RequestedShipment.RequestedPackageLineItems[0].Weight.Value = 50.0M;
request.RequestedShipment.RequestedPackageLineItems[0].Weight.Units = WeightUnits.LB;
request.RequestedShipment.RequestedPackageLineItems[0].ItemDescription = "Item";
request.RequestedShipment.RequestedPackageLineItems[0].Dimensions = new Dimensions();
request.RequestedShipment.RequestedPackageLineItems[0].Dimensions.Length = "108";
request.RequestedShipment.RequestedPackageLineItems[0].Dimensions.Width = "5";
request.RequestedShipment.RequestedPackageLineItems[0].Dimensions.Height = "5";
request.RequestedShipment.RequestedPackageLineItems[0].Dimensions.Units = LinearUnits.IN;
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences = new CustomerReference[3];
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[0] = new CustomerReference();
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[0].CustomerReferenceType = CustomerReferenceType.CUSTOMER_REFERENCE;
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[0].Value = "[LOT NUMBER]";
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[1] = new CustomerReference();
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[1].CustomerReferenceType = CustomerReferenceType.INVOICE_NUMBER;
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[1].Value = "45646";
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[2] = new CustomerReference();
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[2].CustomerReferenceType = CustomerReferenceType.P_O_NUMBER;
request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[2].Value = "456446";
request.RequestedShipment.RequestedPackageLineItems[1] = new RequestedPackageLineItem();
request.RequestedShipment.RequestedPackageLineItems[1].SequenceNumber = "2";
request.RequestedShipment.RequestedPackageLineItems[1].Weight = new Weight();
request.RequestedShipment.RequestedPackageLineItems[1].Weight.Value = 50.0M;
request.RequestedShipment.RequestedPackageLineItems[1].Weight.Units = WeightUnits.LB;
request.RequestedShipment.RequestedPackageLineItems[1].ItemDescription = "Item";
....
}
Found out how to do this.
In order to get multiple shipping labels into one pdf the process is as follows.
Create a request
Fill in the shipping info
Post and get a reply.
Save that replay and the byte array and MasterShippingID
Create a new request and assign the master shipping id to it.
Added shipping weight and dimensions
Post and get reply
Save byte array with the other
Continue until all shipments are generated (max 200 per master shipping id)
Merge all the pdfs returned from FedEx into one pdf.
Do a happy dance.
A simpler approach, (though there is a cost) is the Shiprush SDK. It lets you build a single XML block and let ShipRush do all the funny stuff with fedex (or whoever).
They also support their tool.

Resources