# How to use null_flavor in the flat format? **Category:** [Platform](https://discourse.openehr.org/c/platform-implem/7) **Created:** 2021-01-02 12:17 UTC **Views:** 1481 **Replies:** 19 **URL:** https://discourse.openehr.org/t/how-to-use-null-flavor-in-the-flat-format/1196 --- ## Post #1 by @Sidharth_Ramesh My template uses the Glasgow Coma scale. The Ordinals in the Glasgow Coma scale archetype have a value and a null_flavor within the ELEMENT. There seems to be a lot of different paths that are being generated for these, based on the tools used. Using Better's template designer and the paths generated by concatenating the ids on a webtemplate this was obtained: /initial_assesment/glasgow_coma_scale_gcs/best_motor_response_m/ordinal_value /initial_assesment/glasgow_coma_scale_gcs/best_verbal_response_m/coded_text_value However their respective AQL paths are: /content[openEHR-EHR-OBSERVATION.glasgow_coma_scale.v1]/data[at0001]/events[at0002]/data[at0003]/items[at0008]/value /content[openEHR-EHR-OBSERVATION.glasgow_coma_scale.v1]/data[at0001]/events[at0002]/data[at0003]/items[at0008]/null_flavour And EHRBase webtemplates generated these paths: /initial_assesment/glasgow_coma_scale_gcs/best_motor_response_m /initial_assesment/glasgow_coma_scale_gcs/best_motor_response_m/null_flavour What is the correct way to handle null_flavor using flatforms? What should be the path to the ordinal and the null_flavor? --- ## Post #2 by @ian.mcnicoll For Better CDR... ``` { "initial_assesment/glasgow_coma_scale_gcs/best_motor_response_m/_null_flavour|code": "271", } ``` The following set of codes (or values) can be used: - 253: unknown - 271: no information - 272: masked - 273: not applicable I have not tested it with Ehrbase. --- ## Post #3 by @Sidharth_Ramesh There is an underscore too before null_flavor? _null_flavor and not null_flavor? What about the path for posting the ordinal? `initial_assesment/glasgow_coma_scale_gcs/best_motor_response_m` or `initial_assesment/glasgow_coma_scale_gcs/best_motor_response_m/value`? Any documentation or standardization for this? In fact, it was hard for me to find good documentation for flat formats too. Any proper resource? I figured it out from here, how to represent an ordinal (probably really old): https://docs.code4health.org/ES2-reference-model.html#key-openehr-concepts-and-classes This is supposed to have it for common data types, but misses out ordinal: https://openehr.atlassian.net/wiki/spaces/spec/pages/624361477/Simplified+Serial+Formats+-+Data+Types And the [official documentation](https://specifications.openehr.org/releases/ITS-REST/latest/simplified_data_template.html) has some JAVA code to generate the paths, but I haven't really used/tested them out. More explicit examples would definitely help people who're starting out. --- ## Post #4 by @ian.mcnicoll Some examples here ... https://freshehr.github.io/dhi-proms/dhis/DHIS6-committing-proms-data/ ``` "howru_score": [ { "pain_or_discomfort": [ { "|code": "at0041", "|value": "slight", "|ordinal": 1 } ], ``` so ?? `initial_assesment/glasgow_coma_scale_gcs/best_motor_response_m|value` `initial_assesment/glasgow_coma_scale_gcs/best_motor_response_m|code` `initial_assesment/glasgow_coma_scale_gcs/best_motor_response_m|ordinal` --- ## Post #5 by @birger.haarbrandt We will further align with Betters implementation in EHRbase and will also provide more examples and better documentation. For example, we should add an integration/unit test with these use-cases as reference. --- ## Post #6 by @surfer I have two related questions so I didn't think it was right to write them as a different topic. First a general question. @ian.mcnicoll The null flavour can be used for any kind of data? If I have legacy data whose I don't know the "start_time" should I use the null flavour to set it to unknown? The second question is platfom-specific. @birger.haarbrandt Is the null flavour available in the current release of EHRBASE for the flat format ? if yes what is the syntax? --- ## Post #7 by @ian.mcnicoll Hi Giovanni, 1. Null_flavour can only be use on Elements , not all attributes. I appreciate the problem ,particularly with dates e.g a procedure time for a historical surgical procedure, from a feeder system where no date is available. 2. The FLAT format is (I am not sure if it supported by EhrBase) ``` { "vitals/vitals/body_temperature/any_event/temperature/_null_flavour|value": "no information", } ``` or as code: ``` { "vitals/vitals/body_temperature/any_event/temperature/_null_flavour|code": "271", } ``` --- ## Post #8 by @thomas.beale Ian, where has that been described? Why is there an underscore in front of 'null_flavor'? I'd like to make some more progress on adding such things to the [Serial Data Formats spec](https://specifications.openehr.org/releases/SM/latest/serial_data_formats.html)... --- ## Post #9 by @surfer Thanks Ian. And what do you do when you have to insert a date (mandatory in the template) and you don't have it and can't retrieve it ? do you make a guess based on the dates (i f any) available in your input data or you put always the same date (e.g. a date in the distant past or future) that you treat as fake when you re-read the data? --- ## Post #10 by @ian.mcnicoll In a recent use-case we used a fake date, as this is what was understood by the customer anyway. I'm not pleased or prod of it but it was really the only practical solution. We should formalise this in the RM, as it is a not uncommon occurrence. @thomas.beale the use of `_null_flavour` is documented in Better's customer documentation. In the underscore is I think normally used where an rm attribute is being represented and where there might be a potential name collision with an archetyped node name. --- ## Post #11 by @thomas.beale [quote="ian.mcnicoll, post:10, topic:1196"] In a recent use-case we used a fake date, as this is what was understood by the customer anyway. I’m not pleased or prod of it but it was really the only practical solution. We should formalise this in the RM, as it is a not uncommon occurrence. [/quote] I'm not clear on this - are we talking about `/context/start_time`? I.e. the start date/time of the encounter? And if this is not available, normally you will use the time-stamp of the focal data item is, e.g. Observation.history.origin. We had discussions to add `ENTRY.effective_time()` to the RM (I thought we had a CR but I can't find it...), which returns the appropriate time from any kind of Entry. Anyway, calling that function on any concrete ENTRY object (OBS, EVAL etc) gives you the clinically relevant time, which is a fair substitute for `/context/start_time`. Or are we talking about some other time attribute? --- ## Post #12 by @ian.mcnicoll Specifically this is about ACTION.time as part of a procedure archetype but where the date cannot always be be provided by the source system. --- ## Post #13 by @thomas.beale Is the situation that you are importing an assertion that a procedure has been performed, but with no time info, i.e. could have been last week or 10 years ago? We have [this CR](https://openehr.atlassian.net/browse/SPECRM-100) to allow that particular field to be blank. --- ## Post #14 by @surfer @thomas.beale I don't understand practically how can I proceed. For example an ACTION radiation therapy has a time attribute. In flat format: "crc_cohort/therapies/radiation_therapy/radiation_therapy:0/time":"2009-04-06T00:00:00.00Z" Should I left ithe value blank with two parentheses? --- ## Post #15 by @thomas.beale [quote="surfer, post:14, topic:1196"] Should I left ithe value blank with two parentheses? [/quote] Right now you can't - as @ian.mcnicoll said above, you'll have to synthesise a value so the commit doesn't fail. The Change Request I linked above is to make that specific field optional in future. Obviously implementations won't deliver that change for some time, so in the interim you have to create a value. --- ## Post #16 by @surfer I see. Thanks for the clarification. I wanted to be sure to have understood. --- ## Post #17 by @SevKohler @sebastian.iancu @Bostjan_Lah are we using _null_flavour in the new spec for Flat or null_flavour what is correct ? --- ## Post #18 by @ian.mcnicoll Here is the format used in Better/EhrBase - my understanding is that we are not going to change this in the first official release ```` ```{“vitals/vitals/body_temperature/any_event/temperature/_null_flavour|code”: “271”,} ```` ```` ``` ```` --- ## Post #19 by @thomas.beale Why the leading underscore? --- ## Post #20 by @ian.mcnicoll AFAIK it is just a convention to ‘protect’ RM attribute names from colliding with archetype node names. --- **Canonical:** https://discourse.openehr.org/t/how-to-use-null-flavor-in-the-flat-format/1196 **Original content:** https://discourse.openehr.org/t/how-to-use-null-flavor-in-the-flat-format/1196