function translateLabsFhir(chcsLabResultObjectModified, _options, prefix) {
    // Assign the default options, then override what the caller wants. At the end you have the right options.
    var options = {
        warnings: false,
        policy: false,
        eat: true
    };
    for (k in _options) {
        if (_options.hasOwnProperty(k)) options[k] = _options[k];
    }


    var participatingProperties = []; // no participants yet
    var warnings = []; // no warnings yet

    // Create a fetcher for chcsLabResultObject. The fetcher will get data values from
    // input chcsLabResultObject, remembering those that actually have values in list participating_properties.
    // var fetch1 = fdt.peek(chcsLabResultObjectModified, participatingProperties);
    var peek = fdt.peek(chcsLabResultObjectModified, participatingProperties);
    var eat = fdt.eat(chcsLabResultObjectModified, participatingProperties);
    eat('$.type');
    // fetch1(json_pattern[, transformation])

    var identifier = eat('$.type', function (t) { return [ fdt.fhirIdentifier(t) ]; }); // Identifier Id for external references to this report
    var patient = chcsLabResultObjectModified['patient-63'];

    // "internal" conversion functions, if a key is present then its values are an array of
    // tests of that type.

    // "micro_conversion_flag-63"
    function micro_conversion(mc) {
    }

    // "blood_bank-63"
    function blood_bank(bb) {
    }

    // "clinical_chemistry-63"
    function clinical_chemistry(cc) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['ch'], text: "Chemistry"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: patient, // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [cc] // Attachment , Entire report as issued
        });
    }

    // "parasitology_buffer-63", https://en.wikipedia.org/wiki/Parasitology
    function parasitology_buffer(pb) {
        // details tbs
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['par'], text: "Parasitology"}, // deprecated, CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: rdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [pb] // Attachment , Entire report as issued
        });
    }

    // "bacteriology_buffer-63"
    function bacteriology_buffer(bb) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['oth'], text: "Other"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [bb] // Attachment , Entire report as issued
        });

    }

    // "mycobacterium_buffer-63"
    function mycobacterium_buffer(mb) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['mcb'], text: "Mycobacteriology"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [mb] // Attachment , Entire report as issued
        });

    }

    // "mycology_buffer-63"
    function mycology_buffer(mb) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['myc'], text: "Mycology"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [mb] // Attachment , Entire report as issued
        });

    }


    // "virology_buffer-63"
    function virology_buffer(vb) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['vr'], text: "Virology"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [vb] // Attachment , Entire report as issued
        });

    }


    // "delta_check-63", http://www.medilexicon.com/medicaldictionary.php?t=23464
    function delta_check(dc) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['oth'], text: "Other"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [dc] // Attachment , Entire report as issued
        });

    }


    // "surgical_pathology-63"
    function surgical_pathology(sp) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['sp'], text: "Surgical Pathology"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [sp] // Attachment , Entire report as issued
        });

    }


    // "cytology_gyn-63"
    function cytology_gyn(cg) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['cy'], text: "Cytogenetics"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [cg] // Attachment , Entire report as issued
        });

    }


    // "autopsy-63"
    function autopsy(a) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['oth'], text: "Other"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [a] // Attachment , Entire report as issued
        });

    }


    // "bone_marrow-63"
    function bone_marrow(bm) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['oth'], text: "Other"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [bm] // Attachment , Entire report as issued
        });

    }


    // "cytology_nongyn-63"
    function cytology_nongyn(cn) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['oth'], text: "Other"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [cn] // Attachment , Entire report as issued
        });

    }


    // "parasitology-63"
    function parasitology(p) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['par'], text: "Parasitology"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [p] // Attachment , Entire report as issued
        });
    }


    // "bacteriology-63"
    function bacteriology(b) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['oth'], text: "Other"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [b] // Attachment , Entire report as issued
        });
    }


    // "mycobacterium-63"
    function mycobacterium(m) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['mcb'], text: "Mycobacteriology"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [m] // Attachment , Entire report as issued
        });
    }


    // "mycology-63"
    function mycology(m) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['myc'], text: "Mycology"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [m] // Attachment , Entire report as issued
        });
    }


    // "virology-63"
    function virology(v) {
        return fdt.clean({

            resourceType: "DiagnosticReport",
            id: fdt.fhirId(resourceType, eat('$._id')),
            // from Resource: id, meta, implicitRules, and language
            identifier: identifier,
            // from DomainResource: text, contained, extension, and modifierExtension
            status: fdt.required({coding: ["final"]}), // R!  registered | partial | final | corrected | appended | cancelled | entered-in-error

            category: {coding: ['vr'], text: "Virology"}, // CodeableConcept, Service category, http://hl7-fhir.github.io/valueset-diagnostic-service-sections.html
            code: fdt.required({}), // R!  Name/Code for this diagnostic report, loinc http://hl7-fhir.github.io/valueset-report-codes.html
            subject: fdt.required(patient), // Reference(Patient|Group|Device|Location) R!  The subject of the report, usually, but not always, the patient
            encounter: {}, // Reference(Encounter) Health care event when test ordered
            // effective[x]: Clinically Relevant time/time-period for report. One of these 2:
            effectiveDateTime: "<dateTime>",
            effectivePeriod: {}, // Period
            issued: fdt.required("<instant>"), // R!  DateTime this version was released
            performer: fdt.required({}), // Reference(Practitioner|Organization) R!  Responsible Diagnostic Service
            request: [{}], // Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)  What was requested
            specimen: [{}], // Reference(Specimen)  Specimens this report is based on
            result: [{}], // Reference(Observation) Observations - simple, or complex nested groups
            imagingStudy: [{}], // Reference(ImagingStudy|ImagingObjectSelection)  Reference to full details of imaging associated with the diagnostic report
            image: [{ // Key images associated with this report
                comment: "<string>", // Comment about the image (e.g. explanation)
                link: fdt.required({}) // Reference(Media) R!  Reference to the image source
            }],
            conclusion: "<string>", // Clinical Interpretation of test results
            codedDiagnosis: [{}], // CodeableConcept , Codes for the conclusion
            presentedForm: [c] // Attachment , Entire report as issued
        });
    }






    var labKinds = [micro_conversion, blood_bank, clinical_chemistry,
        parasitology_buffer, bacteriology_buffer, mycobacterium_buffer, mycology_buffer,
        virology_buffer, delta_check, surgical_pathology, cytology_gyn,
        autopsy, bone_marrow, cytology_nongyn, parasitology, bacteriology,
        mycobacterium, mycology, virology];

    var fhirDiagnosticReports = [];
    // Take the cross product of all lab kinds, labKinds by their appearances in a Lab_Reports-63 object and
    // push their translations onto fhirDiagnosticReports.
    labKinds.forEach(function(lk) {
        eat("$." + lk.name + '-63', function (l) {
            if (l) l.forEach(function(i) {
                fhirDiagnosticReports.push(lk(i));
            });
        });
    });

    if (options.participants) fhir.addParticipants(fhirDiagnosticReports, participatingProperties, prefix);
    if (options.warnings) fhir.addWarnings(fhirDiagnosticReports, warnings);
    fdt.clean(fhirDiagnosticReports);
    // Additional semantic processing here

    // var used = new Av();
    // participatingProperties.forEach(function (p) {
    //     var prop = p.substring(1);
    //     eval('used' + prop + '= chcsLabResultObjectModified' + prop);
    // });
    // var object_used = chcs_utils.devivify(used);
    //
    // if (options.eat) {
    //     participatingProperties.forEach(function(p){
    //         var prop = p.substring(1);
    //         eval('delete chcsLabResultObjectModified' + prop);
    //     });
    // }

    return {
        // used: object_used,
        fhir: fhirDiagnosticReports,
        participants: participatingProperties,
        options: options
    };
}
function translatePrescriptionsFhir(chcsPrescriptionObjectModified, _options, prefix) {
    // Assign the default options, then override what the caller wants. At the end you have the right options.
    var options = {
        warnings: false, 
        policy: false, 
        eat: true
    };
    for (k in _options) {
        // istanbul ignore else
        if (_options.hasOwnProperty(k)) { options[k] = _options[k]; }
    }

    // var participatingProperties = ["$['type']"]; // no participants yet
    var participatingProperties = []; // no participants yet
    // Create a fetcher for chcsPrescriptionObject. The fetcher will get data values from
    // input chcsPrescriptionObject, remembering those that actually have values in list participatingProperties.
    // var fetch1 = fdt.peek(chcsPrescriptionObjectModified, participatingProperties); // => fetch1(json_pattern[, transformation])
    var peek = fdt.peek(chcsPrescriptionObjectModified, participatingProperties); // => fetch1(json_pattern[, transformation])
    var eat = fdt.eat(chcsPrescriptionObjectModified, participatingProperties); // => fetch1(json_pattern[, transformation])

    eat('$.type');
    var warnings = []; // no warnings yet


    // http://hl7-fhir.github.io/medication.html:
    // "This resource is primarily used for the identification and definition of a medication. It covers the ingredients
    // and the packaging for a medication."

    // http://hl7-fhir.github.io/medicationdispense.html:
    // "Indicates that a medication product is to be or has been dispensed for a named person/patient. This includes a
    // description of the medication product (supply) provided and the instructions for administering the medication.
    // The medication dispense is the result of a pharmacy system responding to a medication order."
    var resourceType = 'MedicationDispense';
    // var whenPrepared = fetch1('$.fill_dates-52[0].fill_dates-52_01.value');
    var whenPrepared = eat('$.login_date-52.value');
    var fhirMedication = {
        resourceType: resourceType,
        id: fdt.fhirId(resourceType, peek('$._id')),
        // from Resource: id, meta, implicitRules, and language
        // from DomainResource: text, contained, extension, and modifierExtension
        identifier: eat('$._id', function(i) { return fdt.fhirExternalIdentifier(i, 'Prescription'); }),
        status: 'completed', // in-progress | on-hold | completed | entered-in-error | stopped, NOT MAPPED
        // medication[x]: What medication was supplied. One of these 2:
        medicationCodeableConcept: eat('$.drug-52.label', fdt.fhirCodeableConcept), // Reference(Medication)
        medicationReference: eat('$.drug-52', fdt.fhirReferenceMedication), // Reference(Medication)
        patient: eat('$.patient-52', fdt.fhirReferencePatient),
        dispenser: eat('$.provider-52', fdt.fhirReferencePractioner), // Reference(Practitioner), Practitioner responsible for dispensing medication
        authorizingPrescription: eat('order_pointer-52', function (p) { return [ fdt.fhirReferenceMedicationOrder(p) ]; }), // Medication order that authorizes the dispense, TODO: cross ref?
        // type: fetch1("$.type", fhirCodeableConcept), // Trial fill, partial fill, emergency fill, etc., NOT FOUND
        quantity: eat('$.qty-52', fdt.fhirQuantity), // { Quantity(SimpleQuantity) }, // Amount dispensed
        daysSupply: eat('$.days_supply-52', fdt.fhirQuantity), // { Quantity(SimpleQuantity) }, // Amount of medication expressed as a timing amount
        whenPrepared: whenPrepared, // Dispense processing time
        whenHandedOver: whenPrepared, // When product was given out
        destination: eat('$.outpatient_site-52', fdt.ReferenceLocation), // Where the medication was sent
        // receiver: [{ Reference(Patient|Practitioner) }], // Who collected the medication
        note: eat('$.comments-52', function(c) { return [{ text: c }]; }), // Information about the dispense
        dosageInstruction: [ // Medicine administration instructions to the patient/caregiver
           {
               text: peek('$.sig-52', function(t) { return encoder.htmlEncode(t); }),  // "text" : "<string>", // Free text dosage instructions e.g. SIG
               additionalInstructions: eat('$.expanded_sig-52', function(ai) { return fdt.fhirCodeableConcept(encoder.htmlEncode(ai)); }), // E.g. "Take with food"
               timing: eat('$.sig-52', function(sig) {return fdt.fhirTiming(encoder.htmlEncode(sig), whenPrepared); }), // When medication should be administered
               //    // asNeeded[x]: Take "as needed" f(or x). One of these 2:
               // asNeededBoolean: fetch1('$.expanded_sig-52', function(s) { return s.match(/as needed/i); }), //    "asNeededBoolean" : <boolean>,
               asNeededBoolean: eat('$.expanded_sig-52', function(s) { return s.match(/as needed/i) ? true : false; }), //    "asNeededBoolean" : <boolean>,
               //    "asNeededCodeableConcept" : { CodeableConcept },
               //    site[x]: Body site to administer to. One of these 2:
               //    "siteCodeableConcept" : { CodeableConcept },
               //    "siteReference" : { Reference(BodySite) },
               //    "route" : { CodeableConcept }, // How drug should enter body
               //    "method" : { CodeableConcept }, // Technique for administering medication
               // dose[x]: Amount of medication per dose. One of these 2:
               //    "doseRange" : { Range },
               //    "doseQuantity" : { Quantity(SimpleQuantity) },
               // rate[x]: Amount of medication per unit of time. One of these 2://    "rateRatio" : { Ratio },
               //    "rateRange" : { Range },
               //    "maxDosePerPeriod" : { Ratio } // Upper limit on medication per unit of time
             }],
        // substitution: { // Deals with substitution of one medicine for another
        // R!  Code signifying whether a different drug was dispensed from what was prescribed
        //     reason: [{CodeableConcept}], // Why was substitution made
        //     responsibleParty: [{Reference(Practitioner)}] // Who is responsible for the substitution
    };


    // istanbul ignore if
    if (options.participants) fhir.addParticipants(fhirMedication, participatingProperties, prefix);
    // istanbul ignore if
    if (options.warnings) fhir.addWarnings(fhirMedication, warnings);
    // Remove keys that have undefined/null/[] values.
    fdt.clean(fhirMedication);

    // The FHIR spec indicates that well-formed MedicationDispenses are required to have one of these two values.
    // Generally the medicationReference will be the key that's populated.
    // istanbul ignore if
    if (options.policy && !_.has(fhirMedication, 'medicationReference') && !_.has(fhirMedication, 'medicationCodeableConcept')) {
        throw new Error(format("FHIR medication '{id}' contains neither a medicationReference nor a medicationCodeableConcept.", {id: fhirMedication.value}));
    }

    // var used = new Av(); // {};
    // participatingProperties.forEach(function (p) {
    //     var prop = p.substring(1);
    //     eval('used' + prop + '= chcsPrescriptionObjectModified' + prop);
    // });
    // var object_used = chcs_utils.devivify(used);
    //
    // if (options.eat) {
    //     participatingProperties.forEach(function(p){
    //         var prop = p.substring(1);
    //         eval('delete chcsPrescriptionObjectModified' + prop);
    //     });
    // }

    return {
        // used: object_used,
        options: options,
        participants: participatingProperties,
        fhir: fhirMedication
    };
}
/**
 * Translate a chcsPrescriptionObject into a fhir_MedicationDispense.
 * @param {object} chcsPrescriptionObject -- input object
 * @param {{policy: boolean, warnings: boolean, eat: boolean}} [_options={policy: false, warnings: false, eat: true}]
 * @returns {object} -- fhir translation, a MedicationDispense resource
 * @see {@link http://hl7-fhir.github.io/procedure.html}
 */
