Skip to content

Commit

Permalink
Reports update
Browse files Browse the repository at this point in the history
  • Loading branch information
alopezo committed Jan 31, 2025
1 parent dff8b92 commit aa5d090
Show file tree
Hide file tree
Showing 13 changed files with 116 additions and 75 deletions.
15 changes: 9 additions & 6 deletions docs/assets/reports/detect_inactivations_by_reason.html

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions docs/assets/reports/fsn_changes_with_details.html

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions docs/assets/reports/new_concepts_by_semantic_tag.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

50 changes: 48 additions & 2 deletions src/app/phaser-game/phaser-v2/characters/character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class Character extends Phaser.GameObjects.Rectangle {
previousX: number = 0;
info: any = {};
speed = 1;
moveTween?: Phaser.Tweens.Tween; // Store movement tween

constructor(scene: Scene, x: number, y: number, spriteType: number = 1, color: number = 0x00ff00) {
super(scene, x, y, 40, 40, color);
Expand All @@ -27,18 +28,63 @@ export class Character extends Phaser.GameObjects.Rectangle {
this.spriteType = spriteType;
}

/**
* Moves the character along a path of points.
* @param points An array of points { x, y, duration } to move along.
* @param onComplete A callback function to execute after the movement finishes.
*/
walkTo(points: { x: number; y: number; duration: number }[], onComplete: () => void): void {
if (points.length === 0) {
onComplete();
return;
}

const moveCharacter = (index: number) => {
if (index >= points.length) {
onComplete();
return;
}
const point = points[index];

this.sceneRef.tweens.add({
targets: this,
x: point.x,
y: point.y,
duration: point.duration / this.speed,
ease: 'Linear',
onUpdate: () => {
},
onComplete: () => {
moveCharacter(index + 1);
},
});

// Extra squish animation while moving
this.sceneRef.tweens.add({
targets: this,
yoyo: true,
repeat: point.duration / 150, // Slight bobbing motion
duration: 150,
onComplete: () => {
},
});
};

moveCharacter(0);
}

hurt() {
this.hitPoints--;

// Add damage pop-up text
const damageText = this.scene.add.text(this.x, this.y - 10, '-1', {
const damageText = this.sceneRef.add.text(this.x, this.y - 10, '-1', {
fontSize: '20px',
color: '#ff0000',
fontStyle: 'bold',
}).setOrigin(0.5);

// Animate the text to float upward and fade out
this.scene.tweens.add({
this.sceneRef.tweens.add({
targets: damageText,
y: this.y - 100,
alpha: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/app/phaser-game/phaser-v2/characters/doctor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GameService } from "../gameService";
import { Character } from "./character";
import { Patient } from "./patient";
import { GameService } from "./gameService";

export class Doctor extends Character {
public specialityEcl: string = '';
Expand Down
2 changes: 1 addition & 1 deletion src/app/phaser-game/phaser-v2/characters/triage-robot.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Character } from "./character";
import { Patient } from "./patient";
import { GameService } from "./gameService";
import { GameService } from "../gameService";

export class TriageRobot extends Character {
public triageRules: any[] = [];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TerminologyService } from "src/app/services/terminology.service";
import { Patient } from "./patient";
import { Patient } from "./characters/patient";

export class GameService {

Expand Down
45 changes: 9 additions & 36 deletions src/app/phaser-game/phaser-v2/scenes/cdstd-scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Patient } from "../characters/patient";
import { TriageRobot } from "../characters/triage-robot";
import { Doctor } from "../characters/doctor";
import { Character } from "../characters/character";
import { GameService } from "../characters/gameService";
import { GameService } from "../gameService";

export class CdstdScene extends Phaser.Scene {

Expand Down Expand Up @@ -207,7 +207,7 @@ export class CdstdScene extends Phaser.Scene {
{ x: 330 + (30 * patient.queuePosition), y: 533, duration: 500 },
];

this.walkTo(patient, path, () => {
patient.walkTo(path, () => {
this.patientsInQueue++;
this.time.delayedCall(100, () => {
});
Expand Down Expand Up @@ -237,7 +237,7 @@ export class CdstdScene extends Phaser.Scene {
{ x: 310, y: 533, duration: 200 }
];

this.walkTo(this.gatekeeper, path, () => {
this.gatekeeper.walkTo(path, () => {
this.gatekeeper.say('We will start soon', 1100);
});
}
Expand Down Expand Up @@ -293,7 +293,7 @@ export class CdstdScene extends Phaser.Scene {
let path = [
{ x: 310, y: 350, duration: 500 }
];
this.walkTo(patient, path, () => {
patient.walkTo(path, () => {
// this.time.delayedCall(100, () => {
// patient.flipX = true;
// });
Expand All @@ -311,7 +311,7 @@ export class CdstdScene extends Phaser.Scene {
{ x: 240, y: 350, duration: 500 },
{ x: x, y: y, duration: 500 },
];
this.walkTo(patient, path, () => {
patient.walkTo(path, () => {
this.time.delayedCall(100, () => {
});
});
Expand All @@ -326,7 +326,7 @@ export class CdstdScene extends Phaser.Scene {
// Throw a coin and set x to 0 or 800
let coin = Phaser.Math.Between(0, 1);
path.push({ x: coin * 800, y: 560, duration: 1000 });
this.walkTo(patient, path, () => {
patient.walkTo(path, () => {
this.time.delayedCall(100, () => {
patient.destroy();
});
Expand All @@ -345,7 +345,7 @@ export class CdstdScene extends Phaser.Scene {
let path = [
{ x: queueStart + (30 * patient.queuePosition), y: patient.y, duration: 500 },
];
this.walkTo(patient, path, () => {
patient.walkTo(path, () => {
// Nothing
});
});
Expand Down Expand Up @@ -380,7 +380,7 @@ export class CdstdScene extends Phaser.Scene {
{ x: doctor.x + 30, y: doctor.y, duration: 300 },
];
doctor.busy = true; // Mark doctor as busy
this.walkTo(patient, path, () => {
patient.walkTo(path, () => {
this.attendPatient(patient, doctor);
});
});
Expand Down Expand Up @@ -418,7 +418,7 @@ export class CdstdScene extends Phaser.Scene {
{ x: newX, y: newY, duration: 500 / this.speedMultiplier },
];

this.walkTo(patient, path, () => {
patient.walkTo(path, () => {
});

console.log(`Patient re-added to insideQueue at position ${patient.queuePosition}`);
Expand Down Expand Up @@ -502,33 +502,6 @@ export class CdstdScene extends Phaser.Scene {
}
}

private walkTo(character: Character, points: { x: number, y: number, duration: number }[], onComplete: () => void): void {
if (points.length === 0) {
onComplete();
return;
}
const createTween = (index: number) => {
if (index >= points.length) {
onComplete();
return;
}

const point = points[index];
this.tweens.add({
targets: character,
x: point.x,
y: point.y,
duration: point.duration / this.speedMultiplier,
ease: 'Linear',
onComplete: () => {
createTween(index + 1);
},
});
};

createTween(0);
}

checkPatientDiagnosisVsEcl(patient: Patient, ecl: string): Promise<any[]> {
return new Promise((resolve, reject) => {
let untreatedDx = 0;
Expand Down
15 changes: 9 additions & 6 deletions src/assets/reports/detect_inactivations_by_reason.html

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions src/assets/reports/fsn_changes_with_details.html

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions src/assets/reports/new_concepts_by_semantic_tag.html

Large diffs are not rendered by default.

0 comments on commit aa5d090

Please sign in to comment.