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

Unable to generate medication card for CHUV010 (after export with bad GLN) #58

Open
arhuberg opened this issue May 10, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@arhuberg
Copy link

arhuberg commented May 10, 2023

The medication card was generated until I added one more MTP (30485b8b-e808-4eac-98e8-ca6904acf4cd) which triggered this error.

This is the EPRIK transaction: https://test.ahdis.ch/eprik-cara/index.html#/transaction/45143092-7d5b-42f4-a137-26c93ee74e37

{
  "headers": {
    "normalizedNames": {},
    "lazyUpdate": null
  },
  "status": 400,
  "statusText": "Bad Request",
  "url": "https://test.ahdis.ch/mag-pmp2/camel/xdsretrieve?uniqueId=urn:uuid:d76ee425-b0cf-4716-a798-efc8890f7e21&repositoryUniqueId=2.999.756.42.1",
  "ok": false,
  "name": "HttpErrorResponse",
  "message": "Http failure response for https://test.ahdis.ch/mag-pmp2/camel/xdsretrieve?uniqueId=urn:uuid:d76ee425-b0cf-4716-a798-efc8890f7e21&repositoryUniqueId=2.999.756.42.1: 400 Bad Request",
  "error": "An unexpected exception occurred (63fe2874)"
}

Caused by: ch.qligier.hug.pmp.common.error.exception.InvalidDocumentException: The PMLC generator failed to produce a valid document
at ch.qligier.hug.pmp.emed.ondemand.OnDemandMedicationCardAssembler.assemble(OnDemandMedicationCardAssembler.java:190)
at ch.qligier.hug.pmp.transaction.operation.retrieve.coprocessor.GenerateOdDocumentCoprocessor.generatePmlcDocument(GenerateOdDocumentCoprocessor.java:205)
... 98 common frames omitted

@arhuberg
Copy link
Author

mtp.zip

@qligier
Copy link
Member

qligier commented May 10, 2023

It seems to be an issue with the GLN identifier:

[ERROR] [INVARIANT] Rule gln-length: 'GLN must be exactly 13 characters long' Failed  in Bundle.entry[0].resource.entry[7].resource.ofType(MedicationStatement).contained[2].ofType(MedicationStatement).identifier[0].value [733:35] from source InstanceValidator from messageId Rule gln-length: 'GLN must be exactly 13 characters long' Failed
[ERROR] [INVARIANT] Rule gln-modulus-10: 'GLN must pass the modulus 10 check - https://www.gs1.org/services/how-calculate-check-digit-manually' Failed  in Bundle.entry[0].resource.entry[7].resource.ofType(MedicationStatement).contained[2].ofType(MedicationStatement).identifier[0].value [733:35] from source InstanceValidator from messageId Rule gln-modulus-10: 'GLN must pass the modulus 10 check - https://www.gs1.org/services/how-calculate-check-digit-manually' Failed
[ERROR] [INVARIANT] Rule gln-startswith7601: 'GLN must start with 7601 for swiss hcp' Failed  in Bundle.entry[0].resource.entry[7].resource.ofType(MedicationStatement).contained[2].ofType(MedicationStatement).identifier[0].value [733:35] from source InstanceValidator from messageId Rule gln-startswith7601: 'GLN must start with 7601 for swiss hcp' Failed

That won't work:

{
	"system": "urn:oid:2.51.1.3",
	"value": "AbCDefgH1111x"
}

@arhuberg
Copy link
Author

arhuberg commented May 10, 2023

OK - thanks. That is just bad test data.

Sorry I missed it in the log.

@qligier
Copy link
Member

qligier commented May 10, 2023

In the logs, the validation messages are dumped before the exception "The PMLC generator failed to produce a valid document".

Now I need to understand why the document was accepted, since it was invalid.

@qligier qligier added the bug Something isn't working label May 10, 2023
@arhuberg
Copy link
Author

arhuberg commented May 10, 2023

Should a bad GLN get rejected when the MTP/PADV is handled?

@qligier
Copy link
Member

qligier commented May 10, 2023

Sure, the same Practitioner definition applies (or should apply, since it was not the case) to all documents: https://build.fhir.org/ig/CARA-ch/ch-emed-epr/StructureDefinition-ch-emed-epr-practitioner.html

@arhuberg arhuberg changed the title Unable to generate medication card for CHUV010 Unable to generate medication card for CHUV010 (after export with bad GLN) Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants