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 Terminator(TerminatorRecord): """ASTM terminator record. :param type: Record Type ID. Always ``L``. :type type: str :param seq: Sequential number. Always ``1``. :type seq: int :param code: Termination code. 'N':正常结束、'I':查询无更新、'Q':查询错误 :type code: str """ code = SetField(default='N', values=('N', 'I', 'Q'))
class Header(HeaderRecord): """ASTM header record. :param type: Record Type ID. Always ``H``. :type type: str :param delimeter: Delimiter Definition. Always ``\^&``. :type delimeter: str :param message_id: Message Control ID. Not used. :type message_id: None :param password: Access Password. Not used. :type password: None :param sender: Information about sender. Optional. :type sender: :class:`Sender` :param address: Sender Street Address. Not used. :type address: None :param reserved: Reserved Field. Not used. :type reserved: None :param phone: Sender Telephone Number. Not used. :type phone: None :param chars: Sender Characteristics. Not used. :type chars: None :param receiver: Information about receiver. Not used. :type receiver: None :param comments: Comments. Not used. :type comments: None :param processing_id: Processing ID. PR:(病人测试结果),QR:(质控测试结果),CR(定标结果),RQ(样本请求查询),QA(样本查询回应),SA(样本申请信息) :type processing_id: str :param version: ASTM Version Number. Always ``1394-97``. :type version: str :param timestamp: Date and Time of Message :type timestamp: datetime.datetime """ sender = ComponentField(Sender) processing_id = SetField(default='SA', values=('PR', 'QR', 'CR', 'RQ', 'QA', 'SA')) version = ConstantField(default='1394-97')
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 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)
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 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'))
#: :type assay_code: str #: #: :param assay_name: 项目名称(全称) Length: 50 #: :type assay_name: str #: #: :param replicate: 结果重复次数编号(保留) Length: 2 #: :type dilution: integer #: #: :param result_type: 结果类型 Length: 1, I(定性结果)、F(定量结果) #: :type dilution: integer #: TestType = Component.build( TextField(name='assay_code', required=True, length=10), #项目通道号 TextField(name='assay_name', length=50), #项目名称(全称) NotUsedField(name='replicate'), SetField(name='result_type', values=('I', 'F'))) #: Sample :class:`~astm.mapping.Component`. #: #: :param sample_id: 样本ID (如空为质控). Length: 10 #: :type assay_code: str #: #: :param tray_no: (保留) Length: 2 #: :type assay_name: integer #: #: :param position: (保留) Length: 2 #: :type dilution: integer #: Sample = Component.build(TextField(name='sample_id', length=10), NotUsedField(name='tray_no'), NotUsedField(name='position'))
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)
__all__ = [ 'Header', 'Patient', 'Order', 'Result', 'Comment', 'Terminator', 'CommentData', 'PatientAge', 'Sender', 'Test' ] #: Patient age structure. #: #: :param value: Age value. #: :type value: int #: #: :param unit: Age unit. One of: ``years``, ``months``, ``days``. #: :type unit: str #: PatientAge = Component.build( IntegerField(name='value'), SetField(name='unit', values=('years', 'months', 'days'))) #: 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 #: #: :param assay_code: Assay code. Required. Length: 20. #: :type assay_code: str #:
class CommonPatient(PatientRecord): """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 """ birthdate = DateField() laboratory_id = TextField(required=True, length=16) location = TextField(length=20) name = ComponentField(PatientName) practice_id = TextField(required=True, length=12) sex = SetField(values=('M', 'F', None, 'I')) special_2 = SetField(values=(0, 1), field=IntegerField())
) #: Patient birth & age structure. #: #: :param birth: Birthday. #: :type age: Date #: #: :param age: Age value. #: :type age: int #: #: :param unit: Age unit. One of: ``Y``, ``M``, ``D``, ``H``. #: :type unit: str #: PatientBirthAge = Component.build( DateField(name='birth'), IntegerField(name='age'), SetField(name='unit', default='Y', values=('Y', 'M', 'D', 'H'))) class Header(HeaderRecord): """ASTM header record. :param type: Record Type ID. Always ``H``. :type type: str :param delimeter: Delimiter Definition. Always ``\^&``. :type delimeter: str :param message_id: Message Control ID. Not used. :type message_id: None :param password: Access Password. Not used.
#: #: :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 :param seq: Sequence Number. Required. :type seq: int :param practice_id: Practice Assigned Patient ID. Required. Length: 12. :type practice_id: str
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: Sample ID number. Required. Length: 12. :type sample_id: str :param instrument: Instrument specimen ID. :type instrument: :class:`Instrument` :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: - :const:`None`: normal order result; - ``Q``: quality control; :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: Laboratory field #1. Not used. :type laboratory_field_1: None :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 ``F`` which means final 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. Not used. :type laboratory: None """ action_code = SetField(values=(None, 'Q')) instrument = ComponentField(Instrument) report_type = ConstantField(default='F') test = ComponentField(Test)
#: :param control_lot: Control lot number. Length: 25. #: :type control_lot: str #: #: :param type: Result type value. One of: ``CE``, ``TX``. #: :type type: str #: Test = Component.build(NotUsedField(name='_'), NotUsedField(name='__'), NotUsedField(name='___'), TextField(name='assay_code', required=True, length=20), TextField(name='assay_name', length=8), TextField(name='dilution', length=10), TextField(name='status', length=1), TextField(name='reagent_lot', length=15), TextField(name='reagent_number', length=5), TextField(name='control_lot', length=25), SetField(name='type', values=('CE', 'TX'))) #: Information about operator that validated results. #: #: :param code_on_labonline: Operator code on LabOnline. Length: 12. #: :type code_on_labonline: str #: #: :param code_on_analyzer: Operator code on analyser. Length: 20. #: :type code_on_analyzer: str #: Operator = Component.build( TextField(name='code_on_labonline', length=12), TextField(name='code_on_analyzer', length=20), ) #: Completion date time information.