Skip to content

Conversation

@simhue
Copy link

@simhue simhue commented Sep 25, 2025

No description provided.

simhue added 30 commits August 28, 2024 10:46
Angular Workspace migration. Update an Angular CLI workspace to version 9.
- optimized build inludes/excludes
- refactoring
- add new classes for master data and encounters
- apply new logo and icons
- add comments
- refactoring
- implement batch registration
- add case for http 304 code in error interceptor
- refactor request polling
Copy link
Member

@akomii akomii left a comment

Choose a reason for hiding this comment

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

Review WIP. Only Java code done so far. Project not buildable via mvn:

[ERROR] ▲ [WARNING] The glob pattern import("./**/*.entry.js*") did not match any files [empty-glob]
[ERROR] 
[ERROR]     node_modules/@stencil/core/internal/client/index.js:169:2:
[ERROR]       169 │   `./${bundleId}.entry.js${BUILD5.hotModuleReplacement && hmrVers...
[ERROR]           ╵   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ERROR] 
[ERROR] 
[ERROR] ✘ [ERROR] Could not resolve "semantic/dist/semantic.min.css"
[ERROR] 
[ERROR]     angular:styles/global:styles:2:8:
[ERROR]       2 │ @import 'semantic/dist/semantic.min.css';
[ERROR]         ╵         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ERROR] 
[ERROR]   You can mark the path "semantic/dist/semantic.min.css" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.
[ERROR] 
[ERROR] 
[ERROR] ✘ [ERROR] Could not resolve "semantic/dist/semantic.js" [plugin angular-script-global]
[ERROR] 
[ERROR] 

PatientEntry pat = study.getPatientByID(ref, root, ext);
if (pat != null) {
log.log(Level.WARNING, "Cannot create entry, PatientEntry already exists.");
return Response.status(Status.CONFLICT).entity("Patient*in existiert bereits").build();
Copy link
Member

Choose a reason for hiding this comment

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

Do not sent human-readable error messages. These are endpoints. A machine interacts with them (frontend). The translation to human-readable should be done in Frontend to UI

Comment on lines 105 to 106
Study study = this.getStudy(id);
return study.getPatientByID(ref, root, ext);
Copy link
Member

Choose a reason for hiding this comment

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

This logic should be in the service.

So you are calling in StudyManagerImpl an SQL Query to get all Studies
Then you loop to these studies to get a specific study
Then you loop through the found study to get a specific patient

Why not just add the method to StudyManager and implement a SQL Query that does this?

Copy link
Author

Choose a reason for hiding this comment

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

Because then I do not need to touch two additional packages (dwh-api and dwh-query) and the computational impact should be negligible - correct me if I'm wrong

@simhue
Copy link
Author

simhue commented Oct 30, 2025

Review WIP. Only Java code done so far. Project not buildable via mvn:

[ERROR] ▲ [WARNING] The glob pattern import("./**/*.entry.js*") did not match any files [empty-glob]
[ERROR] 
[ERROR]     node_modules/@stencil/core/internal/client/index.js:169:2:
[ERROR]       169 │   `./${bundleId}.entry.js${BUILD5.hotModuleReplacement && hmrVers...
[ERROR]           ╵   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ERROR] 
[ERROR] 
[ERROR] ✘ [ERROR] Could not resolve "semantic/dist/semantic.min.css"
[ERROR] 
[ERROR]     angular:styles/global:styles:2:8:
[ERROR]       2 │ @import 'semantic/dist/semantic.min.css';
[ERROR]         ╵         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ERROR] 
[ERROR]   You can mark the path "semantic/dist/semantic.min.css" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.
[ERROR] 
[ERROR] 
[ERROR] ✘ [ERROR] Could not resolve "semantic/dist/semantic.js" [plugin angular-script-global]
[ERROR] 
[ERROR] 

During a merge a line got deleted by accident. I pushed a fix.

