Example #1
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 #2
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 #3
0
#: :param assay_code: 项目通道号 Required. Length: 10
#: :type assay_code: str
#:
#: :param assay_name: 项目名称(全称) Length: 50
#: :type assay_name: str
#:
#: :param dilution: 稀释倍数(保留) Length: 4
#: :type dilution: integer
#:
#: :param repeat: 重复测试次数(保留) Length: 2
#: :type dilution: integer
#:
Test = Component.build(
    TextField(name='assay_code', required=True, length=10),  #项目通道号
    TextField(name='assay_name', length=50),  #项目名称(全称)
    NotUsedField(name='dilution'),
    NotUsedField(name='repeat'))

#: TestType :class:`~astm.mapping.Component`
#:
#: :param assay_code: 项目通道号 Required. Length: 10
#: :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
Example #4
0
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):
Example #5
0
#: :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
#:
#: :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.
Example #6
0
    user_field_1 = TextField(length=20)
    user_field_2 = TextField(length=1024)


class CommonResult(ResultRecord):
    completed_at = DateTimeField(required=True)
    value = TextField(required=True, length=20)


class CommonComment(CommentRecord):
    ctype = ConstantField(default='G')


QueryRecord = Record.build(ConstantField(name='type', default='Q'),
                           IntegerField(name='seq', default=1),
                           NotUsedField(name='specimen'),
                           NotUsedField(name='range_start'),
                           NotUsedField(name='range_end'),
                           NotUsedField(name='time_limits'),
                           NotUsedField(name='period_start'),
                           NotUsedField(name='period_end'),
                           NotUsedField(name='physician_name'),
                           NotUsedField(name='physician_phone'),
                           NotUsedField(name='user_field_1'),
                           NotUsedField(name='user_field_2'),
                           NotUsedField(name='status_code'))


class Terminator(TerminatorRecord):
    """ASTM terminator record.