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

Test Patient Compartment - Compare search forms (TestID13) #17

Open
nir-r opened this issue May 30, 2024 · 1 comment
Open

Test Patient Compartment - Compare search forms (TestID13) #17

nir-r opened this issue May 30, 2024 · 1 comment
Assignees

Comments

@nir-r
Copy link
Collaborator

nir-r commented May 30, 2024

Test13
If a patient compartment is declared (CapabilityStatement.rest.compartment) - check the equivalence of the 2 search forms below (for existing and non existing patients)

GET [base]/Patient/333/Condition
GET [base]/Condition?patient=333

@nir-r nir-r changed the title Test Patient Compartment - TestID13 Test Patient Compartment - Compare search forms (TestID13) Jun 5, 2024
@nir-r nir-r self-assigned this Jun 5, 2024
@nir-r
Copy link
Collaborator Author

nir-r commented Jul 18, 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')*/
)

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