function translateProceduresFhir(chcsProcedureObjectModified, _options, prefix) {
    // Assign the default options, then override what the caller wants. At the end you have the right options.
    var options = {
        participants: false,
        warnings: false,
        policy: false,
        eat: true
    };
    for (k in _options) {
        if (_options.hasOwnProperty(k)) {
            options[k] = _options[k];
        }
    }

    var participatingProperties = []; // no participants yet
    var warnings = []; // no warnings yet

    // Create a fetcher for chcsProcedureObject. The fetcher will get data values from
    // input chcsProcedureObject, remembering those that actually have values in list participating_properties.
    // var fetch1 = fdt.peek(chcsProcedureObjectModified, participatingProperties); // returns function fetch1(json_pattern[, transformation])
    var peek = fdt.peek(chcsProcedureObjectModified, participatingProperties); // returns function fetch1(json_pattern[, transformation])
    var eat = fdt.eat(chcsProcedureObjectModified, participatingProperties); // returns function fetch1(json_pattern[, transformation])
    eat('$.type');

    // http://hl7-fhir.github.io/procedure.html:
    // "This resource is used to record the details of procedures performed on a patient. A procedure is an activity
    // that is performed with or on a patient as part of the provision of care. Examples include surgical procedures,
    // diagnostic procedures, endoscopic procedures, biopsies, counseling, physiotherapy, exercise, etc.
    // Procedures may be performed by a healthcare professional, a friend or relative or in some cases
    // by the patient themselves."

    var resourceType = 'Procedure';
    // TODO mike@carif.io: the 'Patient-' prefix breaks with the chcs naming conventions. Check this.
    var thePatient = eat('$.patient.id', function(p) { return '2-' + p.substring('Patient-'.length); });
    var theProcedure = eat('$._id', function(p) { return p.substring('Procedure-'.length); });
    var theLabel = eat('$.patient.label');
    var fhirProcedure = {
        resourceType: resourceType,
        id: fdt.fhirId(resourceType, eat('$._id')),
        // from Resource: id, meta, implicitRules, and language
        // from DomainResource: text, contained, extension, and modifierExtension
        identifier: theProcedure && fdt.fhirIdentifierList(theProcedure, 'Procedure'), // External Identifiers for this procedure
        subject: thePatient && theLabel && fdt.fhirReferencePatient({id: thePatient, label: theLabel}), // { Reference(Patient|Group) }, // R!  Who the procedure was performed on
        status: 'completed', // R!  in-progress | aborted | completed | entered-in-error
        category: peek('$.source.id', fdt.fhirCodeableConcept), // { CodeableConcept }, // Classification of the procedure
        code: eat('$.source.id', fdt.fhirCodeableConcept), // { CodeableConcept }, // R!  Identification of the procedure
        // notPerformed: false, // <boolean>, // True if procedure was not performed as scheduled
        // reasonNotPerformed: // [{ CodeableConcept }], // C? Reason procedure was not performed
        // bodySite: fetch1('', fdt.fhirCodeableConcept), // [{ CodeableConcept }], // Target body sites
        // reason[x]: Reason procedure performed. One of these 2:
        // reasonCodeableConcept: fetch1('', fdt.fhirCodeableConcept), // { CodeableConcept },
        // "reasonReference" : { Reference(Condition) },
        // performer: fetch1('$.provider', function (p) {
        //         return [{ // The people who performed the procedure
        //             actor: fdt.fhirReferencePractioner(p.id), // { Reference(Practitioner|Organization|Patient|RelatedPerson) }, // The reference to the practitioner
        //             role: fdt.fhirCodeableConcept(p) // { CodeableConcept } // The role the actor was in
        //         }];
        //     }),
        // // performed[x]: Date/Period the procedure was performed. One of these 2:
        performedDateTime: eat('$.dateReported.value'), // "<dateTime>",
        // "performedPeriod" : { Period },
        encounter: eat('$.comments', function (e) { return { display: e }; }), // The encounter associated with the procedure
        // location: fetch1('', fdt.fhirReferenceLocation), // { Reference(Location) }, // Where the procedure happened
        // outcome: fetch1('', fdt.fhirCodeableConcept), // { CodeableConcept }, // The result of procedure
        // report: fetch1('', function (r) { return [ producingThisDiagnosticReport || fdt.ReferenceDiagnosticReport(r) ]; }), // { Reference(DiagnosticReport) }], // Any report resulting from the procedure
        // complication: fetch1('', fdt.CodeableConceptList), // Complication following the procedure
        // followUp: fetch1('', fdt.CodeableConceptList), // Instructions for follow up
        // "request" : { Reference(CarePlan|DiagnosticOrder|ProcedureRequest|ReferralRequest) }, // A request for this procedure
        // notes: fetch1('', function(a) { return [a]; }), // [{ Annotation }], // Additional information about the procedure
        // "focalDevice" : [{ // Device changed in procedure
        // "action" : { CodeableConcept }, // Kind of change to device
        // "manipulated" : { Reference(Device) } // R!  Device that was changed
        // }],
        //"used" : [{ Reference(Device|Medication|Substance) }] // Items used during procedure
    };

    if (options.participants) fhir.addParticipants(fhirProcedure, participatingProperties, prefix);
    if (options.warnings) fhir.addWarnings(fhirProcedure, warnings);

    // Remove keys that have undefined/null/[] values.
    fdt.clean(fhirProcedure);
    // Additional semantic processing here

    // var used = new Av();
    // participatingProperties.forEach(function (p) {
    //     var prop = p.substring(1);
    //     eval('used' + prop + '= chcsProcedureObjectModified' + prop);
    // });
    //
    // if (options.eat) {
    //     participatingProperties.forEach(function(p){
    //         var prop = p.substring(1);
    //         eval('delete chcsProcedureObjectModified' + prop);
    //     });
    // }
    // var object_used = chcs_utils.devivify(used);
    //
    return {
        // used: object_used,
        fhir: fhirProcedure,
        participants: participatingProperties,
        options: options
    };
}