Example #1
0
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)
Example #2
0
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')
Example #3
0
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. Always ``P``.
    :type processing_id: str

    :param version: ASTM Version Number. Always ``E 1394-97``.
    :type version: str

    :param timestamp: Date and Time of Message
    :type timestamp: datetime.datetime
    """

    sender = ComponentField(Sender)
    processing_id = ConstantField(default='P')
    version = ConstantField(default='E 1394-97')
Example #4
0
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. Not used.
    :type units: None

    :param references: Reference ranges. Not used.
    :type references: None

    :param abnormal_flag: Result abnormal flag. Not used.
    :type abnormal_flag: None

    :param abnormality_nature: Nature of abnormality testing. Not used.
    :type abnormality_nature: None

    :param status: Result status. Not used.
    :type status: None

    :param normatives_changed_at: Date of changes in instrument normative
                                  values or units. Not used.
    :type normatives_changed_at: None

    :param operator: Operator ID. Not used.
    :type operator: None

    :param started_at: When works on test was started on. Not used.
    :type started_at: None

    :param completed_at: When works on test was done. Required.
    :type completed_at: datetime.datetime

    :param instrument: Instrument ID. Not used.
    :type instrument: None
    """
    test = ComponentField(Test)
Example #5
0
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)
Example #6
0
class Comment(CommonComment):
    """ASTM patient record.

    :param type: Record Type ID. Always ``C``.
    :type type: str

    :param seq: Sequence Number. Required.
    :type seq: int

    :param source: Comment source. Always ``L``.
    :type source: str

    :param data: Measurement value. Numeric, coded or free text value
                  depending on result type. Required. Length: 1024.
    :type data: :class:`CommentData`

    :param ctype: Comment type. Always ``G``.
    :type ctype: str
    """
    source = ConstantField(default='L')
    data = ComponentField(CommentData)
Example #7
0
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)
Example #8
0
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'))
Example #9
0
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'))
Example #10
0
class Header(HeaderRecord):
    sender = ComponentField(Sender)
    processing_id = ConstantField(default='P')
    version = TextField(name='version', default='E 1394-97')
Example #11
0
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)
Example #12
0
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)
Example #13
0
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)