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

Analyse dateTime/Period/date/time elements #20

Open
2 tasks
nir-r opened this issue Jun 5, 2024 · 3 comments
Open
2 tasks

Analyse dateTime/Period/date/time elements #20

nir-r opened this issue Jun 5, 2024 · 3 comments
Assignees

Comments

@nir-r
Copy link
Collaborator

nir-r commented Jun 5, 2024

Requirment
Allow for temporal analysis by extracting relevant paths into a file and then analyzing it in the dashboard.

Implementation
All relevant dateTime/Period/date/time elements (from base or profiles) will be listed in an auxiliary file.
Currently, only elements defined in the base will be included.

  • Create paths file with the following attributes
  • path (resourceType.path)
  • Create a target file with the following attributes
  • DateTime
  • resource ID
  • resourceType

https://hl7.org/fhir/R4/datatypes.html#dateTime:~:text=3%5B0%2D1%5D))%3F)%3F-,dateTime,-A%20date%2C%20date

@nir-r nir-r self-assigned this Jun 5, 2024
@nir-r
Copy link
Collaborator Author

nir-r commented Jun 16, 2024

/*List dateTime/Period/date/time elements in server-supported resources*/
(
  /*List all supported resources*/
   $SupportedResourceTypes := $capabilities().rest.resource[type in ['Patient','Practitioner','PractitionerRole','Observation','Encounter','Procedure']].type /*remove [] filtering on prod*/;

  /*For each supported resource, list date/time/period elements*/
    $elements := $SupportedResourceTypes.$getSnapshot($).snapshot.element[type.code='dateTime' or type.code='date' or type.code='time' or type.code='Period'].{
      'resourceType': $substringBefore(path,".")
      ,'path': path
      ,'elementPath' : $substringAfter(path,$substringBefore(path,".") & '.')
      ,'id':id
      ,"dataType": type.code
      };

  /*List relevant (date/time/period elements) paths*/
    $writeFile($elements,'DateTimeElements.json')
)

@nir-r nir-r changed the title Analyse dateTime elements Analyse dateTime/Period/date/time elements Jun 16, 2024
@nir-r
Copy link
Collaborator Author

nir-r commented Jun 20, 2024

/*Extract dateTime/Period/date/time elements from the sample and write to a target file by type*/
(
  $DateTimeElements := $readFile('DateTimeElements.json');

  $SampledResources := $readFile('SampledResources.json');

  $ElementsValues := $DateTimeElements@$dte.($SampledResources[resourceType=$dte.resourceType].(
      $instance := $;
      $value := $eval($dte.elementPath);
      $value#$i.{
      'resourceType': $instance.resourceType
      ,'id': $instance.id
      ,'path': $dte.path
      ,'dataType' : $dte.dataType
      ,'index': $i
      ,'value': $
      }
    ));
  
  $ElementsValues^(dataType,id,path,index)
)

@nir-r
Copy link
Collaborator Author

nir-r commented Jun 20, 2024

/*Extract dateTime/Period/date/time elements from the sample and write to a target file by type*/
(
  $DateTimeElements := $readFile('DateTimeElements.json');

  $SampledResources := $readFile('SampledResources.json');

  $ElementsValues := $DateTimeElements@$dte.($SampledResources[resourceType=$dte.resourceType].{
    'resourceType': resourceType
    ,'id': id
    ,'path': $dte.path
    ,'dataType' : $dte.dataType
    ,'value': $eval($dte.elementPath)
    });
  
  $ElementsValues.value#$i.{
    'resourceType': %.resourceType
    ,'id': %.id
    ,'path': %.path
    ,'dataType' : %.dataType
    ,'index' : $i 
    ,'value': $
    }
)
```
/*Extract dateTime/Period/date/time elements from the sample and write to a target file by type*/
(
  $DateTimeElements := $readFile('DateTimeElements.json');

  $SampledResources := $readFile('SampledResources.json');

  $ElementsValues := $DateTimeElements@$dte.($SampledResources[resourceType=$dte.resourceType].{
    'resourceType': resourceType
    ,'id': id
    ,'path': $dte.path
    ,'dataType' : $dte.dataType
    ,'value': $eval($dte.elementPath)
    });
  
  $ElementsValues.value#$i.{
    'resourceType': %.resourceType
    ,'id': %.id
    ,'path': %.path
    ,'dataType' : %.dataType
    ,'index' : $i 
    ,'value': $
    }
)

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

No branches or pull requests

1 participant