Пример #1
0
    def wrap(cls, data):

        if cls is PatientFinder:
            return {
                sub._doc_type: sub for sub in recurse_subclasses(cls)
            }[data['doc_type']].wrap(data)
        else:
            return super(PatientFinder, cls).wrap(data)
Пример #2
0
    def wrap(cls, data):
        if 'create_missing' in data and isinstance(data['create_missing'], bool):
            data['create_missing'] = {
                'external_data_type': OPENMRS_DATA_TYPE_BOOLEAN,
                'value': str(data['create_missing'])
            }

        if cls is PatientFinder:
            subclass = {
                sub._doc_type: sub for sub in recurse_subclasses(cls)
            }.get(data['doc_type'])
            return subclass.wrap(data) if subclass else None
        else:
            return super(PatientFinder, cls).wrap(data)
Пример #3
0
    def wrap(cls, data):

        if 'create_missing' in data and data['create_missing'] in (True, False):
            data['create_missing'] = {
                'doc_type': 'ConstantString',
                'external_data_type': OPENMRS_DATA_TYPE_BOOLEAN,
                'value': six.text_type(data['create_missing'])
            }

        if cls is PatientFinder:
            return {
                sub._doc_type: sub for sub in recurse_subclasses(cls)
            }[data['doc_type']].wrap(data)
        else:
            return super(PatientFinder, cls).wrap(data)