Rendering CCD-A viewer from code in React
# support
m
Hi everyone! I'm currently developing a healthcare app using Medplum and I have a question about the CCD-A viewer. I understand that Medplum provides a CCD-A viewer that can be used in a React application via their library. My question is: how can I render the CCD-A viewer from code if I already have the CCD-A file available in my project? The documentation explains how the viewer works when uploading a document as an attachment, but it’s not clear how to instantiate or display the viewer programmatically for a CCD-A file I already have (e.g. loaded via fetch or from a local file). Any guidance or examples would be greatly appreciated! Thanks in advance πŸ™Œ
r
Hello @Mauricio - are providers reviewing records, etc from the mobile?
m
Thanks for the quick reply! At this stage, it's a web application only β€” not targeting mobile specifically. We just want to render the CCD-A viewer in our React frontend using a CCD-A file we already have.
r
The Media resource should be the way see how it's done in the timeline https://storybook.medplum.com/?path=/story/medplum-timeline--basic - try uploading the CCD-A to the timeline of a patient to see how it works
(on the Medplum app)\
m
I'm trying to create a Media resource to display a CCD-A file in my app. I saw the example you shared in the Storybook with a video, but I'm not sure what the correct format is for uploading an .xml file. Could you guide me on how to structure the content property of the resource to work properly with a CCD-A? I'm attaching an image of what I'm trying to do. Thanks in advance!
r
Upload the Media file first (try it in the Medplum app for simplicity), then you can try to display it in your application. Here's a video

https://youtu.be/Eg0-mu-UYAQβ–Ύ

m
I understand how it works in the Medplum app. However, I want to test it in my application to simulate the arrival of the CCD-A through an endpoint. How should I configure the MediaResource so that the TimelineItem component interprets it correctly? Could you check the code I sent in my previous message? Thanks
269 Views