Class: ODDB::OdbaExporter::AcnamLine

Inherits:
PackageLine show all
Defined in:
ext/export/src/oddbdat.rb

Constant Summary collapse

LENGTH =
26

Instance Method Summary collapse

Methods inherited from PackageLine

#initialize

Methods inherited from Line

#content, #empty?, #initialize, #to_s

Constructor Details

This class inherits a constructor from ODDB::OdbaExporter::PackageLine

Instance Method Details

#structureObject



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'ext/export/src/oddbdat.rb', line 391

def structure
	seq = @package.sequence
	galform = if(gf = seq.galenic_forms.first)
		gf.to_s
	end
	conc, unit = if((dose = seq.dose) && dose.is_a?(Quanty))
		[dose.qty, dose.unit]
	end
     measures = @package.parts.collect { |part| part.measure }.compact
	measure, munit = unless(measures.empty?)
                        ms = measures.inject { |a, b| a + b }
                        [ms.qty, ms.unit] if ms.is_a?(Quanty)
                      end
     comform = @package.commercial_forms.first
	qty, qty_unit = if(munit && !munit.empty?)
		[measure, munit]
	else
		[@package.comparable_size.qty, comform]
	end	
	{
		1		=>	'03',
		2		=>	@date,
		3		=>	'1',
		4		=>	@package.oid,
		5		=>	'D',
		6		=>	'4',
		7		=>	seq.name,
		8		=>	seq.name_base,
		9		=>	seq.name_descr,
		11	=>	galform,
		12	=>	conc,
		13	=>	unit,
		16	=>	@package.parts.first ? @package.parts.first.multi : '',
		17	=>	comform,
		18	=>	qty,
		19	=>	qty_unit,
	}
end