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

Improve mapping between XDS XON and FHIR Organization #166

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qligier
Copy link
Collaborator

@qligier qligier commented Jul 30, 2024

Fixes #165

@qligier qligier linked an issue Jul 30, 2024 that may be closed by this pull request
@qligier qligier force-pushed the 165-wrong-xon-generated-when-the-fhir-organization-has-no-system branch from 56b9226 to 217b4d7 Compare July 30, 2024 06:30
@qligier qligier changed the title Generate valid XON when the FHIR Organization identifier has no system Improve mapping between XDS XON and FHIR Organization Jul 30, 2024
@oliveregger
Copy link
Collaborator

@unixoid can you please review?

result.addIdentifier().setSystem(system).setValue(id);
} else {
final var identifier = result.addIdentifier().setValue(id);
if (id.startsWith("urn:oid:") || id.startsWith("urn:uuid:")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can it be simplified to if (id.startsWith("urn:")) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed!

@@ -141,4 +141,12 @@ public static Processor retrievedDocumentSetToHttResponse() {
};
}
*/

public static boolean isUnprefixedOid(final String oid) {
return oid != null && oid.matches("\\d+(\\.\\d+)+");
Copy link
Contributor

@unixoid unixoid Aug 19, 2024

Choose a reason for hiding this comment

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

here and in isUprefixedUuid: probably it would make sense to introduce static constants in order to avoid pattern recompilation on each call. For example,

private static final Pattern OID_PATTERN = Pattern.compile("\\d+(\\.\\d+)+");

public static boolean isUnprefixedOid(final String oid) {
return (oid != null) && OID_PATTERN.matcher(oid).matches();
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure!

}
return result;
}
if (identifier.hasSystem()) {
Copy link
Contributor

@unixoid unixoid Aug 19, 2024

Choose a reason for hiding this comment

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

proposal: change line 1011 to if ((identifier != null) && identifier.hasValue()) {, change line 1021 to simply } else {.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@qligier qligier force-pushed the 165-wrong-xon-generated-when-the-fhir-organization-has-no-system branch from 217b4d7 to 7aa87aa Compare August 22, 2024 07:56
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.

Wrong XON generated when the FHIR Organization has no system
3 participants