Hi,
I’m working with a resource called MedicnalProductAuthorization. Within there is a ‘validityPeriod’. which looks like this:
...
"validityPeriod": {
"start": "2022-03-17T08:34:57.991+00:002",
"end": "2022-03-25T08:34:57.991+00:00"
},
...
I am supposed to perform a search on this resource in following manner. While performing ‘create’ of Authorization, it is possible just to input a ‘start’ date, so some of the resources my look like this:
...
"validityPeriod": {
"start": "2022-03-17T08:34:57.991+00:002"
},
...
On FE there will be a date picker for ‘start’ and ‘end’ date. Assuming that ‘start’ is before ‘end’, my search needs to return something like on the image above (sorry about ugliness):
On the image above in cases where “En” is not shown, that means that ‘end’ is null and those resources should be included into search (CASE 6 and CASE2)
At the moment there are two search parameters for dates. They search ‘equal of after’ by the start date AND ‘equal or before’ by the end date:
Start date:
{
"resourceType": "SearchParameter",
"name": "Search MedicinalProductAuthorization validity period start",
"description": "Search MedicinalProductAuthorization validity period start",
"url": "http://fhir.by/SearchParameter/medicinal-product-authorization-validity-period-start-search-parameter",
"status": "active",
"code": "start-validity-period",
"base": [ "MedicinalProductAuthorization" ],
"type" : "date",
"expression": "MedicinalProductAuthorization.validityPeriod.start",
"xpathUsage": "normal",
"comparator" : ["eq",
"ne",
"gt",
"ge",
"lt",
"le",
"sa",
"eb",
"ap"]
}
and for ‘end’ date:
{
"resourceType": "SearchParameter",
"name": "Search MedicinalProductAuthorization validity period end",
"description": "Search MedicinalProductAuthorization validity period end",
"url": "http://fhir.by/SearchParameter/medicinal-product-authorization-validity-period-end-search-parameter",
"status": "active",
"code": "end-validity-period",
"base": [ "MedicinalProductAuthorization" ],
"type" : "date",
"expression": "MedicinalProductAuthorization.validityPeriod.end",
"xpathUsage": "normal",
"comparator" : ["eq",
"ne",
"gt",
"ge",
"lt",
"le",
"sa",
"eb",
"ap"]
}
In my java code, since we are using IGenericClient, I’m referencing those SP as follows:
public DaoConstants{
public static final String SP_AUTHORIZATION_START_VALIDITY_PERIOD =
"packagedMedicinalProduct.marketingAuthorization.start-validity-period";
public static final String SP_AUTHORIZATION_END_VALIDITY_PERIOD =
"packagedMedicinalProduct.marketingAuthorization.end-validity-period";
public static final DateClientParam AUTHORIZATION_START_VALIDITY_PERIOD =
new DateClientParam(SP_AUTHORIZATION_START_VALIDITY_PERIOD);
public static final DateClientParam AUTHORIZATION_END_VALIDITY_PERIOD =
new DateClientParam(SP_AUTHORIZATION_END_VALIDITY_PERIOD);
}
Part with “packagedMedicinalProduct.marketingAuthorization.” is just telling FHIR (when doing indexing of SP where to apply these SP). Relationship of our business objects is: MedicinalProduct (it has ‘packagedMedicinalProduct’ which contain references to MedicinalProductPackaged) → MedicinalProductPackaged (it has ‘marketingAuthorization’ which has references to MedicinalProductAuthorization).
I have a DTO for validityPeriod:
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ValidityPeriod {
/** Date from. */
@DateTimeFormat(iso = ISO.DATE)
@JsonAlias("start")
private Date startDate;
/** Date to. */
@DateTimeFormat(iso = ISO.DATE)
@JsonAlias("end")
private Date endDate;
}
What now is being sent is like this:
I see that on SearchParameter - FHIR v5.0.0 there are ‘multipleAnd’ and ‘multipleOr’. Does anyone can give me piece of advice on how to define SP for CASE1-6 and how to reference them in code? Maybe to use _filter?