simhue added a commit to aktin/dwh-query that referenced this pull request Nov 3, 2025
simhue added a commit to aktin/dwh-api that referenced this pull request Nov 3, 2025
simhue added a commit to aktin/dwh-query that referenced this pull request Nov 10, 2025
<version>3.1.0</version>
<configuration>
<warSourceExcludes>node_modules/**,**/*.ts,**/*.js.map,.idea/**,.vscode/**</warSourceExcludes>
<warSourceExcludes>node_modules/**,.angular/**,*.json,*.md,.browserslistrc,.vscode/**,.idea/**,dist/**,public/**,src/**</warSourceExcludes>
Copy link
Contributor

Choose a reason for hiding this comment

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

das soll ja den sourcecode enthalten und nur die kompilierten Teile auslassen. Warum steht hier public/ und src/ als ausnahmen drin?

debug.log
*.js
*.js.map
semantic
Copy link
Contributor

Choose a reason for hiding this comment

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

Hier fehlen kommentare was semantic ist und warum das ausgenommen wird.

ENCOUNTERS_NOT_FOUND, // No encounters in db found

// Processing States
VALID,
Copy link
Contributor

Choose a reason for hiding this comment

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

was für ein Fehler ist VALID???

@Path("{studyId}/{sic}")
@GET
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public PatientEntry getEntryBySic(@PathParam("studyId") String id, @PathParam("sic") String sic) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

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

Endpoints should never throw an Exception... Where would it go?

Copy link
Author

Choose a reason for hiding this comment

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

see comment above

Comment on lines +159 to +167
PatientEntry pat = study.getPatientByID(ref, root, ext);
if (pat != null) {
throw OptInError.buildError(Status.CONFLICT, OptInErrorType.PATIENT_ALREADY_EXISTS, "Cannot create entry, PatientEntry already exists");
}

pat = study.getPatientBySIC(entry.sic);
if (pat != null) {
throw OptInError.buildError(Status.CONFLICT, OptInErrorType.SIC_ALREADY_EXISTS, "Cannot create entry, SIC {0} already exists", entry.sic);
}
Copy link
Member

Choose a reason for hiding this comment

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

Again, an Endpoint is machine readable. Instead of creating a new Pojo to differentiate existing patient and sics you should use:

throw new ClientErrorException(Status.CONFLICT);

Alternatively:

throw new ClientErrorException(
    Response.status(Status.CONFLICT)
        .type(MediaType.APPLICATION_JSON)
        .entity("{detail: OptInErrorType.SIC_ALREADY_EXISTS}")
        .build());

@Path("{studyId}/{reference}/{root}{p:/?}{extension:.*}")
@GET
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response getEntry(@PathParam("studyId") String id, @PathParam("reference") PatientReference ref, @PathParam("root") String root,
Copy link
Member

Choose a reason for hiding this comment

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

Endpoints should never throw an IOException... Where would it go?

Copy link
Author

Choose a reason for hiding this comment

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

Not my original code, we should adress that when the code base gets redesigned eventually

public Response getEntry(@PathParam("studyId") String id, @PathParam("reference") PatientReference ref, @PathParam("root") String root,
@PathParam("extension") String ext) throws IOException {
Study study = this.getStudy(id);
return Response.ok(study.getPatientByID(ref, root, ext)).build();
Copy link
Member

Choose a reason for hiding this comment

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

If study not found, 200 is returned with an empty body

it should be a 404

Copy link
Author

Choose a reason for hiding this comment

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

getStudy throws a not found exception when empty, but not getPatientByID, I'm going to add it

* @return list of studies
* @throws IOException
*/
@Path("studies")
Copy link
Member

Choose a reason for hiding this comment

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

Better to just remove the Path annoation for consistency

GET optin/studies -> all studies
GET optin/2 -> all entries of study with id 2??

Copy link
Author

Choose a reason for hiding this comment

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

or change the "optin" to "studies" because optin/2 -> what is an optin with the id 2?


PatientEntry oldEntry = study.getPatientByID(ref, root, ext);
if (oldEntry == null) {
throw OptInError.buildError(Status.NOT_FOUND, OptInErrorType.PATIENT_NOT_FOUND, "Patient not found");
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need OptInError for this? Why not just:

throw new ClientErrorException(Status.NOT_FOUND);

log.log(Level.WARNING, "Cannot update entry, entry does not exist");
return Response.status(Status.BAD_REQUEST).entity("Patient*in nicht gefunden").build();
}
PatientEntry newEntry = study.getPatientByID(ref, root, ext);
Copy link
Member

Choose a reason for hiding this comment

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

I still dont get it... It a PUT, its called updateEntry, but all it does it update the comment?

throw OptInError.buildError(Status.NOT_FOUND, OptInErrorType.PATIENT_NOT_FOUND, "Patient not found");
}
pat.delete(security.getUserPrincipal().getName());
return Response.ok().build();
Copy link
Member

Choose a reason for hiding this comment

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

Commonly, NO_CONTENT / 204 is returned if an DELETE is successful

@akomii akomii linked an issue Nov 13, 2025 that may be closed by this pull request
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Improve Code Quality of the Study Manager Endpoint

4 participants