Coder Social home page Coder Social logo

Comments (1)

nir-r avatar nir-r commented on July 25, 2024
/*General notes 1 - search equivalence => test searching by resourceType AND patient & in-patient compartment are equivalent*/
/*General notes 2 - test inclusion based on secondary/less common inclusion elements such as Condition.asserter (vs the obvious Condition.subject)*/ 
/*General notes 3 - 0 results in both searches isn't enough as it doesn't test inclusion by secondary elements*/
/*General notes 4 - it's ok to test primary and secondary inclusion element for different patients*/

(  

  /*List resourceTypes and Paths within them that point to Compartment Patient*/
  $resourceTypesPathsToPatientCompartment := 
  (
    /*List all paths relevant for Compartment Patient https://hl7.org/fhir/R4/compartmentdefinition-patient.json*/
      $PatientCompartmentResourcesParams := $readFile('compartmentdefinition-patient.json').resource[$exists(param)].param.{'resourceType':%.code, 'SPname':$}
  
    /*SearchParams reousrceTypes and paths ONLY for SPs refering Patient*/
      ;$SPreousrceTypesPaths := (
            $stpA := $readFile('search-parameters.json').entry.resource[
            type='reference' 
            and 'Patient' in target 
            and $not('Patient' in base)].{'SPname':name, 'expressionSplit':$split(expression,"|")}
          
          /*trim and remove where condition*/
          ;$stpB := $stpA.expressionSplit.{'expressionSplit':$substringBefore($trim($),'.where('), 'SPname':%.SPname}

          /*Extract resourceType*/
          ;$stpC := $stpB.{'SPpath':$substringAfter(expressionSplit,'.'),'fullSPpath':expressionSplit,'SPname':SPname,'resourceType':$substringBefore(expressionSplit,'.')}
        )
  
    /*Inner join defentions from compartmentdefinition-patient.json and search-parameters.json => list resourceTypes and paths to search*/
      ;$PatientCompartmentResourcesParams@$PCRP.($SPreousrceTypesPaths[$PCRP.resourceType=$.resourceType and $PCRP.SPname = $.SPname].{'resourceType':$.resourceType, 'SPpath':$.SPpath})
    )

  /*Check in CapStat if server declares support for patient compartment if not => warning and continue (may support w/o declaring)*/
    ;'http://hl7.org/fhir/CompartmentDefinition/patient' in $capabilities().rest.compartment ? 1 : 0

  /*Extract 1 instance per resourceType&inclusion path which is part of the Compartment Patient*/
    ;$SampledResources := $readFile('SampledResources.json')

    ;$resourceTypesPathsToPatientCompartment@$RTPTPC.($SampledResources[$RTPTPC.resourceType=$.resourceType and $exists($RTPTPC.SPpath)][0].{
      'id':id
      ,'resourceType':resourceType
      ,'SPpath':$RTPTPC.SPpath
      ,'SPpathValue':$eval($RTPTPC.SPpath).reference
      ,'PatiendID':$substringAfter($eval($RTPTPC.SPpath).reference,'/Patient/')
      })


  /*Stp0 - variables*/
/*  ;$compartments := $capabilities().rest.compartment.$substring(42).($uppercase($substring(0,1)) & $substring($,1))*/
  /*;$ServiceBaseURL := 'https://server.fire.ly/r4'$capabilities().implementation.url*/
  /*;$endPoint := ($ServiceBaseURL & '/' & $resourceType)*/
  /*;$endPointLen := $length($endPoint)*/



  /*Stp2 - Check required SearchParameters are supported (based on CS only or also test for un-documented support?)*/
/*  ;$capabilities().rest.resource[type='Observation'].searchParam[name='performer' and type='reference']~>$exists()*/
    /*?*/
    /*: $error('Lacking required searchParam')*/
)

from certificator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.