class CommonOrder(OrderRecord): biomaterial = TextField(length=20) laboratory_field_2 = TextField(length=12) priority = SetField(default='S', values=('S', 'R')) sample_id = TextField(required=True, length=12) user_field_1 = TextField(length=20) user_field_2 = TextField(length=1024)
class Result(ResultRecord): test = ComponentField(Test) value = TextField(name='value', required=True) units = TextField(name='units') references = TextField(name='references') abnormal_flag = TextField(name='abnormal_flag') status = TextField('status', required=True) completed_at = DateTimeField(name='completed_at', required=True)
class Query(QueryRecord): """ASTM query record. :param type: Record Type ID. Always ``Q``. :type type: str :param seq: Sequence Number. :type seq: int :param specimen: 病人ID及样本条码. :type specimen: class 'Specimen' :param range_start: 样本起始编号 Length: 20 :type range_start: str :param range_end: 样本终止编号 Length: 20 :type range_end: str :param time_limits: 保留 :param period_start: 查询起始时间 Length: 14 :type period_start: datetime :param period_end: 查询截止时间 Length: 14 :type period_end: datetime :param physician_name: 保留 :param physician_phone: 保留 :param user_field_1: 保留 :param user_field_2: 保留 :param status_code: 查询命令码. Length: 1, O:请求样本查询, A: 取消查询 :type status_code: str """ specimen = ComponentField(Specimen) range_start = TextField(length=20) range_end = TextField(length=20) period_start = DateTimeField() period_end = DateTimeField() status_code = TextField(length=1, required=True)
class Comment(CommonComment): """ASTM comment record. :param type: Record Type ID. Always ``C``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param source: Comment source. Always ``I``. :type source: str :param data: free text value. Length: 90. :type data: str :param ctype: 注释类型. Length: 1, G(结果注释)、I(异常字符串) :type ctype: str """ source = ConstantField(default='I') data = TextField(length=90) ctype = SetField(values=('G', 'I'))
class Comment(CommentRecord): data = TextField(name='data', required=True)
class Order(OrderRecord): sample_id = TextField(name='sample_id') test = TextField(name='test') collector = TextField(name='collector') biomaterial = TextField(name='biomaterial')
class Patient(PatientRecord): practice_id = TextField(name='practice_id', required=True) location = TextField(name='location')
class Result(CommonResult): """ASTM patient record. :param type: Record Type ID. Always ``R``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param test: Test information structure (aka Universal Test ID). :type test: :class:`Test` :param value: Measurement value. Numeric, coded or free text value depending on result type. Required. Length: 1024. :type value: None :param units: Units. Length: 20. :type units: str :param references: Normal reference value interval. :type references: str :param abnormal_flag: Result abnormal flag. Possible values: - ``0``: normal result; - ``1``: result out of normal values; - ``2``: result out of attention values; - ``3``: result out of panic values; +10 Delta-check; +1000 Device alarm. Length: 4. :type abnormal_flag: str :param abnormality_nature: Nature of abnormality testing. Possible values: - ``N``: normal value; - ``L``: below low normal range; - ``H``: above high normal range; - ``LL``: below low critical range; - ``HH``: above high critical range. :type abnormality_nature: str :param status: Result status. ``F`` indicates a final result; ``R`` indicating rerun. Length: 1. :type status: str :param normatives_changed_at: Date of changes in instrument normative values or units. Not used. :type normatives_changed_at: None :param operator: Operator ID. :type operator: :class:`Operator` :param started_at: When works on test was started on. :type started_at: datetime.datetime :param completed_at: When works on test was done. :type completed_at: datetime.datetime :param instrument: Instrument ID. Required. :type instrument: :class:`Instrument` """ abnormal_flag = SetField(field=IntegerField(), length=4, values=(0, 1, 2, 3, 10, 11, 12, 13, 1000, 1001, 1002, 1003, 1010, 1011, 1012, 1013)) abnormality_nature = SetField(values=('N', 'L', 'H', 'LL', 'HH')) completed_at = ComponentField(CompletionDate) created_at = DateField() instrument = TextField(length=16) operator = ComponentField(Operator) references = TextField() sampled_at = DateField() started_at = DateTimeField(required=True) status = SetField(values=('F', 'R')) test = ComponentField(Test) units = TextField(length=20)
class Order(CommonOrder): """ASTM order record. :param type: Record Type ID. Always ``O``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param sample_id: 样本ID, Sample information structure :type sample: :class:`Sample` :param instrument: 样本条码, Instrument specimen ID. Length: 29 :type instrument: str :param test: Test information structure (aka Universal Test ID). :type test: :class:`Test` :param priority: Priority flag. Required. Possible values: - ``S``: 急诊; -``R``: 常规. :type priority: str :param created_at: 样本申请时间. :type created_at: datetime.datetime :param sampled_at: 样本采集时间. :type sampled_at: datetime.datetime :param collected_at: Collection end time. Not used. :type collected_at: None :param volume: Collection volume. Not used. :type volume: None :param collector: Collector ID. Not used. :type collector: None :param action_code: 质控液信息; :type action_code: QcInfo :param danger_code: Danger code. Not used. :type danger_code: None :param clinical_info: Revelant clinical info. Not used. :type clinical_info: None :param delivered_at: 送检时间. :type delivered_at: datetime.datetime :param biomaterial: 样本类型,需注意大小写敏感. Length: 20. :type biomaterial: str(serum, urine, plasma, timed, other, blood, amniotic) :param physician: 送检医生. :type physician: :class:`UserName` :param physician_phone: 送检科室 :type physician_phone: str :param user_field_1: Offline dilution factor(保留). Length: 4 :type user_field_1: integer :param user_field_2: 检验医生. :type user_field_2: :class:`UserName` :param laboratory_field_1: Laboratory field #1. Not used. :type laboratory_field_1: None :param laboratory_field_2: Laboratory field #2. Not used. :type laboratory_field_2: None :param modified_at: Date and time of last result modification. Not used. :type modified_at: None :param instrument_charge: Instrument charge to computer system. Not used. :type instrument_charge: None :param instrument_section: Instrument section id. Not used. :type instrument_section: None :param report_type: 报告类型. O(来自LIS的请求)、Q(查询响应)、F(最终的结果)、X(质控:样本被拒绝) :type report_type: str :param reserved: Reserved. Not used. :type reserved: None :param location_ward: Location ward of specimen collection. Not used. :type location_ward: None :param infection_flag: Nosocomial infection flag. Not used. :type infection_flag: None :param specimen_service: Specimen service. Not used. :type specimen_service: None :param laboratory: Production laboratory. Not used. :type laboratory: None """ sample_id = ComponentField(Sample) instrument = TextField(length=29) test = RepeatedComponentField(Test) created_at = DateTimeField() sampled_at = DateTimeField() action_code = ComponentField(QcInfo) physician = ComponentField(UserName) physician_phone = TextField(length=20) user_field_1 = NotUsedField() user_field_2 = ComponentField(UserName) laboratory_field_2 = NotUsedField() report_type = SetField(default='F', values=('O', 'Q', 'F', 'X'))
class Order(CommonOrder): """ASTM order record. :param type: Record Type ID. Always ``O``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param sample_id: Sample ID number. Required. Length: 12. :type sample_id: str :param instrument: Instrument specimen ID. Not used. :type instrument: None :param test: Test information structure (aka Universal Test ID). :type test: :class:`Test` :param priority: Priority flag. Required. Possible values: - ``S``: stat; -``R``: routine. :type priority: str :param created_at: Ordered date and time. Required. :type created_at: datetime.datetime :param sampled_at: Specimen collection date and time. :type sampled_at: datetime.datetime :param collected_at: Collection end time. Not used. :type collected_at: None :param volume: Collection volume. Not used. :type volume: None :param collector: Collector ID. Not used. :type collector: None :param action_code: Action code. Required. Possible values: - ``C``: cancel works for specified tests; - ``A``: add tests to existed specimen; - ``N``: create new order; - ``R``: rerun tests for specified order; :type action_code: str :param danger_code: Danger code. Not used. :type danger_code: None :param clinical_info: Revelant clinical info. Not used. :type clinical_info: None :param delivered_at: Date/time specimen received. :type delivered_at: None :param biomaterial: Sample material code. Length: 20. :type biomaterial: str :param physician: Ordering Physician. Not used. :type physician: None :param physician_phone: Physician's phone number. Not used. :type physician_phone: None :param user_field_1: An optional field, it will be send back unchanged to the host along with the result. Length: 20. :type user_field_1: str :param user_field_2: An optional field, it will be send back unchanged to the host along with the result. Length: 1024. :type user_field_2: str :param laboratory_field_1: In multi-laboratory environment it will be used to indicate which laboratory entering the order. Length: 20. :type laboratory_field_1: str :param laboratory_field_2: Primary tube code. Length: 12. :type laboratory_field_2: str :param modified_at: Date and time of last result modification. Not used. :type modified_at: None :param instrument_charge: Instrument charge to computer system. Not used. :type instrument_charge: None :param instrument_section: Instrument section id. Not used. :type instrument_section: None :param report_type: Report type. Always ``O`` which means normal order request. :type report_type: str :param reserved: Reserved. Not used. :type reserved: None :param location_ward: Location ward of specimen collection. Not used. :type location_ward: None :param infection_flag: Nosocomial infection flag. Not used. :type infection_flag: None :param specimen_service: Specimen service. Not used. :type specimen_service: None :param laboratory: Production laboratory: in multi-laboratory environment indicates laboratory expected to process the order. Length: 20. :type laboratory: str """ action_code = SetField(default='N', values=('C', 'A', 'N', 'R')) created_at = DateTimeField(required=True) laboratory = TextField(length=20) laboratory_field_1 = TextField(length=20) report_type = ConstantField(default='O') sampled_at = DateTimeField() test = RepeatedComponentField(Test)
#: :type __: None #: #: :param ___: Reserved. Not used. #: :type ___: None #: #: :param assay_code: Assay code. Required. Length: 20. #: :type assay_code: str #: #: :param assay_name: Assay name. Length: 8. #: :type assay_name: str #: Test = Component.build( NotUsedField(name='_'), NotUsedField(name='__'), NotUsedField(name='___'), TextField(name='assay_code', required=True, length=20), TextField(name='assay_name', length=8), ) #: Comment control data structure. #: CommentData = Component.build( SetField(name='code', values=('PC', 'RC', 'SC', 'TC')), TextField(name='value')) class Patient(CommonPatient): """ASTM patient record. :param type: Record Type ID. Always ``P``. :type type: str
class CommonResult(ResultRecord): completed_at = DateTimeField(required=True) value = TextField(required=True, length=20)
from astm import __version__ from astm.mapping import (Component, ConstantField, ComponentField, DateField, DateTimeField, IntegerField, SetField, TextField) from astm.records import (HeaderRecord, PatientRecord, OrderRecord, ResultRecord, CommentRecord, TerminatorRecord) #: Information about sender. #: #: :param name: Name. #: :type name: str #: #: :param version: Sender software version. #: :type version: str #: Sender = Component.build(TextField(name='name', default='python-astm'), TextField(name='version', default=__version__)) #: Patient name structure. #: #: :param last: Last name. Length: 50. #: :type last: str #: #: :param first: First name. Length: 50. #: :type first: str #: PatientName = Component.build(TextField(name='last', length=50), TextField(name='first', length=50)) class Header(HeaderRecord):
from astm.mapping import (Component, ConstantField, ComponentField, DateField, DateTimeField, IntegerField, SetField, TextField, NotUsedField, Record) from astm.records import (HeaderRecord, PatientRecord, OrderRecord, ResultRecord, CommentRecord, TerminatorRecord) #: Information about sender. #: #: :param name: Name. #: :type name: str #: #: :param version: Sender software version. #: :type version: str #: Sender = Component.build( TextField(name='name', default='lianyang-LIS', length=40), TextField(name='version', default=__version__, length=20), TextField(name='serial', length=20)) #: Patient name structure. #: #: :param last: Last name. Length: 50. #: :type last: str #: #: :param first: First name. Length: 50. #: :type first: str #: PatientName = Component.build(TextField(name='last', length=50), TextField(name='first', length=50)) #: User name structure.
__all__ = [ 'RecordsDispatcher', 'Header', 'Patient', 'Order', 'Result', 'Query', 'Terminator', 'Instrument', 'Test', 'Specimen', 'TestType', 'Sample', 'QcInfo', 'ResultValue', 'ResultRange' ] #: Specimen information structure. #: #: :param patient_id: 病人ID. Length: 30 #: :type patient_id: str #: #: :param barcode: 样本条码. Length: 27 #: :type barcode: str #: Specimen = Component.build(TextField(name='patient_id', length=30), TextField(name='barcode', length=27)) #: Instrument (analyser) information structure. #: #: :param name: 消息发送者. Length: 16 #: :type name: str #: #: :param device_id: 设备ID. Length: 10 #: :type device_id: integer #: Instrument = Component.build(TextField(name='name', length=16), IntegerField(name='device_id', length=10)) #: Test :class:`~astm.mapping.Component` #:
class Patient(CommonPatient): """ASTM patient record. :param type: Record Type ID. Always ``P``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param practice_id: Practice Assigned Patient ID. (保留) :type practice_id: None :param laboratory_id: 病人ID. Required. Length: 30 :type laboratory_id: str :param id: Patient ID. Not used. :type id: None :param name: Patient name. Required :type name: :class:`UserName` :param maiden_name: Mother’s Maiden Name. Not used. :type maiden_name: None :param birthdate: Birthdate. :type birthdate: PatientBirthAge :param sex: Patient Sex. One of: ``M`` (male), ``F`` (female), ``I`` (animal), ``U`` is unknown. :type sex: str :param race: Patient Race-Ethnic Origin. Not used. :type race: None :param address: 送检科室. Length: 20 :type address: str :param reserved: Reserved Field. Not used. :type reserved: None :param phone: Patient Telephone Number. Not used. :type phone: None :param physician_id: Attending Physician. Not used. :type physician_id: None :param special_1: Special Field #1. Not used. :type special_1: None :param special_2: Patient source. (保留) :type special_2: None :param height: Patient Height. Not used. :type height: None :param weight: Patient Weight. Not used. :type weight: None :param diagnosis: 临床诊断. Length: 50 :type diagnosis: str :param medications: Patient’s Active Medications. Not used. :type medications: None :param diet: Patient’s Diet. Not used. :type diet: None :param practice_1: Practice Field No. 1. Not used. :type practice_1: None :param practice_2: Practice Field No. 2. Not used. :type practice_2: None :param admission_date: Admission/Discharge Dates. Not used. :type admission_date: None :param admission_status: Admission Status. Not used. :type admission_status: None :param location: Patient location. (保留) :type location: None :param diagnostic_code_nature: Nature of diagnostic code. Not used. :type diagnostic_code_nature: None :param diagnostic_code: Diagnostic code. Not used. :type diagnostic_code: None :param religion: Patient religion. Not used. :type religion: None :param martial_status: Martian status. Not used. :type martial_status: None :param isolation_status: Isolation status. Not used. :type isolation_status: None :param language: Language. Not used. :type language: None :param hospital_service: Hospital service. Not used. :type hospital_service: None :param hospital_institution: Hospital institution. Not used. :type hospital_institution: None :param dosage_category: Dosage category. Not used. :type dosage_category: None """ practice_id = NotUsedField() laboratory_id = TextField(length=30) name = ComponentField(UserName) birthdate = ComponentField(PatientBirthAge) address = TextField(length=20) special_2 = NotUsedField() diagnosis = TextField(length=50) location = NotUsedField() sex = SetField(default='U', values=('M', 'F', 'U', 'I'))
class Patient(CommonPatient): """ASTM patient record. :param type: Record Type ID. Always ``P``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param practice_id: Practice Assigned Patient ID. Required. Length: 12. :type practice_id: str :param laboratory_id: Laboratory Assigned Patient ID. Required. Length: 16. :type laboratory_id: str :param id: Patient ID. Not used. :type id: None :param name: Patient name. :type name: :class:`PatientName` :param maiden_name: Mother’s Maiden Name. Not used. :type maiden_name: None :param birthdate: Birthdate. :type birthdate: datetime.date :param sex: Patient Sex. One of: ``M`` (male), ``F`` (female), ``I`` (animal), ``None`` is unknown. :type sex: str :param race: Patient Race-Ethnic Origin. Not used. :type race: None :param address: Patient Address. Not used. :type address: None :param reserved: Reserved Field. Not used. :type reserved: None :param phone: Patient Telephone Number. Not used. :type phone: None :param physician_id: Attending Physician. Not used. :type physician_id: None :param special_1: Special Field #1. Not used. :type special_1: None :param special_2: Patient source. Possible values: - ``0``: internal patient; - ``1``: external patient. :type special_2: int :param height: Patient Height. Not used. :type height: None :param weight: Patient Weight. Not used. :type weight: None :param diagnosis: Patient’s Known Diagnosis. Not used. :type diagnosis: None :param medications: Patient’s Active Medications. Not used. :type medications: None :param diet: Patient’s Diet. Not used. :type diet: None :param practice_1: Practice Field No. 1. Not used. :type practice_1: None :param practice_2: Practice Field No. 2. Not used. :type practice_2: None :param admission_date: Admission/Discharge Dates. Not used. :type admission_date: None :param admission_status: Admission Status. Not used. :type admission_status: None :param location: Patient location. Length: 20. :type location: str :param diagnostic_code_nature: Nature of diagnostic code. Not used. :type diagnostic_code_nature: None :param diagnostic_code: Diagnostic code. Not used. :type diagnostic_code: None :param religion: Patient religion. Not used. :type religion: None :param martial_status: Martian status. Not used. :type martial_status: None :param isolation_status: Isolation status. Not used. :type isolation_status: None :param language: Language. Not used. :type language: None :param hospital_service: Hospital service. Not used. :type hospital_service: None :param hospital_institution: Hospital institution. Not used. :type hospital_institution: None :param dosage_category: Dosage category. Not used. :type dosage_category: None """ physician_id = TextField(length=35) special_1 = ComponentField(PatientAge)
class Result(CommonResult): """ASTM result record. :param type: Record Type ID. Always ``R``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param test: Test information structure :type test: :class:`TestType` :param value: Measurement value. :type value: class: 'ResultValue' :param units: Units. Length: 12 :type units: str :param references: Normal reference value interval. :type references: class 'ResultRange' :param abnormal_flag: Result abnormal flag. Possible values: - ``L``: ( 结果 < 参考范围 ); - ``H``: ( 结果 > 参考范围 ); - ``N``: ( 正常 ); Length: 1. :type abnormal_flag: str :param abnormality_nature: Nature of abnormality testing. Length: 10 :type abnormality_nature: str :param status: Result status. ``F`` indicates a final result; ``R`` indicating rerun. Length: 1. :type status: str :param normatives_changed_at: 原始测试结果 :type normatives_changed_at: class 'ResultRange' :param operator: 重测结果标记. Length: 1, 1(重测结果)、0(非重测结果) :type operator: integer :param started_at: When works on test was started on. :type started_at: datetime.datetime :param completed_at: When works on test was done. :type completed_at: datetime.datetime :param instrument: Instrument ID. Required. :type instrument: :class:`Instrument` """ test = ComponentField(TestType) value = ComponentField(ResultValue) units = TextField(length=12) references = ComponentField(ResultRange) abnormal_flag = SetField(values=('N', 'L', 'H')) abnormality_nature = TextField(length=10) status = SetField(values=('F', 'R')) normatives_changed_at = ComponentField(ResultValue) operator = SetField(values=(0, 1)) started_at = DateTimeField() completed_at = DateTimeField() instrument = ComponentField(Instrument)
from astm.mapping import (Component, ConstantField, ComponentField, DateField, DateTimeField, IntegerField, SetField, TextField, NotUsedField) from astm.records import (HeaderRecord, PatientRecord, OrderRecord, ResultRecord, CommentRecord, TerminatorRecord) Sender = Component.build(TextField(name='name'), TextField(name='version')) Test = Component.build(NotUsedField(name='_'), NotUsedField(name='__'), NotUsedField(name='___'), TextField(name='analyte_name', required=True)) class Header(HeaderRecord): sender = ComponentField(Sender) processing_id = ConstantField(default='P') version = TextField(name='version', default='E 1394-97') class Patient(PatientRecord): practice_id = TextField(name='practice_id', required=True) location = TextField(name='location') class Order(OrderRecord): sample_id = TextField(name='sample_id') test = TextField(name='test') collector = TextField(name='collector') biomaterial = TextField(name='biomaterial') class Comment(CommentRecord):
class Header(HeaderRecord): sender = ComponentField(Sender) processing_id = ConstantField(default='P') version = TextField(name='version', default='E 1394-97')
'CommentData', 'CompletionDate', 'Instrument', 'Operator', 'Sender', 'Test' ] #: Instrument (analyser) information structure. #: #: :param _: Reserved. Not used. #: :type _: None #: #: :param rack: Rack number. Length: 5. #: :type rack: str #: #: :param position: Position number. Length: 3. #: :type position: str #: Instrument = Component.build( TextField(name='_'), TextField(name='rack', length=5), TextField(name='position', length=3), ) #: Test :class:`~astm.mapping.Component` also known as Universal Test ID. #: #: :param _: Reserved. Not used. #: :type _: None #: #: :param __: Reserved. Not used. #: :type __: None #: #: :param ___: Reserved. Not used. #: :type ___: None #: