// for explanation of types, see
// https://docs.google.com/spreadsheets/d/1qwfw1AOED7WiElOCJwt_VHo_JaDhr6ZIiJMqjRCXajQ/edit#gid=1797422705
"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get ACTION_DATA_ELEMENT_TYPES () {
        return ACTION_DATA_ELEMENT_TYPES;
    },
    get BLOOD_PRESSURE () {
        return BLOOD_PRESSURE;
    },
    get CHARTING_CORE_TYPE_TO_ID () {
        return CHARTING_CORE_TYPE_TO_ID;
    },
    get CHARTING_DATA_ELEMENT_IDS () {
        return CHARTING_DATA_ELEMENT_IDS;
    },
    get CHARTING_SURVEY_TYPES () {
        return CHARTING_SURVEY_TYPES;
    },
    get COMPLEX_CORE_DATA_ELEMENT_TYPES () {
        return COMPLEX_CORE_DATA_ELEMENT_TYPES;
    },
    get LINE () {
        return LINE;
    },
    get NON_ANSWERABLE_DATA_ELEMENT_TYPES () {
        return NON_ANSWERABLE_DATA_ELEMENT_TYPES;
    },
    get PATIENT_DATA_FIELD_LOCATIONS () {
        return PATIENT_DATA_FIELD_LOCATIONS;
    },
    get PORTAL_SURVEY_ASSIGNMENTS_STATUSES () {
        return PORTAL_SURVEY_ASSIGNMENTS_STATUSES;
    },
    get PROGRAM_DATA_ELEMENT_TYPES () {
        return PROGRAM_DATA_ELEMENT_TYPES;
    },
    get PROGRAM_DATA_ELEMENT_TYPE_VALUES () {
        return PROGRAM_DATA_ELEMENT_TYPE_VALUES;
    },
    get PROGRAM_REGISTRY_FIELD_LOCATIONS () {
        return PROGRAM_REGISTRY_FIELD_LOCATIONS;
    },
    get READONLY_DATA_FIELDS () {
        return READONLY_DATA_FIELDS;
    },
    get RESULT_COLORS () {
        return RESULT_COLORS;
    },
    get SURVEY_TYPES () {
        return SURVEY_TYPES;
    },
    get VITALS_DATA_ELEMENT_IDS () {
        return VITALS_DATA_ELEMENT_IDS;
    },
    get VITAL_CHARTS () {
        return VITAL_CHARTS;
    }
});
const _patientFields = require("./patientFields");
const _programRegistry = require("./programRegistry");
const PROGRAM_DATA_ELEMENT_TYPES = {
    TEXT: 'FreeText',
    MULTILINE: 'Multiline',
    RADIO: 'Radio',
    SELECT: 'Select',
    MULTI_SELECT: 'MultiSelect',
    AUTOCOMPLETE: 'Autocomplete',
    DATE: 'Date',
    DATE_TIME: 'DateTime',
    SUBMISSION_DATE: 'SubmissionDate',
    INSTRUCTION: 'Instruction',
    NUMBER: 'Number',
    BINARY: 'Binary',
    CHECKBOX: 'Checkbox',
    CALCULATED: 'CalculatedQuestion',
    CONDITION: 'ConditionQuestion',
    RESULT: 'Result',
    SURVEY_ANSWER: 'SurveyAnswer',
    SURVEY_RESULT: 'SurveyResult',
    SURVEY_LINK: 'SurveyLink',
    PHOTO: 'Photo',
    PATIENT_DATA: 'PatientData',
    USER_DATA: 'UserData',
    PATIENT_ISSUE: 'PatientIssue',
    GEOLOCATE: 'Geolocate',
    COMPLEX_CHART_INSTANCE_NAME: 'ComplexChartInstanceName',
    COMPLEX_CHART_DATE: 'ComplexChartDate',
    COMPLEX_CHART_TYPE: 'ComplexChartType',
    COMPLEX_CHART_SUBTYPE: 'ComplexChartSubtype'
};
const PROGRAM_DATA_ELEMENT_TYPE_VALUES = Object.values(PROGRAM_DATA_ELEMENT_TYPES);
const COMPLEX_CORE_DATA_ELEMENT_TYPES = [
    PROGRAM_DATA_ELEMENT_TYPES.COMPLEX_CHART_INSTANCE_NAME,
    PROGRAM_DATA_ELEMENT_TYPES.COMPLEX_CHART_DATE,
    PROGRAM_DATA_ELEMENT_TYPES.COMPLEX_CHART_TYPE,
    PROGRAM_DATA_ELEMENT_TYPES.COMPLEX_CHART_SUBTYPE
];
const NON_ANSWERABLE_DATA_ELEMENT_TYPES = [
    PROGRAM_DATA_ELEMENT_TYPES.INSTRUCTION,
    PROGRAM_DATA_ELEMENT_TYPES.RESULT
];
const ACTION_DATA_ELEMENT_TYPES = [
    PROGRAM_DATA_ELEMENT_TYPES.PATIENT_ISSUE,
    PROGRAM_DATA_ELEMENT_TYPES.PATIENT_DATA
];
const SURVEY_TYPES = {
    PROGRAMS: 'programs',
    REFERRAL: 'referral',
    OBSOLETE: 'obsolete',
    VITALS: 'vitals',
    SIMPLE_CHART: 'simpleChart',
    COMPLEX_CHART: 'complexChart',
    COMPLEX_CHART_CORE: 'complexChartCore'
};
const CHARTING_SURVEY_TYPES = [
    SURVEY_TYPES.SIMPLE_CHART,
    SURVEY_TYPES.COMPLEX_CHART,
    SURVEY_TYPES.COMPLEX_CHART_CORE
];
const PDE_DATE_RECORDED = 'pde-PatientVitalsDate';
const PDE_TEMPERATURE = 'pde-PatientVitalsTemperature';
const PDE_WEIGHT = 'pde-PatientVitalsWeight';
const PDE_HEIGHT = 'pde-PatientVitalsHeight';
const PDE_SBP = 'pde-PatientVitalsSBP';
const PDE_DBP = 'pde-PatientVitalsDBP';
const PDE_HEART_RATE = 'pde-PatientVitalsHeartRate';
const PDE_RESPIRATORY_RATE = 'pde-PatientVitalsRespiratoryRate';
const PDE_SPO2 = 'pde-PatientVitalsSPO2';
const PDE_AVPU = 'pde-PatientVitalsAVPU';
const VITALS_DATA_ELEMENT_IDS = {
    dateRecorded: PDE_DATE_RECORDED,
    temperature: PDE_TEMPERATURE,
    weight: PDE_WEIGHT,
    height: PDE_HEIGHT,
    sbp: PDE_SBP,
    dbp: PDE_DBP,
    heartRate: PDE_HEART_RATE,
    respiratoryRate: PDE_RESPIRATORY_RATE,
    spo2: PDE_SPO2,
    avpu: PDE_AVPU
};
const CHARTING_DATA_ELEMENT_IDS = {
    dateRecorded: 'pde-PatientChartingDate',
    complexChartInstanceName: 'pde-ComplexChartInstanceName',
    complexChartDate: 'pde-ComplexChartDate',
    complexChartType: 'pde-ComplexChartType',
    complexChartSubtype: 'pde-ComplexChartSubtype'
};
const CHARTING_CORE_TYPE_TO_ID = {
    [PROGRAM_DATA_ELEMENT_TYPES.COMPLEX_CHART_INSTANCE_NAME]: CHARTING_DATA_ELEMENT_IDS.complexChartInstanceName,
    [PROGRAM_DATA_ELEMENT_TYPES.COMPLEX_CHART_DATE]: CHARTING_DATA_ELEMENT_IDS.complexChartDate,
    [PROGRAM_DATA_ELEMENT_TYPES.COMPLEX_CHART_TYPE]: CHARTING_DATA_ELEMENT_IDS.complexChartType,
    [PROGRAM_DATA_ELEMENT_TYPES.COMPLEX_CHART_SUBTYPE]: CHARTING_DATA_ELEMENT_IDS.complexChartSubtype
};
const BLOOD_PRESSURE = 'BLOOD_PRESSURE';
const LINE = 'LINE';
const VITAL_CHARTS = {
    [PDE_TEMPERATURE]: LINE,
    [PDE_WEIGHT]: LINE,
    [PDE_HEIGHT]: LINE,
    [PDE_SBP]: BLOOD_PRESSURE,
    [PDE_DBP]: BLOOD_PRESSURE,
    [PDE_HEART_RATE]: LINE,
    [PDE_RESPIRATORY_RATE]: LINE,
    [PDE_SPO2]: LINE,
    [PDE_AVPU]: LINE
};
// utility function for when a model's fields are all a direct match for their survey configs
const makeLookupFields = (model, fields)=>Object.fromEntries(fields.map((f)=>[
            Array.isArray(f) ? f[0] : f,
            [
                model,
                ...Array.isArray(f) ? f : [
                    f
                ]
            ]
        ]));
