Stream: implementers
Topic: Tools for Extension and Export Creation
Sandra Mattes (Oct 09 2020 at 11:16):
Hello!
I am quite new with FHIR and I need to complete the task to transfer the user data of a mobile app to the hl7 fhir format and create an export in the fhir format.
As far as I've dived into the topic, the way to go will be to first check for existing profiles, datatypes and extensions. The most suitable way is to use the patient profile, add the patient's data to the profile, generate the format accordingly either in XML or JSON and use this for an interoperable export.
Nevertheless, I have checked the existing extensions, which do not suit my data. Therefore I need to write my own extension. I have a few questions here:
- Can I specify my own DataTypes? The data I want to transfer is more complex than a single value and does not match the existing datatypes.
- Is there any suitable tooling or libraries in any programming languages (preferrably javascript or golang) to help me transfer my data to the fhir format and generate export files?
- Have I understood correctly that extensions need to be created either in XML or JSON and publicated as either the XML/JSON file on a website?
I would appreciate any help.
Lloyd McKenzie (Oct 09 2020 at 12:23):
It's quite likely you'll need to use resources other than Patient. Patient only covers a limited set of demographic information. Insurance information would go in Coverage, past pregnancy information would go in Observation, etc. The next step after reviewing all of the potentially relevant resources and extensions is to raise detailed questions here explaining the meaning and purpose of your remaining elements to see if there are 'standard' ways to represent them that you might have missed or whether you truly need to create your own extensions.
You cannot define your own data types, however, if necessary, you can define complex extensions.
There is a Javascript reference implementation that will handle the serialization - look on the http://hl7.org/fhir/downloads.html page
If you are going to share data that contains an extension, the definition of the extension needs to be available to all of your recipients. The simplest way to do that is to place the StructureDefinition that defines the extension into a public registry. Note that there are tools like Forge and Trifolia that can help you with this process.
Sandra Mattes (Oct 12 2020 at 08:09):
@Lloyd McKenzie Thanks a lot for your explanation! I will certainly research more of the ressources (I've already checked some), nevertheless I think it is quite unlikely that I will find exactly the structures that I will need to implement. Among this data is activity data, diary entries in form of questions and answer, a patient's (achieved) therapeutic objectives, and therapy/medical appointments of the patient. For some of my health data, I've already found existing extensions to use.
I have looked into complex extensions, (e.g. the complex example of https://www.hl7.org/fhir/extensibility-examples.html) but if I've got that right, those can still only be build of (url, value) pairs in a tree-like structure and not contain multiple values like two strings and a date? Feels kinda complicated to build this way. As far as I've understood I use the "slicing" keyword" for adding multiple different extensions to a parent-extension, therefore write an extension "Parent" which contains a slicing with "Child1", "Child2", "Child3". Child 1 is for example a date-value, Child 2 and Child 3 have a string-value. If I now set the Cardinality of Parent to 0..*, the context Ressource can have as many instances of my parent as it gets (like my Parent is actually an appointment and I can add the 20 appointments that the patient has entered). Is this right?
I have already looked into the downloads page (examples, libraries). Is there any ressource you would recommend to understand the structure that I need to set up? I do not need to work with the fhir in any way except to parse my data into the format and publish my extensions. I do not quite get if I need to set up a fhir-server for that. I've looked into the fhir documentation and some youtube tutorials, but haven't actually got my answers.
I am sorry for the probably stupid questions :sweat:
Would you say Forge for usage in a commercial environment, but small startup, is worth the money?
Lloyd McKenzie (Oct 12 2020 at 12:53):
Activity data could be Procedure, Observation or QuestionnaireResponse. DIary entries would be QuestionnaireResponse. objectives would be Goal. Appointments would be Appointment. Every one of these things will be separate resource instances. If the patient has 20 appointments, that means 20 separate instances of the Appointment resource. If you need to convey all of this information together, you should look at the possibility of using a 'transaction' Bundle
Sandra Mattes (Oct 12 2020 at 13:13):
Oh so this means I do not assign such ressources to a patient/user but instead treat the data as own ressources. Thanks for the insights! I will take a look at the transaction bundle as I need to convey it as one data package.
Is there also already a ressource to transfer the Big Five personality traits? (https://en.wikipedia.org/wiki/Big_Five_personality_traits) Otherwise I think I would also treat this as an Observation Ressource.
Also the Goal would need a milestone (string). This would be a simple one-value extension for the Goal ressource.
I feel like I begin to understand how to use this. :smile:
Lloyd McKenzie (Oct 12 2020 at 13:25):
Each of the resources would link to the Patient via the 'subject' element. The big 5 would either be a single Observation or a collection of Observations, depending on whether the individual traits might reasonably be captured, shared or used independently. Milestone might be appropriate as an extension on Goal, but I'd suggest posting details about its definition and purpose here and seeing what the community thinks about it. They may recommend another solution or suggest submitting a change request to define a standard element or extension.
Sandra Mattes (Oct 12 2020 at 13:38):
Ok so the way to go is to create a Patient ressource, which is the subject to all my other Ressources (Account, Observations, Appointments, Goals...), which is delivered in a bundle.
The individual traits cannot be used independantly, as they define the personality of a person only in combination. Therefore logically it would be a single Observation.
Would you recommend another way to save the milestone (e.g. add it to the note, as it is actually only a string without further data like a due-date)? We are under a lot of time pressure right now to implement this feature and therefore a longer feedback loop to establish extensions with the community will probably be difficult. I did not know that extensions need to be added centrally, instead I thought you just define them, post them to your website and link the extension url in the data to the definition.
René Spronk (Oct 12 2020 at 13:43):
You can define anything you want locally, especially if you're in a hurry. It's kind of a best practice to see what others have done, or to harmonize your efforts with those of others, but it's not a requirement.
René Spronk (Oct 12 2020 at 13:44):
.. as long as you publish the definition of your extension, that is.
Sandra Mattes (Oct 12 2020 at 13:48):
Ok thanks :) If I want to post my efforts to the community for a discussion, would I rather post it in http://community.fhir.org/ or here?
René Spronk (Oct 12 2020 at 13:57):
That's up to you, this chat forum tends to attract most of the community though. I must admit to never reading the community.fhir.org forum, questions on that forum are however monitored by some FHIR community members.
Lloyd McKenzie (Oct 12 2020 at 14:07):
If you're using FHIR, presumably your objective is interoperability. That means expressing information consistently with how other systems do so.
To provide guidance on how to represent 'milestone', we'd need a better notion of what it is and what it's for. Just knowing the name of the element isn't necessarily sufficient to know what it is :)
Sandra Mattes (Oct 12 2020 at 14:18):
Yes, this is our goal :) The challenge is to maximize the possible interoperability and keep our deadlines :wink:
For further information: If you have a goal, you can set yourself a milestone. The milestone is a step on the way to the goal. Currently we have just the option of adding one milestone, which is only represented by its description. I need to discuss internally tomorrow if this is going to be further enhanced in the future (e.g. with a due date for the milestone or the possibility to add multiple milestones, and to save if the milestone was actually achieved). I guess this should be kept in mind when defining a possible format for the milestone.
Lloyd McKenzie (Oct 12 2020 at 14:40):
It sounds like a milestone is a sub-goal that leads to an overall goal? E.g. if my overall goal is to get to a healthy weight, I might have a sub-goal of losing 10 lbs over the next 2 months?
Sandra Mattes (Oct 12 2020 at 14:42):
Yes, that's also a way to view it. Could I implement a sub-goal by choosing the main goal as its subject?
Edit: nope just looked up the documentation, subject can only be Patient, Group or Organization)
Sandra Mattes (Oct 12 2020 at 14:45):
But it could probably be linked by the "addresses" field, as a sub goal adresses the main goal... edit: but goals still cannot be used there... thought i'd read that, my concentration is decreasing :sweat:
Lloyd McKenzie (Oct 12 2020 at 14:55):
There's a standard extension for relationships between goals, though it looks like we haven't defined a recommended value set for relationship types. My recommendation would be to use that and also submit a change request to define a few standard codes. (In the meantime, your project can proceed with a local code.)
Sandra Mattes (Oct 12 2020 at 15:02):
Ah great that looks suitable. Thanks a lot! I will post a change request for the types in a few days :)
Lloyd McKenzie (Oct 12 2020 at 15:03):
Thanks for taking the important first step and asking your questions here :)
Sandra Mattes (Oct 13 2020 at 11:45):
One more question... for finding the mandatory code for an Observation in the Loinc codes, is there another way except for downloading their .csv with 90k codes and searching for one that might fit my health data or activity data? And are the Loinc codes the only valid value set?
Michele Mottini (Oct 13 2020 at 12:42):
You can Google LOINC codes
Lloyd McKenzie (Oct 13 2020 at 13:51):
LOINC is not the only possible code system, but in the U.S. (and many other places) it's the preferred code system for observation types because it's free, pretty comprehensive and well maintained.
Sandra Mattes (Oct 13 2020 at 14:43):
Ah thanks for the insight. I've finally found matching codes and ressources for all of my data except for the big five personality traits :) There is actually a Loinc Code for the big five (https://loinc.org/LP241982-0/), but only for the languages Chinese and italian? I am not quite sure if this is valid to use... also, there is no code for any of the five traits as single observations and the Observation components can only have 0 or 1 value. :(
Lin Zhang (Oct 13 2020 at 15:57):
LP241982-0 is a LOINC Part Number for the Method Type "Big Five Inventory (BFI)" rather than an LOINC Observation code. Generally, LP Number are not intended to be used to encoding your data.
Lin Zhang (Oct 13 2020 at 16:01):
The LOINC Search results for BFI (44 hits)are as follows:
https://search.loinc.org/searchLOINC/search.zul?query=method%3ABFI
Lin Zhang (Oct 13 2020 at 16:08):
All these codes have Chinese and Italian translations in addition to their official English names (including question text in the Component field).
Lin Zhang (Oct 13 2020 at 16:26):
These codes are members of a quite larger LOINC Panel: 62710-9 PhenX domain - Psychiatric.
Lin Zhang (Oct 13 2020 at 16:32):
@Sandra Mattes You might need an Organizer to collect those BFI codes and the data values together. For now, there is no LOINC Code for such a panel yet. Given your tight timeline, maybe you could submit a new LOINC Term proposal for such a panel to the LOINC Committee later. And before this, you may want to create a local panel code for this purpose.
Sandra Mattes (Oct 14 2020 at 07:12):
@Lin Zhang so if I understand this correctly, I cannot use an LP number as a code but instead would have to use one of the codes in the PhenX domain. But those are only statements and no actual assignment of the big five traits. That's why I need to create local panel codes. A local panel code would be a code for the observation which I define, right? What is the best practice to do this? Would I publish the definition of those codes on my website and post the link in the "system" field of the coding to ensure interoperability until a new LOINC term is submitted?
Lin Zhang (Oct 14 2020 at 07:43):
What codes do you need? Result value codes (answers) or Observation codes (questions)?
Lin Zhang (Oct 14 2020 at 07:43):
What do mean by "actual assignments"?
Sandra Mattes (Oct 14 2020 at 07:58):
My data consists of a set of traits, e.g. extraversion and agreeableness which are assigned to a user after answering a questionnaire. The actual answers are not saved, only the result. This result is what I need to transfer to fhir ressources. My attempt here was to export the result (not answers) of the questionnaire as an Observation.
Lin Zhang (Oct 14 2020 at 07:58):
LOINC Part Numbers are more like internal codes and they should not be for free uses (See LOINC license terms).
Lin Zhang (Oct 14 2020 at 08:00):
My understanding is you are trying to export the conclusion of the questionnaire, right?
Lin Zhang (Oct 14 2020 at 08:01):
If yes, maybe you need a QuestionnaireResponse (I'm not sure) and an Observation to wrap it. @Grahame Grieve
Sandra Mattes (Oct 14 2020 at 08:14):
I am not quite sure what I am allowed to do with those codes. So they aren't the standard way to use for data representation in fhir? I am quite confused which codes to use, as I also have other data which is represented as Observations, and the code is mandatory. I've been reading the license terms, which says "LOINC codes and other information from the LOINC Table (and LOINC Table Core) may be used in electronic records and electronic messages in conjunction with laboratory test results and clinical observations without the need to include this Copyright Notice and License or a reference thereto in the message". But also "To prevent the dilution of LOINC’s purpose to provide a definitive standard for identifying clinical information in electronic reports, neither the Licensed Materials, nor any portion thereof, may be used for the purpose of developing or promulgating a different standard for identifying patient observations", therefore defining own codes next to using those codes is illegal? :dizzy:
I am just trying to understand how to define the codes of my Observations in the right way and according to the value set restrictions of the standard.
Yes, I am trying to export the conclusion of a questionnaire. By wrapping the QuestionnaireResponse you mean I reference the QuestionnaireResponse for example in the derivedFrom field of the observation?
Lin Zhang (Oct 14 2020 at 08:22):
About LP Numbers (From the license)
The LOINC parts and LOINC part hierarchies shall not be used in any manner except as they are presented in the Licensed Materials (and/or in other formats of distribution approved by Regenstrief Institute, Inc.) to organize, categorize, and be constituents of LOINC terms, and provide links to external terminologies. The LOINC parts and LOINC part hierarchies are subject to change, addition, modification, or deletion, without notice, and are not strictly managed under the same policies as LOINC terms.
Sandra Mattes (Oct 14 2020 at 08:28):
Ah so you meant that the license defines to use them only in the way they are defined and intended. I misunderstood that "they should not be for free uses" means they need to be paid for.
Lin Zhang (Oct 14 2020 at 08:53):
Such codes would be unsafe to use in terms of persistency. And there is no specific LOINC code for the BFI conclusion yet.
Sandra Mattes (Oct 14 2020 at 09:31):
Yeah I totally understand. I am now asking myself if it makes sense at all to use LOINC codes or if there is any other coding system I can use for my data. Is there a definition which sorts of other codes are valid (like SNOMED CT)? Only LOINC is mentioned in the documentation (https://www.hl7.org/fhir/observation.html), as it is preferred.
Lin Zhang (Oct 14 2020 at 09:42):
This is an example form based on LOINC Panel 91629-6 General Well-Being Schedule:
https://forms.loinc.org/91629-6
Maybe it's more intuitive and helpful to undertand your need.
Within the panel, the last code is for the total score.
And for your conclusion observation, you may need a nominal code like:
LOINC 94026-2 Bipolar disorder type
https://loinc.org/94026-2/
Sandra Mattes (Oct 14 2020 at 10:02):
Ah I see. Thanks for the example
Sandra Mattes (Oct 14 2020 at 10:04):
And I guess you can only use the conclusion code 94026-2 if this is the conclusion of exactly this panel?
Lin Zhang (Oct 14 2020 at 10:13):
Just an example code to show how-to but its meaning is irrelevant to your need.
Last updated: Apr 12 2022 at 19:14 UTC