/*
 * Copyright (c) 1995, 1996 Gunther Schadow.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

% The HL-7 prolog database
%
% 
%
:- module(hl7, []).
:- package(hl7, 'v2.2').

:- use_package(protogen).

%
% MULTI PROTOCOL MANAGEMENT DATA
%
header_segment(msh).
special_segment(msh).
special_segment(fhs).
special_segment(bhs).

%
% COMPOSITE DATA TYPES
%

ctyp_imp(ad,
	[[st,'street address'],
	[st,'other destination'],
	[st,city],
	[st,'state or province'],
	[st,zip],
	[st,country],
	[code(190),type]]).

ctyp_imp(cm,
	[[st,'component 1'],
	[st,'component 2'],
	[st,'component 3'],
	[st,'component 4'],
	[st,'component 5'],
	[st,'component 6'],
	[st,'component 7'],
	[st,'component 8']]).

ctyp_imp(ce,
	[[id,'identifier'],
	[st,'text'],
	[id,'coding system'],
	[id,'alternate identifier'],
	[st,'alternate text'],
	[id,'alternate coding system']]).

ctyp_imp(cf,
	[[id,'identifier'],
	[st,'formatted text'],
	[id,'coding system'],
	[id,'alternate identifier'],
	[st,'alternate fromatted text'],
	[id,'alternate coding system']]).

ctyp_imp(ck,
	[[id,'id number'],
	[nm,'check digit'],
	[code(61),'check digit scheme'],
	[id,'assigning facility']]).

ctyp_imp(cn,
	[[id,'id number'],
	[st,'family name'],
	[st,'given name'],
	[st,'middle initial or name'],
	[st,suffix],
	[st,prefix],
	[st,degree],
	[id,'source table']]).

ctyp_imp(rp,
	[[st,pointer],
	[id,'application id'],
	[id,'type']]).

ctyp_imp(mo,
	[[nm,'quantity'],
	[id,'denomination']]).

ctyp_imp(tq,
	[[cq,quantity],
	[cm,interval],
	[id,duration],
	[ts,'start date/time'],
	[ts,'end date/time'],
	[id,priority],
	[st,condition],
	[tx,text],
	[id,conjunction],
	[cm,'order sequencing']]).

ctyp_imp(zl,
	[[id,'nurse unit'],
	[id,'room'],
	[id,'bed'],
	[id,'facility id'],
	[id,'bed status']]).

ctyp_imp(ze,
	[[st,'segment id'],
	[nm,'sequence'],
	[nm,'field position'],
	[ce,'code identifying error'],
	[st,'full path']]). % `full path' is an extension by ProtoGen/HL7

%
% AND ALL THE OTHER THINGS
%
