<commit_before>import moment = require("moment");
import {Component, Input, OnInit} from "@angular/core";
import {NgbModal, NgbActiveModal} from "@ng-bootstrap/ng-bootstrap";
import {CodePickerDialog} from "../coding/codePicker.dialog";
import {CodeSetValue} from "../coding/models/CodeSetValue";
import {CodingService} from "../coding/coding.service";
import {Concept} from "../coding/models/Concept";
import {CountReportService} from "./countReport.service";
import {Practitioner} from "../practitioner/models/Practitioner";
import {PractitionerPickerDialog} from "../practitioner/practitionerPicker.dialog";
import {CountReport} from "./models/CountReport";

@Component({
    selector: 'ngbd-modal-content',
    template: require('./reportParams.html')
})
export class ReportParamsDialog implements OnInit {
    @Input() countReport : CountReport;

    encounterTypes : Concept[];
    referralTypes : Concept[];
    referralPriorities : Concept[];

    runDate : Date;
    effectiveDate : Date;
    regType : number;
    gender : number;
    dobMin : Date;
    dobMax : Date;
    originalCode : string;
    valueMax : number;
    valueMin : number;
    snomedCode : CodeSetValue;
    authType : number;
    practitioner : Practitioner;
    dmdCode : number;
    encounterType : number;
    referralSnomedCode : CodeSetValue;
    referralOriginalCode : string;
    referralType : number;
    referralPriority : number;


    public static open(modalService: NgbModal, countReport: CountReport) {
        const modalRef = modalService.open(ReportParamsDialog, {backdrop: "static", size: 'lg'});
        modalRef.componentInstance.countReport = countReport;
        return modalRef;
    }

    constructor(protected modalService : NgbModal,
                protected activeModal: NgbActiveModal,
                protected codingService : CodingService,
                protected countReportService : CountReportService) {
        this.loadEncounterTypes();
        this.loadReferralTypes();
        this.loadReferralPriorities();
    }

    ngOnInit(): void {
        // work out prompts from query text
        this.runDate = new Date();

        if (!this.countReport)
            return;

        // Check query for remaining prompts
        if (this.countReport.query.indexOf(':EffectiveDate') >= 0) this.effectiveDate = null;
        if (this.countReport.query.indexOf(':SnomedCode') >= 0) this.snomedCode = null;
        if (this.countReport.query.indexOf(':RegistrationType') >= 0) this.regType = null;
        if (this.countReport.query.indexOf(':Gender') >= 0) this.gender = null;
        if (this.countReport.query.indexOf(':DobMin') >= 0) this.dobMin = null;
        if (this.countReport.query.indexOf(':DobMax') >= 0) this.dobMax = null;
        if (this.countReport.query.indexOf(':OriginalCode') >= 0) this.originalCode = null;
        if (this.countReport.query.indexOf(':ValueMin') >= 0) this.valueMin = null;
        if (this.countReport.query.indexOf(':ValueMax') >= 0) this.valueMax = null;
        if (this.countReport.query.indexOf(':AuthType') >= 0) this.authType = null;
        if (this.countReport.query.indexOf(':Practitioner') >= 0) this.practitioner = null;
        // DM&D
        if (this.countReport.query.indexOf(':EncounterType') >= 0) this.encounterType = null;
        if (this.countReport.query.indexOf(':ReferralSnomedCode') >= 0) this.referralSnomedCode = null;
        if (this.countReport.query.indexOf(':ReferralOriginalCode') >= 0) this.referralOriginalCode = null;
        if (this.countReport.query.indexOf(':ReferralType') >= 0) this.referralType = null;
        if (this.countReport.query.indexOf(':ReferralPriority') >=0 ) this.referralPriority = null;
    }

    loadEncounterTypes() {
        let vm = this;
        vm.countReportService.getEncounterTypeCodes()
          .subscribe(
            (result) => vm.encounterTypes = result
          );
    }

    loadReferralTypes() {
        let vm = this;
        vm.countReportService.getReferralTypes()
					.subscribe(
            (result) => vm.referralTypes = result
          );
    }

    loadReferralPriorities() {
        let vm = this;
        vm.countReportService.getReferralPriorities()
					.subscribe(
            (result) => vm.referralPriorities = result
          );
    }

    selectSnomed() {
        var vm = this;
        CodePickerDialog.open(vm.modalService, [], true)
          .result.then(
          (result) => {
              vm.snomedCode = result[0];
              vm.snomedCode.term = 'Loading...';
              vm.codingService.getPreferredTerm(vm.snomedCode.code)
                .subscribe(
                  (term) => vm.snomedCode.term = term.preferredTerm
                );
          }
        )
    }<commit_msg>Fixed code picker cancel method<commit_after>import moment = require("moment");
import {Component, Input, OnInit} from "@angular/core";
import {NgbModal, NgbActiveModal} from "@ng-bootstrap/ng-bootstrap";
import {CodePickerDialog} from "../coding/codePicker.dialog";
import {CodeSetValue} from "../coding/models/CodeSetValue";
import {CodingService} from "../coding/coding.service";
import {Concept} from "../coding/models/Concept";
import {CountReportService} from "./countReport.service";
import {Practitioner} from "../practitioner/models/Practitioner";
import {PractitionerPickerDialog} from "../practitioner/practitionerPicker.dialog";
import {CountReport} from "./models/CountReport";

@Component({
    selector: 'ngbd-modal-content',
    template: require('./reportParams.html')
})
export class ReportParamsDialog implements OnInit {
    @Input() countReport : CountReport;

    encounterTypes : Concept[];
    referralTypes : Concept[];
    referralPriorities : Concept[];

    runDate : Date;
    effectiveDate : Date;
    regType : number;
    gender : number;
    dobMin : Date;
    dobMax : Date;
    originalCode : string;
    valueMax : number;
    valueMin : number;
    snomedCode : CodeSetValue;
    authType : number;
    practitioner : Practitioner;
    dmdCode : number;
    encounterType : number;
    referralSnomedCode : CodeSetValue;
    referralOriginalCode : string;
    referralType : number;
    referralPriority : number;


    public static open(modalService: NgbModal, countReport: CountReport) {
        const modalRef = modalService.open(ReportParamsDialog, {backdrop: "static", size: 'lg'});
        modalRef.componentInstance.countReport = countReport;
        return modalRef;
    }

    constructor(protected modalService : NgbModal,
                protected activeModal: NgbActiveModal,
                protected codingService : CodingService,
                protected countReportService : CountReportService) {
        this.loadEncounterTypes();
        this.loadReferralTypes();
        this.loadReferralPriorities();
    }

    ngOnInit(): void {
        // work out prompts from query text
        this.runDate = new Date();

        if (!this.countReport)
            return;

        // Check query for remaining prompts
        if (this.countReport.query.indexOf(':EffectiveDate') >= 0) this.effectiveDate = null;
        if (this.countReport.query.indexOf(':SnomedCode') >= 0) this.snomedCode = null;
        if (this.countReport.query.indexOf(':RegistrationType') >= 0) this.regType = null;
        if (this.countReport.query.indexOf(':Gender') >= 0) this.gender = null;
        if (this.countReport.query.indexOf(':DobMin') >= 0) this.dobMin = null;
        if (this.countReport.query.indexOf(':DobMax') >= 0) this.dobMax = null;
        if (this.countReport.query.indexOf(':OriginalCode') >= 0) this.originalCode = null;
        if (this.countReport.query.indexOf(':ValueMin') >= 0) this.valueMin = null;
        if (this.countReport.query.indexOf(':ValueMax') >= 0) this.valueMax = null;
        if (this.countReport.query.indexOf(':AuthType') >= 0) this.authType = null;
        if (this.countReport.query.indexOf(':Practitioner') >= 0) this.practitioner = null;
        // DM&D
        if (this.countReport.query.indexOf(':EncounterType') >= 0) this.encounterType = null;
        if (this.countReport.query.indexOf(':ReferralSnomedCode') >= 0) this.referralSnomedCode = null;
        if (this.countReport.query.indexOf(':ReferralOriginalCode') >= 0) this.referralOriginalCode = null;
        if (this.countReport.query.indexOf(':ReferralType') >= 0) this.referralType = null;
        if (this.countReport.query.indexOf(':ReferralPriority') >=0 ) this.referralPriority = null;
    }

    loadEncounterTypes() {
        let vm = this;
        vm.countReportService.getEncounterTypeCodes()
          .subscribe(
            (result) => vm.encounterTypes = result
          );
    }

    loadReferralTypes() {
        let vm = this;
        vm.countReportService.getReferralTypes()
					.subscribe(
            (result) => vm.referralTypes = result
          );
    }

    loadReferralPriorities() {
        let vm = this;
        vm.countReportService.getReferralPriorities()
					.subscribe(
            (result) => vm.referralPriorities = result
          );
    }

    selectSnomed() {
        var vm = this;
        CodePickerDialog.open(vm.modalService, [], true)
          .result.then(
          (result) => {
              if (result) {
                  vm.snomedCode = result[0];
                  vm.snomedCode.term = 'Loading...';
                  vm.codingService.getPreferredTerm(vm.snomedCode.code)
										.subscribe(
                      (term) => vm.snomedCode.term = term.preferredTerm
                    );
              }
          }
        )
    }
{'fraction_non_alphanumeric': 0.12677527151211362, 'fraction_numerical': 0.0035505430242272346, 'mean_word_length': 2.7454047712162692, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2374146', 'n_tokens_mistral': 2871, 'n_tokens_neox': 2738, 'n_words': 560}