Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Predictive Modeling page and update settings #61

Merged
merged 22 commits into from
Nov 21, 2024

Conversation

MattG57
Copy link
Collaborator

@MattG57 MattG57 commented Nov 19, 2024

Add Predictive Modeling page and update navigation menu.

  • Add PredictiveModelingComponent and update routes in frontend/src/app/app.routes.ts.
  • Update navigation menu in frontend/src/app/main/main.component.html to include link to Predictive Modeling.
  • Rename and update frontend/src/app/main/copilot/copilot-calculator/copilot-calculator.component.ts to frontend/src/app/main/copilot/predictive-modeling/predictive-modeling.component.ts.
  • Rename and update frontend/src/app/main/copilot/copilot-calculator/copilot-calculator.component.html to frontend/src/app/main/copilot/predictive-modeling/predictive-modeling.component.html.
  • Rename and update frontend/src/app/main/copilot/copilot-calculator/copilot-calculator.component.spec.ts to frontend/src/app/main/copilot/predictive-modeling/predictive-modeling.component.spec.ts.
  • Add methods to get and update new variables in frontend/src/app/services/settings.service.ts.
  • Add methods to get and update new variables in backend/src/services/settings.service.ts.
  • Add methods to get and update new variables in backend/src/controllers/settings.controller.ts.
  • Create TargetValues model in backend/src/models/target-values.model.ts.
  • Create TargetValuesController in backend/src/controllers/target-values.controller.ts.
  • Create TargetValuesService in backend/src/services/target-values.service.ts.
  • Create routes for TargetValues in backend/src/routes/target-values.routes.ts.

For more details, open the Copilot Workspace session.

Add Predictive Modeling page and update navigation menu.

* Add `PredictiveModelingComponent` and update routes in `frontend/src/app/app.routes.ts`.
* Update navigation menu in `frontend/src/app/main/main.component.html` to include link to Predictive Modeling.
* Rename and update `frontend/src/app/main/copilot/copilot-calculator/copilot-calculator.component.ts` to `frontend/src/app/main/copilot/predictive-modeling/predictive-modeling.component.ts`.
* Rename and update `frontend/src/app/main/copilot/copilot-calculator/copilot-calculator.component.html` to `frontend/src/app/main/copilot/predictive-modeling/predictive-modeling.component.html`.
* Rename and update `frontend/src/app/main/copilot/copilot-calculator/copilot-calculator.component.spec.ts` to `frontend/src/app/main/copilot/predictive-modeling/predictive-modeling.component.spec.ts`.
* Add methods to get and update new variables in `frontend/src/app/services/settings.service.ts`.
* Add methods to get and update new variables in `backend/src/services/settings.service.ts`.
* Add methods to get and update new variables in `backend/src/controllers/settings.controller.ts`.
* Create `TargetValues` model in `backend/src/models/target-values.model.ts`.
* Create `TargetValuesController` in `backend/src/controllers/target-values.controller.ts`.
* Create `TargetValuesService` in `backend/src/services/target-values.service.ts`.
* Create routes for `TargetValues` in `backend/src/routes/target-values.routes.ts`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/austenstone/github-value?shareId=XXXX-XXXX-XXXX-XXXX).
Copy link

github-actions bot commented Nov 19, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

MattG57 and others added 17 commits November 18, 2024 21:42
…roller, model, and form for predictive modeling
Add PredictiveModelingComponent to load settings and target data, and save target values.

* **frontend/src/app/main/copilot/predictive-modeling/predictive-modeling.component.ts**
  - Create PredictiveModelingComponent with settings and target forms.
  - Load settings and target data from PredictiveModelingService.
  - Add saveTargets method to save target values.
* **frontend/src/app/main/copilot/predictive-modeling/predictive-modeling.component.html**
  - Create HTML template with left column for settings and target values.
  - Add right column for calculated fields.
  - Include "Save Targets" button.
* **frontend/src/app/main/copilot/predictive-modeling/predictive-modeling.component.scss**
  - Add styles for predictive-modeling-container, left and right columns, and button.