const PATIENT_DATA_FIELD_LOCATIONS = {
    registrationClinicalStatus: [
        'PatientProgramRegistration',
        'clinicalStatusId'
    ],
    programRegistrationStatus: [
        'PatientProgramRegistration',
        'registrationStatus',
        _programRegistry.PROGRAM_REGISTRATION_STATUS_LABELS
    ],
    registrationClinician: [
        'PatientProgramRegistration',
        'clinicianId'
    ],
    registeringFacility: [
        'PatientProgramRegistration',
        'registeringFacilityId'
    ],
    registrationCurrentlyAtVillage: [
        'PatientProgramRegistration',
        'villageId'
    ],
    registrationCurrentlyAtFacility: [
        'PatientProgramRegistration',
        'facilityId'
    ],
    ...makeLookupFields('Patient', [
        'firstName',
        'middleName',
        'lastName',
        'culturalName',
        'dateOfBirth',
        'dateOfDeath',
        [
            'sex',
            _patientFields.SEX_LABELS
        ],
        'email',
        'villageId'
    ]),
    ...makeLookupFields('PatientAdditionalData', [
        'placeOfBirth',
        [
            'bloodType',
            _patientFields.BLOOD_LABELS
        ],
        'primaryContactNumber',
        'secondaryContactNumber',
        [
            'maritalStatus',
            _patientFields.MARITAL_STATUS_LABELS
        ],
        'cityTown',
        'streetVillage',
        [
            'educationalLevel',
            _patientFields.EDUCATIONAL_ATTAINMENT_LABELS
        ],
        [
            'socialMedia',
            _patientFields.SOCIAL_MEDIA_LABELS
        ],
        [
            'title',
            _patientFields.TITLE_LABELS
        ],
        'birthCertificate',
        'drivingLicense',
        'passport',
        'emergencyContactName',
        'emergencyContactNumber',
        'registeredById',
        'motherId',
        'fatherId',
        'nationalityId',
        'countryId',
        'divisionId',
        'subdivisionId',
        'medicalAreaId',
        'nursingZoneId',
        'settlementId',
        'ethnicityId',
        'occupationId',
        'religionId',
        'patientBillingTypeId',
        'countryOfBirthId'
    ])
};
const READONLY_DATA_FIELDS = {
    AGE: 'age',
    AGE_WITH_MONTHS: 'ageWithMonths',
    FULL_NAME: 'fullName'
};
const PROGRAM_REGISTRY_FIELD_LOCATIONS = Object.keys(PATIENT_DATA_FIELD_LOCATIONS).filter((key)=>PATIENT_DATA_FIELD_LOCATIONS[key][0] === 'PatientProgramRegistration');
const RESULT_COLORS = {
    green: '#83d452',
    yellow: '#ffea5a',
    orange: '#fe8c00',
    red: '#ff2222',
    deepred: '#971a1a',
    purple: '#971a1a'
};
const PORTAL_SURVEY_ASSIGNMENTS_STATUSES = {
    OUTSTANDING: 'outstanding',
    COMPLETED: 'completed',
    CANCELLED: 'cancelled'
};

//# sourceMappingURL=surveys.js.map