* **frontend/src/app/services/predictive-modeling.service.ts**
  - Create PredictiveModelingService to handle data fetching and saving.
  - Implement methods to get settings, targets, and calculated fields, and save targets.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/austenstone/github-value?shareId=XXXX-XXXX-XXXX-XXXX).
constructor(private http: HttpClient) {}

getTargets() {
return this.http.get<any>(`${this.apiUrl}/targets`);

Check failure

Code scanning / ESLint

Disallow the `any` type Error

Unexpected any. Specify a different type.

Copilot Autofix AI about 1 month ago

To fix the problem, we need to replace the any type with a more specific type that accurately represents the data being returned by the HTTP requests. This involves defining TypeScript interfaces or types that match the expected structure of the data. We will need to update the return types of the getTargets, saveTargets, and getCalculatedFields methods accordingly.

  1. Define interfaces for the expected data structures.
  2. Replace the any type with the newly defined interfaces in the HTTP request methods.
Suggested changeset 1
frontend/src/app/services/predictive-modeling.service.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/services/predictive-modeling.service.ts b/frontend/src/app/services/predictive-modeling.service.ts
--- a/frontend/src/app/services/predictive-modeling.service.ts
+++ b/frontend/src/app/services/predictive-modeling.service.ts
@@ -4,2 +4,14 @@
 
+interface Target {
+  id: number;
+  name: string;
+  // Add other properties as needed
+}
+
+interface CalculatedField {
+  id: number;
+  formula: string;
+  // Add other properties as needed
+}
+
 @Injectable({
@@ -13,7 +25,7 @@
   getTargets() {
-    return this.http.get<any>(`${this.apiUrl}/targets`);
+    return this.http.get<Target[]>(`${this.apiUrl}/targets`);
   }
 
-  saveTargets(targets: any) {
-    return this.http.post<any>(`${this.apiUrl}/targets`, targets);
+  saveTargets(targets: Target[]) {
+    return this.http.post<Target[]>(`${this.apiUrl}/targets`, targets);
   }
@@ -21,3 +33,3 @@
   getCalculatedFields() {
-    return this.http.get<any>(`${this.apiUrl}/calculated-fields`);
+    return this.http.get<CalculatedField[]>(`${this.apiUrl}/calculated-fields`);
   }
EOF
@@ -4,2 +4,14 @@

interface Target {
id: number;
name: string;
// Add other properties as needed
}

interface CalculatedField {
id: number;
formula: string;
// Add other properties as needed
}

@Injectable({
@@ -13,7 +25,7 @@
getTargets() {
return this.http.get<any>(`${this.apiUrl}/targets`);
return this.http.get<Target[]>(`${this.apiUrl}/targets`);
}

saveTargets(targets: any) {
return this.http.post<any>(`${this.apiUrl}/targets`, targets);
saveTargets(targets: Target[]) {
return this.http.post<Target[]>(`${this.apiUrl}/targets`, targets);
}
@@ -21,3 +33,3 @@
getCalculatedFields() {
return this.http.get<any>(`${this.apiUrl}/calculated-fields`);
return this.http.get<CalculatedField[]>(`${this.apiUrl}/calculated-fields`);
}
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
return this.http.get<any>(`${this.apiUrl}/targets`);
}

saveTargets(targets: any) {

Check failure

Code scanning / ESLint

Disallow the `any` type Error

Unexpected any. Specify a different type.

Copilot Autofix AI about 1 month ago

To fix the problem, we need to replace the any type with a more specific type. This involves defining an appropriate interface or type for the targets parameter and the return types of the HTTP requests. We will define a Target interface to represent the structure of the targets data and use it in place of any.

Suggested changeset 1
frontend/src/app/services/predictive-modeling.service.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/services/predictive-modeling.service.ts b/frontend/src/app/services/predictive-modeling.service.ts
--- a/frontend/src/app/services/predictive-modeling.service.ts
+++ b/frontend/src/app/services/predictive-modeling.service.ts
@@ -4,2 +4,8 @@
 
+interface Target {
+  id: number;
+  name: string;
+  // Add other properties as needed
+}
+
 @Injectable({
@@ -13,7 +19,7 @@
   getTargets() {
-    return this.http.get<any>(`${this.apiUrl}/targets`);
+    return this.http.get<Target[]>(`${this.apiUrl}/targets`);
   }
 
-  saveTargets(targets: any) {
-    return this.http.post<any>(`${this.apiUrl}/targets`, targets);
+  saveTargets(targets: Target[]) {
+    return this.http.post<void>(`${this.apiUrl}/targets`, targets);
   }
@@ -21,3 +27,3 @@
   getCalculatedFields() {
-    return this.http.get<any>(`${this.apiUrl}/calculated-fields`);
+    return this.http.get<any[]>(`${this.apiUrl}/calculated-fields`);
   }
EOF
@@ -4,2 +4,8 @@

interface Target {
id: number;
name: string;
// Add other properties as needed
}

@Injectable({
@@ -13,7 +19,7 @@
getTargets() {
return this.http.get<any>(`${this.apiUrl}/targets`);
return this.http.get<Target[]>(`${this.apiUrl}/targets`);
}

saveTargets(targets: any) {
return this.http.post<any>(`${this.apiUrl}/targets`, targets);
saveTargets(targets: Target[]) {
return this.http.post<void>(`${this.apiUrl}/targets`, targets);
}
@@ -21,3 +27,3 @@
getCalculatedFields() {
return this.http.get<any>(`${this.apiUrl}/calculated-fields`);
return this.http.get<any[]>(`${this.apiUrl}/calculated-fields`);
}
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
}

saveTargets(targets: any) {
return this.http.post<any>(`${this.apiUrl}/targets`, targets);

Check failure

Code scanning / ESLint

Disallow the `any` type Error

Unexpected any. Specify a different type.

Copilot Autofix AI about 1 month ago

To fix the problem, we need to replace the any type with more specific types that accurately describe the data being handled. This involves defining TypeScript interfaces or types that match the structure of the data returned by the API endpoints and used in the methods.

  1. Define interfaces for the data structures returned by the API endpoints and used in the methods.
  2. Replace the any type in the getTargets, saveTargets, and getCalculatedFields methods with the newly defined interfaces.
Suggested changeset 1
frontend/src/app/services/predictive-modeling.service.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/services/predictive-modeling.service.ts b/frontend/src/app/services/predictive-modeling.service.ts
--- a/frontend/src/app/services/predictive-modeling.service.ts
+++ b/frontend/src/app/services/predictive-modeling.service.ts
@@ -3,2 +3,3 @@
 import { serverUrl } from './server.service';
+import { Target, CalculatedField } from '../models/predictive-modeling.models';
 
@@ -13,7 +14,7 @@
   getTargets() {
-    return this.http.get<any>(`${this.apiUrl}/targets`);
+    return this.http.get<Target[]>(`${this.apiUrl}/targets`);
   }
 
-  saveTargets(targets: any) {
-    return this.http.post<any>(`${this.apiUrl}/targets`, targets);
+  saveTargets(targets: Target[]) {
+    return this.http.post<void>(`${this.apiUrl}/targets`, targets);
   }
@@ -21,4 +22,16 @@
   getCalculatedFields() {
-    return this.http.get<any>(`${this.apiUrl}/calculated-fields`);
+    return this.http.get<CalculatedField[]>(`${this.apiUrl}/calculated-fields`);
   }
 }
+
+export interface Target {
+  id: number;
+  name: string;
+  // Add other properties as needed
+}
+
+export interface CalculatedField {
+  id: number;
+  formula: string;
+  // Add other properties as needed
+}
EOF
@@ -3,2 +3,3 @@
import { serverUrl } from './server.service';
import { Target, CalculatedField } from '../models/predictive-modeling.models';

@@ -13,7 +14,7 @@
getTargets() {
return this.http.get<any>(`${this.apiUrl}/targets`);
return this.http.get<Target[]>(`${this.apiUrl}/targets`);
}

saveTargets(targets: any) {
return this.http.post<any>(`${this.apiUrl}/targets`, targets);
saveTargets(targets: Target[]) {
return this.http.post<void>(`${this.apiUrl}/targets`, targets);
}
@@ -21,4 +22,16 @@
getCalculatedFields() {
return this.http.get<any>(`${this.apiUrl}/calculated-fields`);
return this.http.get<CalculatedField[]>(`${this.apiUrl}/calculated-fields`);
}
}

export interface Target {
id: number;
name: string;
// Add other properties as needed
}

export interface CalculatedField {
id: number;
formula: string;
// Add other properties as needed
}
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
}

getCalculatedFields() {
return this.http.get<any>(`${this.apiUrl}/calculated-fields`);

Check failure

Code scanning / ESLint

Disallow the `any` type Error

Unexpected any. Specify a different type.

Copilot Autofix AI about 1 month ago

To fix the problem, we need to replace the any type with a more specific type that accurately represents the data being returned by the HTTP requests. This involves defining TypeScript interfaces or types that match the expected structure of the data. We will need to update the return types of the getTargets, saveTargets, and getCalculatedFields methods accordingly.

  1. Define interfaces for the expected data structures.
  2. Replace the any type with the newly defined interfaces in the HTTP request methods.
Suggested changeset 1
frontend/src/app/services/predictive-modeling.service.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/services/predictive-modeling.service.ts b/frontend/src/app/services/predictive-modeling.service.ts
--- a/frontend/src/app/services/predictive-modeling.service.ts
+++ b/frontend/src/app/services/predictive-modeling.service.ts
@@ -3,2 +3,3 @@
 import { serverUrl } from './server.service';
+import { Target, CalculatedField } from './types';
 
@@ -13,7 +14,7 @@
   getTargets() {
-    return this.http.get<any>(`${this.apiUrl}/targets`);
+    return this.http.get<Target[]>(`${this.apiUrl}/targets`);
   }
 
-  saveTargets(targets: any) {
-    return this.http.post<any>(`${this.apiUrl}/targets`, targets);
+  saveTargets(targets: Target[]) {
+    return this.http.post<void>(`${this.apiUrl}/targets`, targets);
   }
@@ -21,4 +22,16 @@
   getCalculatedFields() {
-    return this.http.get<any>(`${this.apiUrl}/calculated-fields`);
+    return this.http.get<CalculatedField[]>(`${this.apiUrl}/calculated-fields`);
   }
 }
+
+export interface Target {
+  id: number;
+  name: string;
+  // Add other properties as needed
+}
+
+export interface CalculatedField {
+  id: number;
+  formula: string;
+  // Add other properties as needed
+}
EOF
@@ -3,2 +3,3 @@
import { serverUrl } from './server.service';
import { Target, CalculatedField } from './types';

@@ -13,7 +14,7 @@
getTargets() {
return this.http.get<any>(`${this.apiUrl}/targets`);
return this.http.get<Target[]>(`${this.apiUrl}/targets`);
}

saveTargets(targets: any) {
return this.http.post<any>(`${this.apiUrl}/targets`, targets);
saveTargets(targets: Target[]) {
return this.http.post<void>(`${this.apiUrl}/targets`, targets);
}
@@ -21,4 +22,16 @@
getCalculatedFields() {
return this.http.get<any>(`${this.apiUrl}/calculated-fields`);
return this.http.get<CalculatedField[]>(`${this.apiUrl}/calculated-fields`);
}
}

export interface Target {
id: number;
name: string;
// Add other properties as needed
}

export interface CalculatedField {
id: number;
formula: string;
// Add other properties as needed
}
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link
Owner

@austenstone austenstone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@austenstone austenstone merged commit 54d4b8f into main Nov 21, 2024
10 of 11 checks passed
@austenstone austenstone deleted the MattG57/add-predictive-modeling branch November 21, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants