From 279d081ac4ea6b4eb1264e342ac21a675461b168 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Mon, 10 Oct 2022 11:47:28 +0100 Subject: [PATCH 01/24] Rename sample bundle --- example_data/{sampleFHIR_V2.json => sample_bundle.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename example_data/{sampleFHIR_V2.json => sample_bundle.json} (100%) diff --git a/example_data/sampleFHIR_V2.json b/example_data/sample_bundle.json similarity index 100% rename from example_data/sampleFHIR_V2.json rename to example_data/sample_bundle.json From 4b7e371ee26315c2c8c0f596e528d1d44a23db1c Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Mon, 10 Oct 2022 11:53:14 +0100 Subject: [PATCH 02/24] Reorder and trim down bundle to match new version more easily --- example_data/sample_bundle.json | 955 ++++++-------------------------- 1 file changed, 173 insertions(+), 782 deletions(-) diff --git a/example_data/sample_bundle.json b/example_data/sample_bundle.json index 19facf6..ad0c248 100644 --- a/example_data/sample_bundle.json +++ b/example_data/sample_bundle.json @@ -2,72 +2,6 @@ "resourceType": "Bundle", "type": "transaction", "entry": [ - { - "fullUrl": "DiagnosticReport/a425799a-a905-d750-7e1e-a9c573581a81", - "resource": { - "resourceType": "DiagnosticReport", - "id": "a425799a-a905-d750-7e1e-a9c573581a81", - "meta": { - "profile": [ - "http://hl7.org/fhir/StructureDefinition/genomicreport" - ] - }, - "status": "final", - "code": { - "coding": [ - { - "system": "http://snomed.info/sct", - "code": "230387008", - "display": "Benign occipital epilepsy of childhood - early onset variant" - } - ] - }, - "subject": { - "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" - }, - "effectiveDateTime": "2020-04-06", - "resultsInterpreter": [ - { - "type": "Practitioner", - "reference": "Practitioner/d3447490-96fd-35d0-adf2-0806e5214606" - }, - { - "type": "Practitioner", - "reference": "Practitioner/46743741-9466-e472-6b5f-5241f323ca74" - } - ], - "specimen": [ - { - "type": "Specimen", - "reference": "Specimen/fb82860d-eabc-a8d0-b341-facdff0ac0f1" - } - ], - "result": [ - { - "type": "Observation", - "reference": "Observation/5306f3f5-1516-6570-5b7c-709acb175a5a" - }, - { - "type": "Observation", - "reference": "Observation/964a870c-7c87-9b74-1d87-8f9f9cdf5a86" - }, - { - "type": "Observation", - "reference": "Observation/30bcab0e-d857-0102-55d4-4936a1515607" - }, - { - "type": "Observation", - "reference": "Observation/4562be7f-bb42-e0b2-0426-465e3e37952d" - } - ], - "conclusion": "Consistent with a diagnosis of Rett syndrome." - }, - "request": { - "method": "POST", - "url": "DiagnosticReport" - } - }, { "fullUrl": "Organization/85940927-468f-f53d-864a-7a50b48d73f1", "resource": { @@ -460,23 +394,55 @@ } }, { - "fullUrl": "Observation/964a870c-7c87-9b74-1d87-8f9f9cdf5a86", + "fullUrl": "Task/5f3f5638-3870-1a14-b490-b6081dfc8352", "resource": { - "resourceType": "Observation", - "id": "964a870c-7c87-9b74-1d87-8f9f9cdf5a86", - "status": "final", + "resourceType": "Task", + "id": "5f3f5638-3870-1a14-b490-b6081dfc8352", + "meta": { + "profile": [ + "http://hl7.org/fhir/StructureDefinition/task-rec-followup" + ] + }, + "status": "requested", + "intent": "plan", "code": { "coding": [ { "system": "http://loinc.org", - "code": "69548-6", - "display": "Genetic variant assesment" + "code": "LA14020-4", + "display": "Genetic counseling recommended" } ] }, + "description": "Testing of General Manager's parents is recommended to determine whether the SCN1A c.2101C>T pathogenic variant has arisen de novo and", + "for": { + "type": "Patient", + "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" + } + }, + "request": { + "method": "POST", + "url": "Task" + } + }, + { + "fullUrl": "Observation/6d16ee18-5521-16dd-2ba4-b180cb69ca38", + "resource": { + "resourceType": "Observation", + "id": "6d16ee18-5521-16dd-2ba4-b180cb69ca38", + "status": "final", "meta": { "profile": [ - "http://hl7.org/fhir/uv/genomics-reporting/StructureDefinition/variant" + "http://hl7.org/fhir/uv/genomics-reporting/StructureDefinition/overall-interpretation" + ] + }, + "code": { + "coding": [ + { + "system": "http://loinc.org", + "code": "51968-6", + "display": "Genetic disease analysis overall interpretation" + } ] }, "subject": { @@ -491,739 +457,164 @@ { "type": "Practitioner", "reference": "Practitioner/d3447490-96fd-35d0-adf2-0806e5214606" - }, + } + ], + "category": [ { - "type": "Practitioner", - "reference": "Practitioner/46743741-9466-e472-6b5f-5241f323ca74" + "coding": [ + { + "system": "http://terminology.hl7.org/obs-category", + "code": "laboratory", + "display": "Laboratory" + } + ] } ], - "note": [ + "valueString": "Next generation sequence analysis indicates that General Manager is heterozygous for the MECP2 c.953G>C p.(Arg318Pro) likely pathogenic variant that has been confirmed by Sanger sequence analysis" + }, + "request": { + "method": "POST", + "url": "Observation" + } + }, + { + "fullUrl": "ServiceRequest/c87a7463-19c1-6a0d-0feb-d845d0dfae43", + "resource": { + "resourceType": "ServiceRequest", + "id": "c87a7463-19c1-6a0d-0feb-d845d0dfae43", + "meta": { + "profile": [ + "http://hl7.org/fhir/StructureDefinition/servicerequest" + ] + }, + "status": "active", + "intent": "order", + "supportingInfo": [ { - "authorString": "gene information", - "text": "BRAT1: Biallelic pathogenic variants cause lethal neonatal rigidity and multifocal seizures syndrome (RMFSL) (MIM 614498) which is a severe autosomal recessive epileptic encephalopathy; affected infants achieve no developmental milestones and die within the first months or years of life." + "reference": "PlanDefinition/38018b47-b29a-8b06-daf6-6c5f2577bffa" } ], - "component": [ + "subject": { + "type": "Patient", + "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" + }, + "category": [ { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "51958-7", - "display": "Transcript reference sequence [ID]" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://www.ncbi.nlm.nih.gov/refseq", - "code": "NM_032504.1" - } - ] + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "108252007", + "display": "Laboratory procedure" + } + ] + } + ], + "reasonCode": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "230387008", + "display": "Benign occipital epilepsy of childhood - early onset variant" + } + ], + "text": "Sequence variant screening in General Manager because of seizures and developmental delay. There is a clinical suspicion of Dravet Syndrome." + } + ] + }, + "request": { + "method": "POST", + "url": "ServiceRequest" + } + }, + { + "fullUrl": "PlanDefinition/38018b47-b29a-8b06-daf6-6c5f2577bffa", + "resource": { + "resourceType": "PlanDefinition", + "id": "38018b47-b29a-8b06-daf6-6c5f2577bffa", + "status": "active", + "subjectReference": { + "type": "Patient", + "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" + }, + "description": "Screening of 82 genes associated with severe delay and seizures (ADSL, ALG13, ARHGEF9, ARX, ATP1A3, ATRX, BRAT1, CDKL5, CHD2, CHRNA2, CHRNA4, CHRNB2, CLN5, CLN6, CLN8, CNTNAP2, DNM1, DOCK7, DYRK1A, EHMT1, FOXG1, GABRA1, GABRB3, GATAD2B, GNAO1, GRIN1, GRIN2A, GRIN2B, HCN1, IQSEC2, KCNA2, KCNB1, KCNC1, KCNQ2, KCNT1, KIAA1279 (KIF1BP), KIAA2022, LGI1, MAGI2, MBD5, MECP2, MEF2C, MFSD8, NACC1, NRXN1, PCDH19, PIGA, PIGN, PLCB1, PNKP, POLG, PRRT2, PURA, QARS, SCN1A, SCN1B, SCN2A, SCN8A, SETD5, SIK1, SLC12A5, SLC13A5, SLC16A2, SLC25A22, SLC2A1, SLC35A2, SLC6A1, SLC9A6, SMC1A, SPTAN1, STX1B, STXBP1, SYNGAP1, TBC1D24, TCF4, TPP1, UBE2A, UBE3A, UNC80, WDR45, WWOX, ZEB2) was carried out using next generation sequencing (Agilent SureSelect + MiSeq/NextSeq). *Pseudogenes with significant sequence homology to DMN1 exons 18, 19, 20 and 22 may result in incorrect coverage data for this gene and variants in these exons may not be detected. 99.6% of the coding bases in the targeted genes were covered >30x. Sequencing includes the coding region of the genes targeted, including intron/exon splice regions (-14 splice acceptor and +6 splice donor, unless otherwise specified). Inhouse validation attributes a minimum sensitivity of 99.9% to detect single nucleotide substitutions (with 95% confidence) and 77% for insertion/deletion variants (with 95% confidence) for regions covered by 30 or more reads. Variants are classified using the ACMG/AMP guidelines (Richards et al 2015 Genet Med) /ACGS Best Practice guidelines (2019).", + "relatedArtifact": [ + { + "type": "citation", + "citation": "(1) Shapiro et al Pediatr Res. 2010 Nov;68(5):446-51. (2) Neul et al Am J Med Genet B Neuropsychiatr Genet. 2019 Jan;180(1):55-67. (3) Cheadle et al, Hum Mol Genet. 2000, 9, 1119-1129.", + "display": "Gene reference" + } + ] + }, + "request": { + "method": "POST", + "url": "PlanDefinition" + } + }, + { + "fullUrl": "DiagnosticReport/a425799a-a905-d750-7e1e-a9c573581a81", + "resource": { + "resourceType": "DiagnosticReport", + "id": "a425799a-a905-d750-7e1e-a9c573581a81", + "meta": { + "profile": [ + "http://hl7.org/fhir/StructureDefinition/genomicreport" + ] + }, + "status": "final", + "code": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "230387008", + "display": "Benign occipital epilepsy of childhood - early onset variant" } + ] + }, + "subject": { + "type": "Patient", + "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" + }, + "effectiveDateTime": "2020-04-06", + "resultsInterpreter": [ + { + "type": "Practitioner", + "reference": "Practitioner/d3447490-96fd-35d0-adf2-0806e5214606" }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "48004-6", - "display": "DNA change (c.HGVS)" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://varnomen.hgvs.org", - "code": "NM_032504.1:c.923G>C" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "48005-3", - "display": "Amino acid change (pHGVS)" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://varnomen.hgvs.org/", - "code": "p.(Arg701*)" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "53034-5", - "display": "zygosity" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://loinc.org", - "code": "LA6706-1", - "display": "Heterozygous" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "53037-8", - "display": "Clinical significance" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://loinc.org", - "code": " LA26333-7", - "display": "Uncertain significance" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "79742-3", - "display": "Inheritance pattern based on family history" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://loinc.org", - "code": " LA24722-3", - "display": "Family history is unknown or not recorded" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://www.genenames.org/geneId", - "code": "HGNC:21701" - } - ] - }, - "valueString": "BRAT1" - }, - { - "code": { - "coding": [ - { - "system": "http://hl7.org/evidence", - "code": "evidence", - "display": "Evidence for classification of variant" - } - ] - }, - "valueString": "Predicted null variant where loss of function is known disease mechanism (PVS1_very strong). Absent from the gnomAD population database (PM2_Moderate)." - }, - { - "code": { - "coding": [ - { - "system": "http://hl7.org/variant", - "code": "confirmed-variant" - } - ] - }, - "valueBoolean": false - } - ] - }, - "request": { - "method": "POST", - "url": "Observation" - } - }, - { - "fullUrl": "Observation/30bcab0e-d857-0102-55d4-4936a1515607", - "resource": { - "resourceType": "Observation", - "id": "30bcab0e-d857-0102-55d4-4936a1515607", - "status": "final", - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "69548-6", - "display": "Genetic variant assesment" - } - ] - }, - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/genomics-reporting/StructureDefinition/variant" - ] - }, - "subject": { - "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" - }, - "specimen": { - "type": "Specimen", - "reference": "Specimen/fb82860d-eabc-a8d0-b341-facdff0ac0f1" - }, - "performer": [ - { - "type": "Practitioner", - "reference": "Practitioner/d3447490-96fd-35d0-adf2-0806e5214606" - }, - { - "type": "Practitioner", - "reference": "Practitioner/46743741-9466-e472-6b5f-5241f323ca74" - } - ], - "note": [ - { - "authorString": "gene information", - "text": "UNC80: Biallelic pathogenic variants cause infantile hypotonia with psychomotor retardation and characteristic facies-2 (IHPRF2) (MIM 616801) which is a severe neurodevelopmental disorder with onset at birth or in early infancy. Affected individuals show severe global developmental delay with poor or absent speech and absent or limited ability to walk." - } - ], - "component": [ - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "51958-7", - "display": "Transcript reference sequence [ID]" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://www.ncbi.nlm.nih.gov/refseq", - "code": "NM_001110792.1" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "48004-6", - "display": "DNA change (c.HGVS)" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://varnomen.hgvs.org", - "code": "NM_001110792.1:c.606G>A" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "48005-3", - "display": "Amino acid change (pHGVS)" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://varnomen.hgvs.org/", - "code": "p.(Lys422Serfs*28)" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "53034-5", - "display": "zygosity" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://loinc.org", - "code": "LA6705-3", - "display": "Homozygous" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "53037-8", - "display": "Clinical significance" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://loinc.org", - "code": " LA6668-3", - "display": "Pathogenic" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "79742-3", - "display": "Inheritance pattern based on family history" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://loinc.org", - "code": " LA24640-7", - "display": "Autosomal dominant" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://www.genenames.org/geneId", - "code": " HGNC:26582" - } - ] - }, - "valueString": "UNC80" - }, - { - "code": { - "coding": [ - { - "system": "http://hl7.org/evidence", - "code": "evidence", - "display": "Evidence for classification of variant" - } - ] - }, - "valueString": "Absent from the gnomAD population database (PM2_Moderate). Predicted null variant where loss of function is known disease mechanism (PVS1_very strong)." - }, - { - "code": { - "coding": [ - { - "system": "http://hl7.org/variant", - "code": "confirmed-variant" - } - ] - }, - "valueBoolean": true - } - ] - }, - "request": { - "method": "POST", - "url": "Observation" - } - }, - { - "fullUrl": "Observation/4562be7f-bb42-e0b2-0426-465e3e37952d", - "resource": { - "resourceType": "Observation", - "id": "4562be7f-bb42-e0b2-0426-465e3e37952d", - "status": "final", - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "69548-6", - "display": "Genetic variant assesment" - } - ] - }, - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/genomics-reporting/StructureDefinition/variant" - ] - }, - "subject": { - "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" - }, - "specimen": { - "type": "Specimen", - "reference": "Specimen/fb82860d-eabc-a8d0-b341-facdff0ac0f1" - }, - "performer": [ - { - "type": "Practitioner", - "reference": "Practitioner/d3447490-96fd-35d0-adf2-0806e5214606" - }, - { - "type": "Practitioner", - "reference": "Practitioner/46743741-9466-e472-6b5f-5241f323ca74" - } - ], - "note": [ - { - "authorString": "gene information", - "text": "MECP3: Pathogenic variants in MECP3 can cause a variety of X-linked conditions: Rett syndrome (OMIM, 312750), neonatal severe encephalopathy (OMIM,300673), and X-linked syndromic mental retardation (OMIM 300260 and 300055)." - } - ], - "component": [ - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "51958-7", - "display": "Transcript reference sequence [ID]" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://www.ncbi.nlm.nih.gov/refseq", - "code": "NM_002693.2" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "48004-6", - "display": "DNA change (c.HGVS)" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://varnomen.hgvs.org", - "code": "NM_002693.2:c.849-5A>G" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "48005-3", - "display": "Amino acid change (pHGVS)" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://varnomen.hgvs.org/", - "code": "p.(Lys422Serfs*28)" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "53034-5", - "display": "zygosity" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://loinc.org", - "code": " LA6707-9", - "display": "Hemizygous" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "53037-8", - "display": "Clinical significance" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://loinc.org", - "code": " LA6668-3", - "display": "Pathogenic" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "79742-3", - "display": "Inheritance pattern based on family history" - } - ] - }, - "valueCodeableConcept": { - "coding": [ - { - "system": "http://loinc.org", - "code": "LA24947-6", - "display": "X-linked" - } - ] - } - }, - { - "code": { - "coding": [ - { - "system": "http://www.genenames.org/geneId", - "code": "HGNC:6990" - } - ] - }, - "valueString": "MECP2" - }, - { - "code": { - "coding": [ - { - "system": "http://hl7.org/evidence", - "code": "evidence", - "display": "Evidence for classification of variant" - } - ] - }, - "valueString": "Absent from the gnomAD population database (PM2_Moderate). Predicted null variant where loss of function is known disease mechanism (PVS1_very strong)." - }, - { - "code": { - "coding": [ - { - "system": "http://hl7.org/variant", - "code": "confirmed-variant" - } - ] - }, - "valueBoolean": true - } - ] - }, - "request": { - "method": "POST", - "url": "Observation" - } - }, - { - "fullUrl": "Task/5f3f5638-3870-1a14-b490-b6081dfc8352", - "resource": { - "resourceType": "Task", - "id": "5f3f5638-3870-1a14-b490-b6081dfc8352", - "meta": { - "profile": [ - "http://hl7.org/fhir/StructureDefinition/task-rec-followup" - ] - }, - "status": "requested", - "intent": "plan", - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "LA14020-4", - "display": "Genetic counseling recommended" - } - ] - }, - "description": "Testing of General Manager's parents is recommended to determine whether the SCN1A c.2101C>T pathogenic variant has arisen de novo and", - "for": { - "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" - } - }, - "request": { - "method": "POST", - "url": "Task" - } - }, - { - "fullUrl": "Observation/6d16ee18-5521-16dd-2ba4-b180cb69ca38", - "resource": { - "resourceType": "Observation", - "id": "6d16ee18-5521-16dd-2ba4-b180cb69ca38", - "status": "final", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/genomics-reporting/StructureDefinition/overall-interpretation" - ] - }, - "code": { - "coding": [ - { - "system": "http://loinc.org", - "code": "51968-6", - "display": "Genetic disease analysis overall interpretation" - } - ] - }, - "subject": { - "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" - }, - "specimen": { - "type": "Specimen", - "reference": "Specimen/fb82860d-eabc-a8d0-b341-facdff0ac0f1" - }, - "performer": [ { "type": "Practitioner", - "reference": "Practitioner/d3447490-96fd-35d0-adf2-0806e5214606" + "reference": "Practitioner/46743741-9466-e472-6b5f-5241f323ca74" } ], - "category": [ + "specimen": [ { - "coding": [ - { - "system": "http://terminology.hl7.org/obs-category", - "code": "laboratory", - "display": "Laboratory" - } - ] + "type": "Specimen", + "reference": "Specimen/fb82860d-eabc-a8d0-b341-facdff0ac0f1" } ], - "valueString": "Next generation sequence analysis indicates that General Manager is heterozygous for the MECP2 c.953G>C p.(Arg318Pro) likely pathogenic variant that has been confirmed by Sanger sequence analysis" - }, - "request": { - "method": "POST", - "url": "Observation" - } - }, - { - "fullUrl": "ServiceRequest/c87a7463-19c1-6a0d-0feb-d845d0dfae43", - "resource": { - "resourceType": "ServiceRequest", - "id": "c87a7463-19c1-6a0d-0feb-d845d0dfae43", - "meta": { - "profile": [ - "http://hl7.org/fhir/StructureDefinition/servicerequest" - ] - }, - "status": "active", - "intent": "order", - "supportingInfo": [ + "result": [ { - "reference": "PlanDefinition/38018b47-b29a-8b06-daf6-6c5f2577bffa" - } - ], - "subject": { - "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" - }, - "category": [ + "type": "Observation", + "reference": "Observation/5306f3f5-1516-6570-5b7c-709acb175a5a" + }, { - "coding": [ - { - "system": "http://snomed.info/sct", - "code": "108252007", - "display": "Laboratory procedure" - } - ] - } - ], - "reasonCode": [ + "type": "Observation", + "reference": "Observation/964a870c-7c87-9b74-1d87-8f9f9cdf5a86" + }, { - "coding": [ - { - "system": "http://snomed.info/sct", - "code": "230387008", - "display": "Benign occipital epilepsy of childhood - early onset variant" - } - ], - "text": "Sequence variant screening in General Manager because of seizures and developmental delay. There is a clinical suspicion of Dravet Syndrome." - } - ] - }, - "request": { - "method": "POST", - "url": "ServiceRequest" - } - }, - { - "fullUrl": "PlanDefinition/38018b47-b29a-8b06-daf6-6c5f2577bffa", - "resource": { - "resourceType": "PlanDefinition", - "id": "38018b47-b29a-8b06-daf6-6c5f2577bffa", - "status": "active", - "subjectReference": { - "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" - }, - "description": "Screening of 82 genes associated with severe delay and seizures (ADSL, ALG13, ARHGEF9, ARX, ATP1A3, ATRX, BRAT1, CDKL5, CHD2, CHRNA2, CHRNA4, CHRNB2, CLN5, CLN6, CLN8, CNTNAP2, DNM1, DOCK7, DYRK1A, EHMT1, FOXG1, GABRA1, GABRB3, GATAD2B, GNAO1, GRIN1, GRIN2A, GRIN2B, HCN1, IQSEC2, KCNA2, KCNB1, KCNC1, KCNQ2, KCNT1, KIAA1279 (KIF1BP), KIAA2022, LGI1, MAGI2, MBD5, MECP2, MEF2C, MFSD8, NACC1, NRXN1, PCDH19, PIGA, PIGN, PLCB1, PNKP, POLG, PRRT2, PURA, QARS, SCN1A, SCN1B, SCN2A, SCN8A, SETD5, SIK1, SLC12A5, SLC13A5, SLC16A2, SLC25A22, SLC2A1, SLC35A2, SLC6A1, SLC9A6, SMC1A, SPTAN1, STX1B, STXBP1, SYNGAP1, TBC1D24, TCF4, TPP1, UBE2A, UBE3A, UNC80, WDR45, WWOX, ZEB2) was carried out using next generation sequencing (Agilent SureSelect + MiSeq/NextSeq). *Pseudogenes with significant sequence homology to DMN1 exons 18, 19, 20 and 22 may result in incorrect coverage data for this gene and variants in these exons may not be detected. 99.6% of the coding bases in the targeted genes were covered >30x. Sequencing includes the coding region of the genes targeted, including intron/exon splice regions (-14 splice acceptor and +6 splice donor, unless otherwise specified). Inhouse validation attributes a minimum sensitivity of 99.9% to detect single nucleotide substitutions (with 95% confidence) and 77% for insertion/deletion variants (with 95% confidence) for regions covered by 30 or more reads. Variants are classified using the ACMG/AMP guidelines (Richards et al 2015 Genet Med) /ACGS Best Practice guidelines (2019).", - "relatedArtifact": [ + "type": "Observation", + "reference": "Observation/30bcab0e-d857-0102-55d4-4936a1515607" + }, { - "type": "citation", - "citation": "(1) Shapiro et al Pediatr Res. 2010 Nov;68(5):446-51. (2) Neul et al Am J Med Genet B Neuropsychiatr Genet. 2019 Jan;180(1):55-67. (3) Cheadle et al, Hum Mol Genet. 2000, 9, 1119-1129.", - "display": "Gene reference" + "type": "Observation", + "reference": "Observation/4562be7f-bb42-e0b2-0426-465e3e37952d" } - ] + ], + "conclusion": "Consistent with a diagnosis of Rett syndrome." }, "request": { "method": "POST", - "url": "PlanDefinition" + "url": "DiagnosticReport" } } ] From 89e4341e00e50b67aba44408237674e986a0f5f4 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Mon, 10 Oct 2022 11:54:33 +0100 Subject: [PATCH 03/24] Add eze's newest example bundle --- example_data/sample_bundle.json | 381 +++++++++++++++++++++----------- 1 file changed, 249 insertions(+), 132 deletions(-) diff --git a/example_data/sample_bundle.json b/example_data/sample_bundle.json index ad0c248..b72edae 100644 --- a/example_data/sample_bundle.json +++ b/example_data/sample_bundle.json @@ -1,13 +1,23 @@ { "resourceType": "Bundle", - "type": "transaction", + "type": "batch", "entry": [ { - "fullUrl": "Organization/85940927-468f-f53d-864a-7a50b48d73f1", + "fullUrl": "Organization/gosh-redcap-20RG-205G0047", "resource": { - "id": "85940927-468f-f53d-864a-7a50b48d73f1", "resourceType": "Organization", + "id": "gosh-redcap-20RG-205G0047", + "identifier": [ + { + "system": "http://term.hl7.org/CodeSystem/org-id-codes", + "value": "gosh-redcap-20RG-205G0047" + } + ], "active": true, + "text": { + "status": "generated", + "div": "
1 North London Lab
" + }, "type": [ { "coding": [ @@ -20,12 +30,17 @@ "text": "NHS UK Healthcare Provider" } ], - "name": "Great Ormond Street Hospital for Children NHS Foundation Trust", + "name": "North London Lab 1", + "telecom": [ + { + "system": "phone", + "value": "2078298870" + } + ], "address": [ { "line": [ - "Level 4 Barclays House", - "37 Queens Square" + "Levels 4-6 Barclay House, 37 Queen Square" ], "city": "London", "postalCode": "WC1N 3BH", @@ -34,72 +49,75 @@ ] }, "request": { - "method": "POST", - "url": "Organization" + "method": "PUT", + "url": "Organization?_id=gosh-redcap-20RG-205G0047" } }, { - "fullUrl": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625", + "fullUrl": "Patient/gosh-redcap-40388914", "resource": { "resourceType": "Patient", - "id": "37176e84-d977-e993-3c49-d76fcfc6e625", + "id": "gosh-redcap-40388914", "active": true, "name": [ { - "family": "Manager", + "family": "BrighGosh321", "given": [ - "General" + "Maria321" ] } ], - "gender": "female", - "birthDate": "2016-06-01", - "managingOrganization": { - "reference": "Organization/85940927-468f-f53d-864a-7a50b48d73f1" + "gender": "male", + "birthDate": "2019-08-02", + "text": { + "status": "generated", + "div": "
Maria321 BrighGosh321 from RedCap FHIR
" }, "identifier": [ { - "value": "40057119" + "use": "official", + "assigner": { + "display": "GOSH MRN" + }, + "system": "https://fhir.nhs.uk/Id/mrn", + "value": "40388914" }, { - "extension": [ - { - "url": "https://fhir.nhs.uk/R4/StructureDefinition/Extension-UKCore-NHSNumberVerificationStatus", - "valueCodeableConcept": { - "coding": [ - { - "system": "https://fhir.nhs.uk/R4/CodeSystem/UKCore-NHSNumberVerificationStatus", - "code": "Z60791509", - "display": "Family Number" - } - ] - } - } - ] + "system": "https://fhir.nhs.uk/Id/nhs-number", + "value": "8105688202.0" + }, + { + "system": "https://fhir.nhs.uk/Id/nhs-family-number", + "value": "Z968769" } ], - "generalPractitioner": { - "type": "Practitioner", - "reference": "Practitioner/d3447490-96fd-35d0-adf2-0806e5214606" + "managingOrganization": { + "type": "Organization", + "reference": "Organization?_id=gosh-redcap-20RG-205G0047" } }, "request": { - "method": "POST", - "url": "Patient" + "method": "PUT", + "url": "Patient?_id=gosh-redcap-40388914" } }, { - "fullUrl": "Specimen/fb82860d-eabc-a8d0-b341-facdff0ac0f1", + "fullUrl": "Specimen/specimen-20RG-205G0047", "resource": { "resourceType": "Specimen", - "id": "fb82860d-eabc-a8d0-b341-facdff0ac0f1", - "receivedTime": "2020-03-12T14:15:00", + "id": "specimen-20RG-205G0047", + "receivedTime": "2020-07-23T15:19:00", "collection": { - "collectedDateTime": "2020-06-12T14:15:00" + "collectedDateTime": "2020-07-23T12:22:00" }, + "processing": [ + { + "timeDateTime": "2020-10-21T15:00:00" + } + ], "identifier": [ { - "value": "20RG-114G00099", + "value": "specimen-20RG-205G0047", "id": "specimen id" } ], @@ -108,32 +126,37 @@ { "system": "http://snomed.info/sct", "code": "122555007", - "display": "Venus blood specimen" + "display": "blood" } ] }, "subject": { "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" + "reference": "Patient?_id=gosh-redcap-40388914" } }, "request": { - "method": "POST", - "url": "Specimen" + "method": "PUT", + "url": "Specimen?_id=specimen-20RG-205G0047" } }, { - "fullUrl": "Practitioner/d3447490-96fd-35d0-adf2-0806e5214606", + "fullUrl": "Practitioner/practitioner1-20RG-205G0047", "resource": { "resourceType": "Practitioner", - "id": "d3447490-96fd-35d0-adf2-0806e5214606", + "id": "practitioner1-20RG-205G0047", + "identifier": [ + { + "value": "practitioner1-20RG-205G0047" + } + ], "active": true, "name": [ { "use": "official", - "family": "Nephrology", + "family": "Fredrick", "given": [ - "Clinics" + "Freya" ], "text": "Authorized By" } @@ -141,12 +164,16 @@ "qualification": [ { "code": { - "text": "Principal Clinical Scientist" + "coding": [ + { + "display": "Principal Clinical Scientist" + } + ] } }, { "issuer": { - "reference": "Organization/85940927-468f-f53d-864a-7a50b48d73f1" + "reference": "Organization/gosh-redcap-20RG-205G0047" } } ] @@ -157,17 +184,22 @@ } }, { - "fullUrl": "Practitioner/46743741-9466-e472-6b5f-5241f323ca74", + "fullUrl": "Practitioner/practitioner2-20RG-205G0047", "resource": { "resourceType": "Practitioner", - "id": "46743741-9466-e472-6b5f-5241f323ca74", + "id": "practitioner2-20RG-205G0047", + "identifier": [ + { + "value": "practitioner1-20RG-205G0047" + } + ], "active": true, "name": [ { "use": "official", - "family": "Quality", + "family": "Anooli", "given": [ - "Activity" + "Ana" ], "text": "Reported By" } @@ -175,12 +207,16 @@ "qualification": [ { "code": { - "text": "Clinical Scientist" + "coding": [ + { + "display": "Clinical Scientist" + } + ] } }, { "issuer": { - "reference": "Organization/85940927-468f-f53d-864a-7a50b48d73f1" + "reference": "Organization/gosh-redcap-20RG-205G0047" } } ] @@ -191,17 +227,22 @@ } }, { - "fullUrl": "Observation/5306f3f5-1516-6570-5b7c-709acb175a5a", + "fullUrl": "Observation/20RG-205G0047-variant1-variant1", "resource": { "resourceType": "Observation", - "id": "5306f3f5-1516-6570-5b7c-709acb175a5a", + "id": "20RG-205G0047-variant1-variant1", + "identifier": [ + { + "value": "20RG-205G0047-variant1-variant1" + } + ], "status": "final", "code": { "coding": [ { "system": "http://loinc.org", "code": "69548-6", - "display": "Genetic variant assessment" + "display": "Genetic variant assesment" } ] }, @@ -212,26 +253,26 @@ }, "subject": { "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" + "reference": "Patient?_id=gosh-redcap-40388914" }, "specimen": { "type": "Specimen", - "reference": "Specimen/fb82860d-eabc-a8d0-b341-facdff0ac0f1" + "reference": "Specimen?_id=specimen-20RG-205G0047" }, "performer": [ { "type": "Practitioner", - "reference": "Practitioner/d3447490-96fd-35d0-adf2-0806e5214606" + "reference": "Practitioner/practitioner1-20RG-205G0047" }, { "type": "Practitioner", - "reference": "Practitioner/46743741-9466-e472-6b5f-5241f323ca74" + "reference": "Practitioner/practitioner2-20RG-205G0047" } ], "note": [ { "authorString": "gene information", - "text": "MECP2: Pathogenic variants in MECP2 can cause a variety of X-linked conditions: Rett syndrome (OMIM, 312750), neonatal severe encephalopathy (OMIM,300673), and X-linked syndromic mental retardation (OMIM 300260 and 300055)." + "text": "SMC1A: Heterozygous pathogenic variants in SMC1A (MIM 300040) are associated with early infantile epileptic encephalopathy-85 with or without midline brain defects (EIEE85; MIM 301044) that is an X-linked neurologic disorder characterized by onset of severe refractory seizures in the first year of life, global developmental delay with impaired intellectual development and poor or absent speech, and dysmorphic facial features. Pathogenic variants in SMC1A can also cause Cornelia de Lange syndrome-2 (CDLS2: 3005900), a milder disorder with some overlapping features." } ], "component": [ @@ -248,8 +289,8 @@ "valueCodeableConcept": { "coding": [ { - "system": "http://www.ncbi.nlm.nih.gov/refseq", - "code": "NM_001350626.1" + "system": "https://www.ncbi.nlm.nih.gov/refseq", + "code": "NM_006306.3:" } ] } @@ -268,7 +309,7 @@ "coding": [ { "system": "http://varnomen.hgvs.org", - "code": "NM_001350626.1:c.1550G>T" + "code": "c.1263del" } ] } @@ -287,7 +328,7 @@ "coding": [ { "system": "http://varnomen.hgvs.org/", - "code": "p.(Arg701*)" + "code": "p.(Lys422Serfs*28)" } ] } @@ -326,7 +367,7 @@ "coding": [ { "system": "http://loinc.org", - "code": "LA6668-3", + "code": " LA6668-3", "display": "Pathogenic" } ] @@ -337,7 +378,7 @@ "coding": [ { "system": "http://loinc.org", - "code": "79742-3", + "code": "53034-0", "display": "Inheritance pattern based on family history" } ] @@ -346,8 +387,8 @@ "coding": [ { "system": "http://loinc.org", - "code": "LA24640-7", - "display": "Autosomal dominant" + "code": "LA24947-6", + "display": "X-linked" } ] } @@ -357,11 +398,11 @@ "coding": [ { "system": "http://www.genenames.org/geneId", - "code": "HGNC:6990" + "code": "HGNC:11111" } ] }, - "valueString": "MECP2" + "valueString": "SMC1A" }, { "code": { @@ -369,35 +410,48 @@ { "system": "http://hl7.org/evidence", "code": "evidence", - "display": "Evidence for classification of variant" + "display": "Evidence for classification of variant1" } ] }, - "valueString": "absent from the gnomAD population database (PM2_Moderate)." + "valueString": "\u00ef\u0082\u00b7 Absent from the gnomAD population database (PM2_Moderate). \u00ef\u0082\u00b7 Predicted null variant where loss of function is known disease mechanism (PVS1_very strong)." + }, + { + "code": { + "coding": [ + { + "system": "http://loinc.org", + "code": "81297-4", + "display": "CNV" + } + ] + }, + "valueString": "CNV" }, { "code": { "coding": [ { "system": "http://hl7.org/variant", - "code": "confirmed-variant" + "code": "confirmed-variant", + "display": true } ] }, - "valueBoolean": false + "valueBoolean": true } ] }, "request": { - "method": "POST", - "url": "Observation" + "method": "PUT", + "url": "Observation?_id=20RG-205G0047-variant1-variant1" } }, { - "fullUrl": "Task/5f3f5638-3870-1a14-b490-b6081dfc8352", + "fullUrl": "Task/8c1745a7-9a6a-5f92-cca7-4147f6be1f72", "resource": { "resourceType": "Task", - "id": "5f3f5638-3870-1a14-b490-b6081dfc8352", + "id": "8c1745a7-9a6a-5f92-cca7-4147f6be1f72", "meta": { "profile": [ "http://hl7.org/fhir/StructureDefinition/task-rec-followup" @@ -414,10 +468,10 @@ } ] }, - "description": "Testing of General Manager's parents is recommended to determine whether the SCN1A c.2101C>T pathogenic variant has arisen de novo and", + "description": "Testing of Maria321 BrighGosh321's parents is recommended to determine whether the SMC1A c.1263del p.(Lys422Serfs*28) pathogenic variant has arisen de novo and to assess the recurrence risk. Please include clinical information for the parents. A referral to their local clinical genetics service may be appropriate for this family.", "for": { "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" + "reference": "Patient/gosh-redcap-40388914" } }, "request": { @@ -426,11 +480,16 @@ } }, { - "fullUrl": "Observation/6d16ee18-5521-16dd-2ba4-b180cb69ca38", + "fullUrl": "Observation/20RG-205G0047-overall-interpretation", "resource": { "resourceType": "Observation", - "id": "6d16ee18-5521-16dd-2ba4-b180cb69ca38", + "id": "20RG-205G0047-overall-interpretation", "status": "final", + "identifier": [ + { + "value": "20RG-205G0047-overall-interpretation" + } + ], "meta": { "profile": [ "http://hl7.org/fhir/uv/genomics-reporting/StructureDefinition/overall-interpretation" @@ -447,16 +506,20 @@ }, "subject": { "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" + "reference": "Patient?_id=gosh-redcap-40388914" }, "specimen": { "type": "Specimen", - "reference": "Specimen/fb82860d-eabc-a8d0-b341-facdff0ac0f1" + "reference": "Specimen?_id=specimen-20RG-205G0047" }, "performer": [ { "type": "Practitioner", - "reference": "Practitioner/d3447490-96fd-35d0-adf2-0806e5214606" + "reference": "Practitioner/practitioner1-20RG-205G0047" + }, + { + "type": "Practitioner", + "reference": "Practitioner/practitioner2-20RG-205G0047" } ], "category": [ @@ -470,34 +533,77 @@ ] } ], - "valueString": "Next generation sequence analysis indicates that General Manager is heterozygous for the MECP2 c.953G>C p.(Arg318Pro) likely pathogenic variant that has been confirmed by Sanger sequence analysis" + "effectiveDateTime": "2020-10-22", + "note": [ + { + "authorString": "genomic interpretation", + "text": "Next generation sequence analysis indicates that Maria321 BrighGosh321 is heterozygous for the SMC1A c.1263del p.(Lys422Serfs*28) pathogenic variant that has been confirmed by Sanger sequence analysis (see technical information below)." + } + ], + "valueCodeableConcept": { + "coding": [ + { + "system": "http://loinc.org", + "code": "LA6577-6", + "display": "Negative" + } + ], + "text": "report finding" + } }, "request": { - "method": "POST", - "url": "Observation" + "method": "PUT", + "url": "Observation?_id=20RG-205G0047-overall-interpretation" } }, { - "fullUrl": "ServiceRequest/c87a7463-19c1-6a0d-0feb-d845d0dfae43", + "fullUrl": "ServiceRequest/1775336d-71ea-cd05-49a3-e80e966e1277", "resource": { "resourceType": "ServiceRequest", - "id": "c87a7463-19c1-6a0d-0feb-d845d0dfae43", + "id": "1775336d-71ea-cd05-49a3-e80e966e1277", "meta": { "profile": [ "http://hl7.org/fhir/StructureDefinition/servicerequest" ] }, + "text": { + "status": "generated", + "div": "
Lab Procedure from RedCap FHIR app
" + }, "status": "active", "intent": "order", - "supportingInfo": [ - { - "reference": "PlanDefinition/38018b47-b29a-8b06-daf6-6c5f2577bffa" - } + "instantiatesCanonical": [ + "PlanDefinition/20RG-205G0047-plan-definition" ], + "performerType": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "310049001", + "display": "Clinical genetics service" + } + ] + }, "subject": { "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" + "reference": "Patient/gosh-redcap-40388914" }, + "specimen": [ + { + "type": "Specimen", + "reference": "Specimen/specimen-20RG-205G0047" + } + ], + "performer": [ + { + "type": "Practitioner", + "reference": "Practitioner/practitioner1-20RG-205G0047" + }, + { + "type": "Practitioner", + "reference": "Practitioner/practitioner2-20RG-205G0047" + } + ], "category": [ { "coding": [ @@ -515,10 +621,10 @@ { "system": "http://snomed.info/sct", "code": "230387008", - "display": "Benign occipital epilepsy of childhood - early onset variant" + "display": "Reason for recommending early-onset benign childhood epilepsy" } ], - "text": "Sequence variant screening in General Manager because of seizures and developmental delay. There is a clinical suspicion of Dravet Syndrome." + "text": "Sequence variant screening in Maria321 BrighGosh321 because of seizure disorder and global developmental delay." } ] }, @@ -528,21 +634,37 @@ } }, { - "fullUrl": "PlanDefinition/38018b47-b29a-8b06-daf6-6c5f2577bffa", + "fullUrl": "PlanDefinition/20RG-205G0047-plan-definition", "resource": { "resourceType": "PlanDefinition", - "id": "38018b47-b29a-8b06-daf6-6c5f2577bffa", + "id": "20RG-205G0047-plan-definition", "status": "active", + "identifier": [ + { + "value": "20RG-205G0047-plan-definition" + } + ], + "description": "Sequence variant screening in Maria321 BrighGosh321 because of seizure disorder and global developmental delay.", "subjectReference": { "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" + "reference": "Patient/gosh-redcap-40388914" }, - "description": "Screening of 82 genes associated with severe delay and seizures (ADSL, ALG13, ARHGEF9, ARX, ATP1A3, ATRX, BRAT1, CDKL5, CHD2, CHRNA2, CHRNA4, CHRNB2, CLN5, CLN6, CLN8, CNTNAP2, DNM1, DOCK7, DYRK1A, EHMT1, FOXG1, GABRA1, GABRB3, GATAD2B, GNAO1, GRIN1, GRIN2A, GRIN2B, HCN1, IQSEC2, KCNA2, KCNB1, KCNC1, KCNQ2, KCNT1, KIAA1279 (KIF1BP), KIAA2022, LGI1, MAGI2, MBD5, MECP2, MEF2C, MFSD8, NACC1, NRXN1, PCDH19, PIGA, PIGN, PLCB1, PNKP, POLG, PRRT2, PURA, QARS, SCN1A, SCN1B, SCN2A, SCN8A, SETD5, SIK1, SLC12A5, SLC13A5, SLC16A2, SLC25A22, SLC2A1, SLC35A2, SLC6A1, SLC9A6, SMC1A, SPTAN1, STX1B, STXBP1, SYNGAP1, TBC1D24, TCF4, TPP1, UBE2A, UBE3A, UNC80, WDR45, WWOX, ZEB2) was carried out using next generation sequencing (Agilent SureSelect + MiSeq/NextSeq). *Pseudogenes with significant sequence homology to DMN1 exons 18, 19, 20 and 22 may result in incorrect coverage data for this gene and variants in these exons may not be detected. 99.6% of the coding bases in the targeted genes were covered >30x. Sequencing includes the coding region of the genes targeted, including intron/exon splice regions (-14 splice acceptor and +6 splice donor, unless otherwise specified). Inhouse validation attributes a minimum sensitivity of 99.9% to detect single nucleotide substitutions (with 95% confidence) and 77% for insertion/deletion variants (with 95% confidence) for regions covered by 30 or more reads. Variants are classified using the ACMG/AMP guidelines (Richards et al 2015 Genet Med) /ACGS Best Practice guidelines (2019).", "relatedArtifact": [ { "type": "citation", - "citation": "(1) Shapiro et al Pediatr Res. 2010 Nov;68(5):446-51. (2) Neul et al Am J Med Genet B Neuropsychiatr Genet. 2019 Jan;180(1):55-67. (3) Cheadle et al, Hum Mol Genet. 2000, 9, 1119-1129.", - "display": "Gene reference" + "citation": "Zheng-Wen et al (2014) Int J Mol Sci. Dec 16;15(12):23408-17; [2] Lee et al (2012) PLoS One. 7(8); [3] M\u00c3\u00a9neret et al (2012) Neurology. Jul 10;79(2):170-4." + } + ], + "action": [ + { + "prefix": "1", + "description": "Screening of 82 genes associated with severe delay and seizures () was carried out using next generation sequencing (Agilent SureSelect + MiSeq/NextSeq). *Pseudogenes with significant sequence homology to DMN1 exons 18, 19, 20 and 22 may result in incorrect coverage data for this gene and variants in these exons may not be detected. 99.3% of the coding bases in the targeted genes were covered >30x. Sequencing includes the coding region of the genes targeted, including intron/exon splice regions (-14 splice acceptor and +6 splice donor, unless otherwise specified). Inhouse validation attributes a minimum sensitivity of 99.9% to detect single nucleotide substitutions (with 95% confidence) and 77% for insertion/deletion variants (with 95% confidence) for regions covered by 30 or more reads. Variants are classified using the ACMG/AMP guidelines (Richards et al 2015 Genet Med) /ACGS Best Practice guidelines (2020).", + "title": "Test Method" + }, + { + "prefix": "2", + "textEquivalent": "ADSL, ALG13, ARHGEF9, ARX, ATP1A3, ATRX, BRAT1, CDKL5, CHD2, CHRNA2, CHRNA4, CHRNB2, CLN5, CLN6, CLN8, CNTNAP2, DNM1, DOCK7, DYRK1A, EHMT1, FOXG1, GABRA1, GABRB3, GATAD2B, GNAO1, GRIN1, GRIN2A, GRIN2B, HCN1, IQSEC2, KCNA2, KCNB1, KCNC1, KCNQ2, KCNT1, KIAA1279 (KIF1BP), KIAA2022, LGI1, MAGI2, MBD5, MECP2, MEF2C, MFSD8, NACC1, NRXN1, PCDH19, PIGA, PIGN, PLCB1, PNKP, POLG, PRRT2, PURA, QARS, SCN1A, SCN1B, SCN2A, SCN8A, SETD5, SIK1, SLC12A5, SLC13A5, SLC16A2, SLC25A22, SLC2A1, SLC35A2, SLC6A1, SLC9A6, SMC1A, SPTAN1, STX1B, STXBP1, SYNGAP1, TBC1D24, TCF4, TPP1, UBE2A, UBE3A, UNC80, WDR45, WWOX, ZEB2", + "title": "gene list" } ] }, @@ -552,10 +674,10 @@ } }, { - "fullUrl": "DiagnosticReport/a425799a-a905-d750-7e1e-a9c573581a81", + "fullUrl": "DiagnosticReport/3405095c-8a50-06c1-ec18-8efbd080e66e", "resource": { "resourceType": "DiagnosticReport", - "id": "a425799a-a905-d750-7e1e-a9c573581a81", + "id": "3405095c-8a50-06c1-ec18-8efbd080e66e", "meta": { "profile": [ "http://hl7.org/fhir/StructureDefinition/genomicreport" @@ -565,52 +687,47 @@ "code": { "coding": [ { - "system": "http://snomed.info/sct", - "code": "230387008", - "display": "Benign occipital epilepsy of childhood - early onset variant" + "system": "https://panelapp.genomicsengland.co.uk/api/v1/entities", + "code": "R59", + "display": "Early onset or syndromic epilepsy" } ] }, "subject": { "type": "Patient", - "reference": "Patient/37176e84-d977-e993-3c49-d76fcfc6e625" + "reference": "Patient/gosh-redcap-40388914" }, - "effectiveDateTime": "2020-04-06", + "issued": "2020-10-21", + "effectiveDateTime": "2020-10-22", + "performer": [ + { + "type": "Organization", + "reference": "Organization/gosh-redcap-20RG-205G0047" + } + ], "resultsInterpreter": [ { "type": "Practitioner", - "reference": "Practitioner/d3447490-96fd-35d0-adf2-0806e5214606" + "reference": "Practitioner/practitioner1-20RG-205G0047" }, { "type": "Practitioner", - "reference": "Practitioner/46743741-9466-e472-6b5f-5241f323ca74" + "reference": "Practitioner/practitioner2-20RG-205G0047" } ], "specimen": [ { "type": "Specimen", - "reference": "Specimen/fb82860d-eabc-a8d0-b341-facdff0ac0f1" + "reference": "Specimen/specimen-20RG-205G0047" } ], "result": [ { "type": "Observation", - "reference": "Observation/5306f3f5-1516-6570-5b7c-709acb175a5a" - }, - { - "type": "Observation", - "reference": "Observation/964a870c-7c87-9b74-1d87-8f9f9cdf5a86" - }, - { - "type": "Observation", - "reference": "Observation/30bcab0e-d857-0102-55d4-4936a1515607" - }, - { - "type": "Observation", - "reference": "Observation/4562be7f-bb42-e0b2-0426-465e3e37952d" + "reference": "Observation/20RG-205G0047-variant1-variant1" } ], - "conclusion": "Consistent with a diagnosis of Rett syndrome." + "conclusion": "Genetic diagnosis of Early infantile epileptic encephalopathy-85 (EIEE85) in Maria321 BrighGosh321." }, "request": { "method": "POST", From a921b10dde9ef2d4a2e836093555735b969b04ae Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Tue, 25 Oct 2022 16:33:27 +0100 Subject: [PATCH 04/24] Update example bundle based on review discussion --- example_data/sample_bundle.json | 289 ++++++++++++++------------------ 1 file changed, 126 insertions(+), 163 deletions(-) diff --git a/example_data/sample_bundle.json b/example_data/sample_bundle.json index b72edae..5e0979d 100644 --- a/example_data/sample_bundle.json +++ b/example_data/sample_bundle.json @@ -3,20 +3,17 @@ "type": "batch", "entry": [ { - "fullUrl": "Organization/gosh-redcap-20RG-205G0047", "resource": { "resourceType": "Organization", - "id": "gosh-redcap-20RG-205G0047", "identifier": [ { - "system": "http://term.hl7.org/CodeSystem/org-id-codes", - "value": "gosh-redcap-20RG-205G0047" + "value": "gosh" } ], "active": true, "text": { "status": "generated", - "div": "
1 North London Lab
" + "div": "
1 North London Lab
" }, "type": [ { @@ -30,17 +27,12 @@ "text": "NHS UK Healthcare Provider" } ], - "name": "North London Lab 1", - "telecom": [ - { - "system": "phone", - "value": "2078298870" - } - ], + "name": "North London Regional Genetics Lab", "address": [ { "line": [ - "Levels 4-6 Barclay House, 37 Queen Square" + "Levels 4-6 Barclay House", + "37 Queen Square" ], "city": "London", "postalCode": "WC1N 3BH", @@ -50,14 +42,12 @@ }, "request": { "method": "PUT", - "url": "Organization?_id=gosh-redcap-20RG-205G0047" + "url": "Organization?identifier=gosh" } }, { - "fullUrl": "Patient/gosh-redcap-40388914", "resource": { "resourceType": "Patient", - "id": "gosh-redcap-40388914", "active": true, "name": [ { @@ -71,7 +61,7 @@ "birthDate": "2019-08-02", "text": { "status": "generated", - "div": "
Maria321 BrighGosh321 from RedCap FHIR
" + "div": "
Maria321 BrighGosh321 from RedCap FHIR
" }, "identifier": [ { @@ -79,33 +69,31 @@ "assigner": { "display": "GOSH MRN" }, - "system": "https://fhir.nhs.uk/Id/mrn", + "system": "http://fhir.nhs.uk/Id/mrn", "value": "40388914" }, { - "system": "https://fhir.nhs.uk/Id/nhs-number", + "system": "http://fhir.nhs.uk/Id/nhs-number", "value": "8105688202.0" }, { - "system": "https://fhir.nhs.uk/Id/nhs-family-number", + "system": "http://fhir.nhs.uk/Id/nhs-family-number", "value": "Z968769" } ], "managingOrganization": { "type": "Organization", - "reference": "Organization?_id=gosh-redcap-20RG-205G0047" + "reference": "Organization?identifier=gosh" } }, "request": { "method": "PUT", - "url": "Patient?_id=gosh-redcap-40388914" + "url": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914" } }, { - "fullUrl": "Specimen/specimen-20RG-205G0047", "resource": { "resourceType": "Specimen", - "id": "specimen-20RG-205G0047", "receivedTime": "2020-07-23T15:19:00", "collection": { "collectedDateTime": "2020-07-23T12:22:00" @@ -117,8 +105,7 @@ ], "identifier": [ { - "value": "specimen-20RG-205G0047", - "id": "specimen id" + "value": "20RG-205G0047" } ], "type": { @@ -126,28 +113,26 @@ { "system": "http://snomed.info/sct", "code": "122555007", - "display": "blood" + "display": "Venus blood specimen" } ] }, "subject": { "type": "Patient", - "reference": "Patient?_id=gosh-redcap-40388914" + "reference": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914" } }, "request": { "method": "PUT", - "url": "Specimen?_id=specimen-20RG-205G0047" + "url": "Specimen?identifier=20RG-205G0047" } }, { - "fullUrl": "Practitioner/practitioner1-20RG-205G0047", "resource": { "resourceType": "Practitioner", - "id": "practitioner1-20RG-205G0047", "identifier": [ { - "value": "practitioner1-20RG-205G0047" + "value": "freya_fredrick_auth" } ], "active": true, @@ -164,40 +149,34 @@ "qualification": [ { "code": { - "coding": [ - { - "display": "Principal Clinical Scientist" - } - ] + "text": "Principal Clinical Scientist" } }, { "issuer": { - "reference": "Organization/gosh-redcap-20RG-205G0047" + "reference": "Organization/gosh" } } ] }, "request": { - "method": "POST", - "url": "Practitioner" + "method": "PUT", + "url": "Practitioner?identifier=freya_fredrick_auth" } }, { - "fullUrl": "Practitioner/practitioner2-20RG-205G0047", "resource": { "resourceType": "Practitioner", - "id": "practitioner2-20RG-205G0047", "identifier": [ { - "value": "practitioner1-20RG-205G0047" + "value": "ana_anooli_seo_report" } ], "active": true, "name": [ { "use": "official", - "family": "Anooli", + "family": "Anooli Seo", "given": [ "Ana" ], @@ -207,33 +186,27 @@ "qualification": [ { "code": { - "coding": [ - { - "display": "Clinical Scientist" - } - ] + "text": "Clinical Scientist" } }, { "issuer": { - "reference": "Organization/gosh-redcap-20RG-205G0047" + "reference": "Organization/gosh" } } ] }, "request": { - "method": "POST", - "url": "Practitioner" + "method": "PUT", + "url": "Practitioner?identifier=ana_anooli_seo_report" } }, { - "fullUrl": "Observation/20RG-205G0047-variant1-variant1", "resource": { "resourceType": "Observation", - "id": "20RG-205G0047-variant1-variant1", "identifier": [ { - "value": "20RG-205G0047-variant1-variant1" + "value": "20RG-205G0047_R59_NM_006306.3:c.1263del" } ], "status": "final", @@ -242,7 +215,7 @@ { "system": "http://loinc.org", "code": "69548-6", - "display": "Genetic variant assesment" + "display": "Genetic variant assessment" } ] }, @@ -253,20 +226,20 @@ }, "subject": { "type": "Patient", - "reference": "Patient?_id=gosh-redcap-40388914" + "reference": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914" }, "specimen": { "type": "Specimen", - "reference": "Specimen?_id=specimen-20RG-205G0047" + "reference": "Specimen?identifier=20RG-205G0047" }, "performer": [ { "type": "Practitioner", - "reference": "Practitioner/practitioner1-20RG-205G0047" + "reference": "Practitioner?identifier=freya_fredrick_auth" }, { "type": "Practitioner", - "reference": "Practitioner/practitioner2-20RG-205G0047" + "reference": "Practitioner?identifier=ana_anooli_seo_report" } ], "note": [ @@ -289,8 +262,8 @@ "valueCodeableConcept": { "coding": [ { - "system": "https://www.ncbi.nlm.nih.gov/refseq", - "code": "NM_006306.3:" + "system": "http://www.ncbi.nlm.nih.gov/refseq", + "code": "NM_006306.3" } ] } @@ -309,7 +282,7 @@ "coding": [ { "system": "http://varnomen.hgvs.org", - "code": "c.1263del" + "code": "NM_006306.3:c.1263del" } ] } @@ -347,7 +320,7 @@ "coding": [ { "system": "http://loinc.org", - "code": " LA6706-1", + "code": "LA6706-1", "display": "Heterozygous" } ] @@ -367,7 +340,7 @@ "coding": [ { "system": "http://loinc.org", - "code": " LA6668-3", + "code": "LA6668-3", "display": "Pathogenic" } ] @@ -378,7 +351,7 @@ "coding": [ { "system": "http://loinc.org", - "code": "53034-0", + "code": "79742-3", "display": "Inheritance pattern based on family history" } ] @@ -410,31 +383,29 @@ { "system": "http://hl7.org/evidence", "code": "evidence", - "display": "Evidence for classification of variant1" + "display": "Evidence for classification of variant" } ] }, - "valueString": "\u00ef\u0082\u00b7 Absent from the gnomAD population database (PM2_Moderate). \u00ef\u0082\u00b7 Predicted null variant where loss of function is known disease mechanism (PVS1_very strong)." + "valueString": "Absent from the gnomAD population database (PM2_Moderate). Predicted null variant where loss of function is known disease mechanism (PVS1_very strong)." }, { "code": { "coding": [ { "system": "http://loinc.org", - "code": "81297-4", - "display": "CNV" + "code": "LA26801-3", + "display": "Simple variant" } ] - }, - "valueString": "CNV" + } }, { "code": { "coding": [ { "system": "http://hl7.org/variant", - "code": "confirmed-variant", - "display": true + "code": "confirmed-variant" } ] }, @@ -444,19 +415,22 @@ }, "request": { "method": "PUT", - "url": "Observation?_id=20RG-205G0047-variant1-variant1" + "url": "Observation?identifier=20RG-205G0047_R59_NM_006306.3:c.1263del" } }, { - "fullUrl": "Task/8c1745a7-9a6a-5f92-cca7-4147f6be1f72", "resource": { "resourceType": "Task", - "id": "8c1745a7-9a6a-5f92-cca7-4147f6be1f72", "meta": { "profile": [ "http://hl7.org/fhir/StructureDefinition/task-rec-followup" ] }, + "identifier": [ + { + "value": "20RG-205G0047_R59" + } + ], "status": "requested", "intent": "plan", "code": { @@ -471,23 +445,21 @@ "description": "Testing of Maria321 BrighGosh321's parents is recommended to determine whether the SMC1A c.1263del p.(Lys422Serfs*28) pathogenic variant has arisen de novo and to assess the recurrence risk. Please include clinical information for the parents. A referral to their local clinical genetics service may be appropriate for this family.", "for": { "type": "Patient", - "reference": "Patient/gosh-redcap-40388914" + "reference": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914" } }, "request": { - "method": "POST", - "url": "Task" + "method": "PUT", + "url": "Task?identifier=20RG-205G0047_R59" } }, { - "fullUrl": "Observation/20RG-205G0047-overall-interpretation", "resource": { "resourceType": "Observation", - "id": "20RG-205G0047-overall-interpretation", "status": "final", "identifier": [ { - "value": "20RG-205G0047-overall-interpretation" + "value": "20RG-205G0047_R59$overall-interpretation" } ], "meta": { @@ -506,20 +478,20 @@ }, "subject": { "type": "Patient", - "reference": "Patient?_id=gosh-redcap-40388914" + "reference": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914" }, "specimen": { "type": "Specimen", - "reference": "Specimen?_id=specimen-20RG-205G0047" + "reference": "Specimen?identifier=20RG-205G0047" }, "performer": [ { "type": "Practitioner", - "reference": "Practitioner/practitioner1-20RG-205G0047" + "reference": "Practitioner?identifier=freya_fredrick_auth" }, { "type": "Practitioner", - "reference": "Practitioner/practitioner2-20RG-205G0047" + "reference": "Practitioner?identifier=ana_anooli_seo_report" } ], "category": [ @@ -533,7 +505,6 @@ ] } ], - "effectiveDateTime": "2020-10-22", "note": [ { "authorString": "genomic interpretation", @@ -553,55 +524,84 @@ }, "request": { "method": "PUT", - "url": "Observation?_id=20RG-205G0047-overall-interpretation" + "url": "Observation?identifier=20RG-205G0047_R59$overall-interpretation" + } + }, + { + "resource": { + "resourceType": "PlanDefinition", + "status": "active", + "identifier": [ + { + "value": "20RG-205G0047_R59" + } + ], + "subjectReference": { + "type": "Patient", + "reference": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914" + }, + "relatedArtifact": [ + { + "type": "citation", + "citation": "Zheng-Wen et al (2014) Int J Mol Sci. Dec 16;15(12):23408-17; [2] Lee et al (2012) PLoS One. 7(8); [3] M\u00c3\u00a9neret et al (2012) Neurology. Jul 10;79(2):170-4." + } + ], + "action": [ + { + "description": "Screening of 82 genes associated with severe delay and seizures () was carried out using next generation sequencing (Agilent SureSelect + MiSeq/NextSeq). *Pseudogenes with significant sequence homology to DMN1 exons 18, 19, 20 and 22 may result in incorrect coverage data for this gene and variants in these exons may not be detected. 99.3% of the coding bases in the targeted genes were covered >30x. Sequencing includes the coding region of the genes targeted, including intron/exon splice regions (-14 splice acceptor and +6 splice donor, unless otherwise specified). Inhouse validation attributes a minimum sensitivity of 99.9% to detect single nucleotide substitutions (with 95% confidence) and 77% for insertion/deletion variants (with 95% confidence) for regions covered by 30 or more reads. Variants are classified using the ACMG/AMP guidelines (Richards et al 2015 Genet Med) /ACGS Best Practice guidelines (2020).", + "title": "Test Method" + }, + { + "textEquivalent": "ADSL, ALG13, ARHGEF9, ARX, ATP1A3, ATRX, BRAT1, CDKL5, CHD2, CHRNA2, CHRNA4, CHRNB2, CLN5, CLN6, CLN8, CNTNAP2, DNM1, DOCK7, DYRK1A, EHMT1, FOXG1, GABRA1, GABRB3, GATAD2B, GNAO1, GRIN1, GRIN2A, GRIN2B, HCN1, IQSEC2, KCNA2, KCNB1, KCNC1, KCNQ2, KCNT1, KIAA1279 (KIF1BP), KIAA2022, LGI1, MAGI2, MBD5, MECP2, MEF2C, MFSD8, NACC1, NRXN1, PCDH19, PIGA, PIGN, PLCB1, PNKP, POLG, PRRT2, PURA, QARS, SCN1A, SCN1B, SCN2A, SCN8A, SETD5, SIK1, SLC12A5, SLC13A5, SLC16A2, SLC25A22, SLC2A1, SLC35A2, SLC6A1, SLC9A6, SMC1A, SPTAN1, STX1B, STXBP1, SYNGAP1, TBC1D24, TCF4, TPP1, UBE2A, UBE3A, UNC80, WDR45, WWOX, ZEB2", + "title": "gene list" + } + ] + }, + "request": { + "method": "PUT", + "url": "PlanDefinition?identifier=20RG-205G0047_R59" } }, { - "fullUrl": "ServiceRequest/1775336d-71ea-cd05-49a3-e80e966e1277", "resource": { "resourceType": "ServiceRequest", - "id": "1775336d-71ea-cd05-49a3-e80e966e1277", "meta": { "profile": [ "http://hl7.org/fhir/StructureDefinition/servicerequest" ] }, + "identifier": [ + { + "value": "20RG-205G0047_R59" + } + ], "text": { "status": "generated", - "div": "
Lab Procedure from RedCap FHIR app
" + "div": "
Lab Procedure from RedCap FHIR app
" }, "status": "active", "intent": "order", - "instantiatesCanonical": [ - "PlanDefinition/20RG-205G0047-plan-definition" + "supportingInfo": [ + "PlanDefinition?identifier=20RG-205G0047_R59" ], - "performerType": { - "coding": [ - { - "system": "http://snomed.info/sct", - "code": "310049001", - "display": "Clinical genetics service" - } - ] - }, "subject": { "type": "Patient", - "reference": "Patient/gosh-redcap-40388914" + "reference": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914" }, "specimen": [ { "type": "Specimen", - "reference": "Specimen/specimen-20RG-205G0047" + "reference": "Specimen?identifier=20RG-205G0047" } ], "performer": [ { "type": "Practitioner", - "reference": "Practitioner/practitioner1-20RG-205G0047" + "reference": "Practitioner?identifier=freya_fredrick_auth" }, { "type": "Practitioner", - "reference": "Practitioner/practitioner2-20RG-205G0047" + "reference": "Practitioner?identifier=ana_anooli_seo_report" } ], "category": [ @@ -619,9 +619,9 @@ { "coding": [ { - "system": "http://snomed.info/sct", - "code": "230387008", - "display": "Reason for recommending early-onset benign childhood epilepsy" + "system": "http://panelapp.genomicsengland.co.uk/api/v1/entities", + "code": "R59", + "display": "Early onset or syndromic epilepsy" } ], "text": "Sequence variant screening in Maria321 BrighGosh321 because of seizure disorder and global developmental delay." @@ -629,65 +629,28 @@ ] }, "request": { - "method": "POST", - "url": "ServiceRequest" - } - }, - { - "fullUrl": "PlanDefinition/20RG-205G0047-plan-definition", - "resource": { - "resourceType": "PlanDefinition", - "id": "20RG-205G0047-plan-definition", - "status": "active", - "identifier": [ - { - "value": "20RG-205G0047-plan-definition" - } - ], - "description": "Sequence variant screening in Maria321 BrighGosh321 because of seizure disorder and global developmental delay.", - "subjectReference": { - "type": "Patient", - "reference": "Patient/gosh-redcap-40388914" - }, - "relatedArtifact": [ - { - "type": "citation", - "citation": "Zheng-Wen et al (2014) Int J Mol Sci. Dec 16;15(12):23408-17; [2] Lee et al (2012) PLoS One. 7(8); [3] M\u00c3\u00a9neret et al (2012) Neurology. Jul 10;79(2):170-4." - } - ], - "action": [ - { - "prefix": "1", - "description": "Screening of 82 genes associated with severe delay and seizures () was carried out using next generation sequencing (Agilent SureSelect + MiSeq/NextSeq). *Pseudogenes with significant sequence homology to DMN1 exons 18, 19, 20 and 22 may result in incorrect coverage data for this gene and variants in these exons may not be detected. 99.3% of the coding bases in the targeted genes were covered >30x. Sequencing includes the coding region of the genes targeted, including intron/exon splice regions (-14 splice acceptor and +6 splice donor, unless otherwise specified). Inhouse validation attributes a minimum sensitivity of 99.9% to detect single nucleotide substitutions (with 95% confidence) and 77% for insertion/deletion variants (with 95% confidence) for regions covered by 30 or more reads. Variants are classified using the ACMG/AMP guidelines (Richards et al 2015 Genet Med) /ACGS Best Practice guidelines (2020).", - "title": "Test Method" - }, - { - "prefix": "2", - "textEquivalent": "ADSL, ALG13, ARHGEF9, ARX, ATP1A3, ATRX, BRAT1, CDKL5, CHD2, CHRNA2, CHRNA4, CHRNB2, CLN5, CLN6, CLN8, CNTNAP2, DNM1, DOCK7, DYRK1A, EHMT1, FOXG1, GABRA1, GABRB3, GATAD2B, GNAO1, GRIN1, GRIN2A, GRIN2B, HCN1, IQSEC2, KCNA2, KCNB1, KCNC1, KCNQ2, KCNT1, KIAA1279 (KIF1BP), KIAA2022, LGI1, MAGI2, MBD5, MECP2, MEF2C, MFSD8, NACC1, NRXN1, PCDH19, PIGA, PIGN, PLCB1, PNKP, POLG, PRRT2, PURA, QARS, SCN1A, SCN1B, SCN2A, SCN8A, SETD5, SIK1, SLC12A5, SLC13A5, SLC16A2, SLC25A22, SLC2A1, SLC35A2, SLC6A1, SLC9A6, SMC1A, SPTAN1, STX1B, STXBP1, SYNGAP1, TBC1D24, TCF4, TPP1, UBE2A, UBE3A, UNC80, WDR45, WWOX, ZEB2", - "title": "gene list" - } - ] - }, - "request": { - "method": "POST", - "url": "PlanDefinition" + "method": "PUT", + "url": "ServiceRequest?identifier=20RG-205G0047_R59" } }, { - "fullUrl": "DiagnosticReport/3405095c-8a50-06c1-ec18-8efbd080e66e", "resource": { "resourceType": "DiagnosticReport", - "id": "3405095c-8a50-06c1-ec18-8efbd080e66e", "meta": { "profile": [ "http://hl7.org/fhir/StructureDefinition/genomicreport" ] }, + "identifier": [ + { + "value": "20RG-205G0047_R59" + } + ], "status": "final", "code": { "coding": [ { - "system": "https://panelapp.genomicsengland.co.uk/api/v1/entities", + "system": "http://panelapp.genomicsengland.co.uk/api/v1/entities", "code": "R59", "display": "Early onset or syndromic epilepsy" } @@ -695,43 +658,43 @@ }, "subject": { "type": "Patient", - "reference": "Patient/gosh-redcap-40388914" + "reference": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914" }, "issued": "2020-10-21", "effectiveDateTime": "2020-10-22", "performer": [ { "type": "Organization", - "reference": "Organization/gosh-redcap-20RG-205G0047" + "reference": "Organization?identifier=gosh" } ], "resultsInterpreter": [ { "type": "Practitioner", - "reference": "Practitioner/practitioner1-20RG-205G0047" + "reference": "Practitioner?identifier=freya_fredrick_auth" }, { "type": "Practitioner", - "reference": "Practitioner/practitioner2-20RG-205G0047" + "reference": "Practitioner?identifier=ana_anooli_seo_report" } ], "specimen": [ { "type": "Specimen", - "reference": "Specimen/specimen-20RG-205G0047" + "reference": "Specimen?identifier=20RG-205G0047" } ], "result": [ { "type": "Observation", - "reference": "Observation/20RG-205G0047-variant1-variant1" + "reference": "Observation?identifier=20RG-205G0047_R59_NM_006306.3:c.1263del" } ], "conclusion": "Genetic diagnosis of Early infantile epileptic encephalopathy-85 (EIEE85) in Maria321 BrighGosh321." }, "request": { - "method": "POST", - "url": "DiagnosticReport" + "method": "PUT", + "url": "DiagnosticReport?identifier=20RG-205G0047_R59" } } ] From ac16c2bac201348cae360c5ee696ed73ca6d9cbc Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Fri, 28 Oct 2022 14:20:03 +0100 Subject: [PATCH 05/24] Add sample authorised datetime --- src/components/reports/FormDefaults.ts | 2 ++ src/components/reports/formDataValidation.ts | 1 + src/components/reports/formSteps/Sample.tsx | 1 + src/fhir/resources.ts | 3 +++ 4 files changed, 7 insertions(+) diff --git a/src/components/reports/FormDefaults.ts b/src/components/reports/FormDefaults.ts index 09fce46..a33221a 100644 --- a/src/components/reports/FormDefaults.ts +++ b/src/components/reports/FormDefaults.ts @@ -23,6 +23,7 @@ export const initialValues: FormValues = { specimenType: "122555007", collectionDateTime: "04/06/2019 12:00", receivedDateTime: "04/06/2019 15:00", + authorisedDateTime: "04/06/2019 15:30", reasonForTest: "230387008", reasonForTestText: "Sequence variant screening in Donald Duck because of epilepsy and atypical absences. " + @@ -101,6 +102,7 @@ export const noValues: FormValues = { specimenType: "", collectionDateTime: "", receivedDateTime: "", + authorisedDateTime: "", reasonForTest: "", reasonForTestText: "", }, diff --git a/src/components/reports/formDataValidation.ts b/src/components/reports/formDataValidation.ts index 1f83ee5..18c6578 100644 --- a/src/components/reports/formDataValidation.ts +++ b/src/components/reports/formDataValidation.ts @@ -54,6 +54,7 @@ export const sampleSchema = Yup.object({ specimenCode: requiredString, collectionDateTime: optionalDateTime, receivedDateTime: requiredDateTime, + authorisedDateTime: optionalDateTime, specimenType: requiredString, reasonForTest: requiredString, reasonForTestText: optionalString, diff --git a/src/components/reports/formSteps/Sample.tsx b/src/components/reports/formSteps/Sample.tsx index af9175d..7d1eefb 100644 --- a/src/components/reports/formSteps/Sample.tsx +++ b/src/components/reports/formSteps/Sample.tsx @@ -11,6 +11,7 @@ const Sample: FC = () => {
+
diff --git a/src/fhir/resources.ts b/src/fhir/resources.ts index e101748..d0c88a3 100644 --- a/src/fhir/resources.ts +++ b/src/fhir/resources.ts @@ -170,6 +170,9 @@ export const specimenAndIdentifier = (sample: SampleSchema, patientIdentifier: s if (sample.collectionDateTime !== undefined) { specimen.collection = { collectedDateTime: parseDateTime(sample.collectionDateTime).toISO() }; } + if (sample.authorisedDateTime !== undefined) { + specimen.processing = [{ timeDateTime: parseDateTime(sample.authorisedDateTime).toISO() }]; + } const identifier = createIdentifier(sample.specimenCode, { id: "specimen id" }); specimen.identifier = [identifier]; specimen.type = { From 63afe64aeef1072328e5fbae24e6364d11f1cebf Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Fri, 28 Oct 2022 14:48:57 +0100 Subject: [PATCH 06/24] Add report finding options --- src/code_systems/loinc.test.ts | 1 + src/code_systems/loinc.ts | 1 + src/code_systems/loincCodes.ts | 56 ++++++++++++++++++++ src/components/reports/FormDefaults.ts | 2 + src/components/reports/ReportForm.test.tsx | 5 +- src/components/reports/formDataValidation.ts | 1 + src/components/reports/formSteps/Report.tsx | 1 + src/fhir/resources.ts | 6 ++- 8 files changed, 71 insertions(+), 2 deletions(-) diff --git a/src/code_systems/loinc.test.ts b/src/code_systems/loinc.test.ts index c0c7920..5816d04 100644 --- a/src/code_systems/loinc.test.ts +++ b/src/code_systems/loinc.test.ts @@ -21,6 +21,7 @@ describe("LOINC", () => { classification: getSelectOptions(valueSet.classification), inheritance: getSelectOptions(valueSet.inheritance), zygosity: getSelectOptions(valueSet.zygosity), + reportFinding: getSelectOptions(valueSet.reportFinding), followUp: getSelectOptions(valueSet.followUp), }; diff --git a/src/code_systems/loinc.ts b/src/code_systems/loinc.ts index 5852600..76ec0bf 100644 --- a/src/code_systems/loinc.ts +++ b/src/code_systems/loinc.ts @@ -21,6 +21,7 @@ export const variantCodes = async () => { classification: await getValueSetData("LL4034-6"), inheritance: await getValueSetData("LL3731-8"), zygosity: await getValueSetData("LL381-5"), + reportFinding: await getValueSetData("LL2431-6"), followUp: await getValueSetData("LL1037-2"), }; }; diff --git a/src/code_systems/loincCodes.ts b/src/code_systems/loincCodes.ts index f5108b3..a83fadf 100644 --- a/src/code_systems/loincCodes.ts +++ b/src/code_systems/loincCodes.ts @@ -6,6 +6,7 @@ type LoincCodes = { classification: ValueSet; inheritance: ValueSet; zygosity: ValueSet; + reportFinding: ValueSet; followUp: ValueSet; }; @@ -216,6 +217,60 @@ export const loincCodes: LoincCodes = { ], }, }, + reportFinding: { + resourceType: "ValueSet", + id: "LL2431-6-2.73", + meta: { + versionId: "1", + lastUpdated: "2022-08-08T12:57:53.978+00:00", + }, + url: "http://loinc.org/vs/LL2431-6", + identifier: [ + { + system: "urn:ietf:rfc:3986", + value: "urn:oid:1.3.6.1.4.1.12009.10.1.1595", + }, + ], + version: "Loinc_2.73-2.73", + name: "Pos|Neg|Inconcl", + status: "active", + publisher: "Regenstrief Institute, Inc.", + contact: [ + { + name: "Regenstrief Institute, Inc.", + telecom: [ + { + system: "url", + value: "https://loinc.org", + }, + ], + }, + ], + copyright: + "This material contains content from LOINC (http://loinc.org). LOINC is copyright ©1995-2022, Regenstrief Institute, Inc. and the Logical Observation Identifiers Names and Codes (LOINC) Committee and is available at no cost under the license at http://loinc.org/license. LOINC® is a registered United States trademark of Regenstrief Institute, Inc.", + compose: { + include: [ + { + system: "http://loinc.org", + version: "2.73", + concept: [ + { + code: "LA6576-8", + display: "Positive", + }, + { + code: "LA6577-6", + display: "Negative", + }, + { + code: "LA9663-1", + display: "Inconclusive", + }, + ], + }, + ], + }, + }, followUp: { resourceType: "ValueSet", id: "LL1037-2", @@ -285,6 +340,7 @@ export const loincSelect = { classification: getSelectOptions(loincCodes.classification), inheritance: getSelectOptions(loincCodes.inheritance), zygosity: getSelectOptions(loincCodes.zygosity), + reportFinding: getSelectOptions(loincCodes.reportFinding), followUp: getSelectOptions(loincCodes.followUp), }; diff --git a/src/components/reports/FormDefaults.ts b/src/components/reports/FormDefaults.ts index a33221a..8f991f9 100644 --- a/src/components/reports/FormDefaults.ts +++ b/src/components/reports/FormDefaults.ts @@ -72,6 +72,7 @@ export const initialValues: FormValues = { "Screening of 82 genes associated with severe delay and seizures " + "... Variants are classified using the ACMG/AMP guidelines (Richards et al 2015 Genet Med) " + "/ACGS Best Practice guidelines (2019).", + reportFinding: "LA6576-8", // Positive clinicalConclusion: "Confirms the diagnosis of Childhood-nset epileptic encephalopathy (EEOC).", }, }; @@ -120,5 +121,6 @@ export const noValues: FormValues = { reportingDate: "", reportingScientist: "", reportingScientistTitle: "", + reportFinding: "", }, }; diff --git a/src/components/reports/ReportForm.test.tsx b/src/components/reports/ReportForm.test.tsx index 96104bd..dbae86a 100644 --- a/src/components/reports/ReportForm.test.tsx +++ b/src/components/reports/ReportForm.test.tsx @@ -130,7 +130,10 @@ async function setNoVariant() { } const setReportFields = async () => { - const dropDowns = [{ field: /Follow up/i, value: "Genetic counseling recommended (LA14020-4)" }]; + const dropDowns = [ + { field: /Follow up/i, value: "Genetic counseling recommended (LA14020-4)" }, + { field: /Report finding/i, value: "Positive (LA6576-8)" }, + ]; await setDummyAndNext(true, dropDowns); }; diff --git a/src/components/reports/formDataValidation.ts b/src/components/reports/formDataValidation.ts index 18c6578..d13498d 100644 --- a/src/components/reports/formDataValidation.ts +++ b/src/components/reports/formDataValidation.ts @@ -93,6 +93,7 @@ export const reportDetailSchema = Yup.object({ testMethodology: requiredString, clinicalConclusion: requiredString, citation: optionalString, + reportFinding: requiredString, }); export type ReportDetailSchema = Yup.InferType; diff --git a/src/components/reports/formSteps/Report.tsx b/src/components/reports/formSteps/Report.tsx index 4cf4357..4e14140 100644 --- a/src/components/reports/formSteps/Report.tsx +++ b/src/components/reports/formSteps/Report.tsx @@ -9,6 +9,7 @@ const Report: FC = () => {

Report

+
diff --git a/src/fhir/resources.ts b/src/fhir/resources.ts index d0c88a3..7dd8749 100644 --- a/src/fhir/resources.ts +++ b/src/fhir/resources.ts @@ -239,7 +239,11 @@ export const interpretationAndIdentifier = ( ], }, ]; - obs.valueString = result.resultSummary; + obs.note = [{ authorString: "genomic interpretation", text: result.resultSummary }]; + obs.valueCodeableConcept = { + coding: [codedValue(loincSelect.reportFinding, result.reportFinding)], + text: "report finding", + }; const identifier = createIdentifier(`${specimenBarcode}$overall-interpretation`, { id: "{specimenBarcode}$overall-interpretation", }); From de025eaf6746425816888cb060e80c8173605016 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Fri, 28 Oct 2022 14:52:31 +0100 Subject: [PATCH 07/24] Add authoriser to service request --- src/fhir/api.ts | 1 + src/fhir/resources.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/fhir/api.ts b/src/fhir/api.ts index 4c44d4f..a23934b 100644 --- a/src/fhir/api.ts +++ b/src/fhir/api.ts @@ -77,6 +77,7 @@ export const createBundle = (form: FormValues, reportedGenes: RequiredCoding[]): patient.identifier, plan.identifier, reporter.identifier, + authoriser.identifier, specimen.identifier, ); const report = reportAndId( diff --git a/src/fhir/resources.ts b/src/fhir/resources.ts index 7dd8749..f69a43e 100644 --- a/src/fhir/resources.ts +++ b/src/fhir/resources.ts @@ -434,14 +434,16 @@ export const furtherTestingAndId = (report: ReportDetailSchema, patientIdentifie * @param sample form data for sample * @param patientIdentifier to link the resource * @param planIdentifier identifier search string for PlanDefinition - * @param practitionerIdentifier to link the resource for the reporting scientist + * @param reporterIdentifier to link the resource for the reporting scientist + * @param authoriserIdentifier to link the resource for the reporting scientist * @param specimenIdentifier to link the resource */ export const serviceRequestAndId = ( sample: SampleSchema, patientIdentifier: string, planIdentifier: string, - practitionerIdentifier: string, + reporterIdentifier: string, + authoriserIdentifier: string, specimenIdentifier: string, ): ResourceAndId => { const request = new ServiceRequest(); @@ -464,6 +466,8 @@ export const serviceRequestAndId = ( }, ]; request.subject = reference("Patient", patientIdentifier); + request.specimen = [reference("Specimen", specimenIdentifier)]; + request.performer = [reference("Practitioner", reporterIdentifier), reference("Practitioner", authoriserIdentifier)]; request.performerType = { coding: [ { @@ -473,7 +477,6 @@ export const serviceRequestAndId = ( }, ], }; - request.performer = [reference("Practitioner", practitionerIdentifier)]; request.reasonCode = [ { coding: [codedValue(diseases, sample.reasonForTest)], @@ -481,8 +484,6 @@ export const serviceRequestAndId = ( }, ]; - request.specimen = [reference("Specimen", specimenIdentifier)]; - return { id: request.id, resource: request }; }; From 658858c330e5f813de050953c7f844302ea96cb3 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Fri, 28 Oct 2022 14:56:33 +0100 Subject: [PATCH 08/24] Remove prefix --- src/fhir/resources.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/fhir/resources.ts b/src/fhir/resources.ts index f69a43e..eb97116 100644 --- a/src/fhir/resources.ts +++ b/src/fhir/resources.ts @@ -393,7 +393,6 @@ export const planDefinitionAndId = ( } plan.action = [ { - prefix: "1", description: report.testMethodology, title: "Test Method", }, From 28284868ac3b174e873f3a2e347883de68ddc35a Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Fri, 28 Oct 2022 15:01:14 +0100 Subject: [PATCH 09/24] Add genes tested to form --- src/components/reports/FormDefaults.ts | 2 ++ src/components/reports/formDataValidation.ts | 1 + src/components/reports/formSteps/Report.tsx | 1 + src/fhir/resources.ts | 4 ++++ 4 files changed, 8 insertions(+) diff --git a/src/components/reports/FormDefaults.ts b/src/components/reports/FormDefaults.ts index 8f991f9..b3fac1f 100644 --- a/src/components/reports/FormDefaults.ts +++ b/src/components/reports/FormDefaults.ts @@ -72,6 +72,7 @@ export const initialValues: FormValues = { "Screening of 82 genes associated with severe delay and seizures " + "... Variants are classified using the ACMG/AMP guidelines (Richards et al 2015 Genet Med) " + "/ACGS Best Practice guidelines (2019).", + genesTested: "ADSL, ALG13, ARHGEF9, ARX, ATP1A3, ATRX, BRAT1", reportFinding: "LA6576-8", // Positive clinicalConclusion: "Confirms the diagnosis of Childhood-nset epileptic encephalopathy (EEOC).", }, @@ -115,6 +116,7 @@ export const noValues: FormValues = { followUp: "", furtherTesting: "", testMethodology: "", + genesTested: "", authorisingDate: "", authorisingScientist: "", authorisingScientistTitle: "", diff --git a/src/components/reports/formDataValidation.ts b/src/components/reports/formDataValidation.ts index d13498d..7566189 100644 --- a/src/components/reports/formDataValidation.ts +++ b/src/components/reports/formDataValidation.ts @@ -91,6 +91,7 @@ export const reportDetailSchema = Yup.object({ followUp: optionalString, furtherTesting: requiredString, testMethodology: requiredString, + genesTested: requiredString, clinicalConclusion: requiredString, citation: optionalString, reportFinding: requiredString, diff --git a/src/components/reports/formSteps/Report.tsx b/src/components/reports/formSteps/Report.tsx index 4e14140..d52babe 100644 --- a/src/components/reports/formSteps/Report.tsx +++ b/src/components/reports/formSteps/Report.tsx @@ -14,6 +14,7 @@ const Report: FC = () => {
+
diff --git a/src/fhir/resources.ts b/src/fhir/resources.ts index eb97116..43960f1 100644 --- a/src/fhir/resources.ts +++ b/src/fhir/resources.ts @@ -396,6 +396,10 @@ export const planDefinitionAndId = ( description: report.testMethodology, title: "Test Method", }, + { + textEquivalent: report.genesTested, + title: "gene list", + }, ]; if (report.citation !== undefined) { plan.relatedArtifact = [ From d9c415634060dd83111b6b6c3eeb304098d3df08 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Fri, 28 Oct 2022 15:09:23 +0100 Subject: [PATCH 10/24] Ensure transcript is in cDNA change --- src/components/reports/FormDefaults.ts | 2 +- src/components/reports/formDataValidation.ts | 2 +- src/components/reports/formSteps/Variant.tsx | 4 +-- src/fhir/resources.ts | 29 ++++++++++++-------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/components/reports/FormDefaults.ts b/src/components/reports/FormDefaults.ts index b3fac1f..12536c1 100644 --- a/src/components/reports/FormDefaults.ts +++ b/src/components/reports/FormDefaults.ts @@ -38,7 +38,7 @@ export const initialValues: FormValues = { "Clinical features range from severe motor and cognitive impairment with marked choreoathetosis, " + "self-injurious behaviour and epileptic encephalopathy, to a milder course with moderate developmental delay, " + "complex stereotypies (facial dyskinesia) and mild epilepsy.", - genomicHGVS: "c.119G>T", + cDnaHgvs: "c.119G>T", inheritanceMethod: "LA24640-7", // Autosomal dominant classification: "LA26332-9", // Likely Pathogenic proteinHGVS: "p.(Gly40Val)", diff --git a/src/components/reports/formDataValidation.ts b/src/components/reports/formDataValidation.ts index 7566189..d92177e 100644 --- a/src/components/reports/formDataValidation.ts +++ b/src/components/reports/formDataValidation.ts @@ -66,7 +66,7 @@ const variantSchema = Yup.object({ gene: requiredString, geneInformation: optionalString, transcript: requiredString, - genomicHGVS: requiredString, + cDnaHgvs: requiredString, proteinHGVS: requiredString, zygosity: requiredString, classification: requiredString, diff --git a/src/components/reports/formSteps/Variant.tsx b/src/components/reports/formSteps/Variant.tsx index 5c1bee0..a341c0a 100644 --- a/src/components/reports/formSteps/Variant.tsx +++ b/src/components/reports/formSteps/Variant.tsx @@ -104,8 +104,8 @@ const Variant: FC = (props) => { />
-
-
+
+
Date: Fri, 28 Oct 2022 16:34:59 +0100 Subject: [PATCH 11/24] Require mrn or NHS number and use specific systems Allows for querying for an identifier by a specific system which is fun --- example_data/sample_bundle.json | 4 +- src/components/reports/FormDefaults.ts | 8 +-- src/components/reports/ReportForm.tsx | 3 +- .../reports/formDataValidation.test.tsx | 19 ++++++- src/components/reports/formDataValidation.ts | 7 +-- src/components/reports/formSteps/Patient.tsx | 3 +- src/fhir/resources.ts | 51 +++++++++++-------- 7 files changed, 61 insertions(+), 34 deletions(-) diff --git a/example_data/sample_bundle.json b/example_data/sample_bundle.json index 5e0979d..5487cda 100644 --- a/example_data/sample_bundle.json +++ b/example_data/sample_bundle.json @@ -74,7 +74,7 @@ }, { "system": "http://fhir.nhs.uk/Id/nhs-number", - "value": "8105688202.0" + "value": "8105688202" }, { "system": "http://fhir.nhs.uk/Id/nhs-family-number", @@ -88,7 +88,7 @@ }, "request": { "method": "PUT", - "url": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914" + "url": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914,http://fhir.nhs.uk/Id/nhs-number|8105688202" } }, { diff --git a/src/components/reports/FormDefaults.ts b/src/components/reports/FormDefaults.ts index 12536c1..afbf2e4 100644 --- a/src/components/reports/FormDefaults.ts +++ b/src/components/reports/FormDefaults.ts @@ -11,12 +11,13 @@ export const initialValues: FormValues = { postCode: "WC1N 3BH", }, patient: { - mrn: "969977", + mrn: "40388914", + nhsNumber: "8105688202", + familyNumber: "Z968769", firstName: "Donald", lastName: "Duck", dateOfBirth: "2012-03-04", gender: Patient.GenderEnum.Male, - familyNumber: "Z409929", }, sample: { specimenCode: "19RG-183G0127", @@ -93,11 +94,12 @@ export const noValues: FormValues = { }, patient: { mrn: "", + nhsNumber: "", + familyNumber: "", firstName: "", lastName: "", dateOfBirth: "", gender: undefined, - familyNumber: "", }, sample: { specimenCode: "", diff --git a/src/components/reports/ReportForm.tsx b/src/components/reports/ReportForm.tsx index 07fbc3e..837a06c 100644 --- a/src/components/reports/ReportForm.tsx +++ b/src/components/reports/ReportForm.tsx @@ -14,8 +14,7 @@ import Report from "./formSteps/Report"; import Confirmation from "./formSteps/Confirmation"; import FormStepBtn from "../UI/FormStepBtn"; import { RequiredCoding } from "../../code_systems/types"; -import ModalWrapper from "../UI/ModalWrapper"; -import { ModalState } from "../UI/ModalWrapper"; +import ModalWrapper, { ModalState } from "../UI/ModalWrapper"; const PatientAndAddressValidation = Yup.object({ address: addressSchema.required(), diff --git a/src/components/reports/formDataValidation.test.tsx b/src/components/reports/formDataValidation.test.tsx index 8947885..796603f 100644 --- a/src/components/reports/formDataValidation.test.tsx +++ b/src/components/reports/formDataValidation.test.tsx @@ -1,6 +1,7 @@ -import { optionalDateTime, requiredDate, requiredDateTime } from "./formDataValidation"; +import { optionalDateTime, patientSchema, requiredDate, requiredDateTime } from "./formDataValidation"; import * as Yup from "yup"; import { ValidationError } from "yup"; +import { Patient } from "@smile-cdr/fhirts/dist/FHIR-R4/interfaces/IPatient"; const requiredSchema = Yup.object({ requiredDate: requiredDate, @@ -52,4 +53,20 @@ describe("Custom form validation", () => { const validation = await optionalSchema.validate(model); expect(validation).toBeTruthy(); }); + + test("mrn and NHS number can't both be empty", async () => { + async function validateModel() { + const model = { + firstName: "requiredString", + lastName: "requiredString", + dateOfBirth: validDate, + mrn: "", + nhsNumber: "", + familyNumber: "optionalString", + gender: Patient.GenderEnum.Female, + }; + await patientSchema.validate(model); + } + await expect(validateModel).rejects.toThrow(ValidationError); + }); }); diff --git a/src/components/reports/formDataValidation.ts b/src/components/reports/formDataValidation.ts index d92177e..f9ca9b7 100644 --- a/src/components/reports/formDataValidation.ts +++ b/src/components/reports/formDataValidation.ts @@ -28,15 +28,16 @@ export const optionalDateTime = dateTime.optional(); const boolField = Yup.boolean().default(false).nullable(false); export const patientSchema = Yup.object({ - mrn: requiredString, firstName: requiredString, lastName: requiredString, dateOfBirth: requiredDate, + mrn: optionalString, + nhsNumber: optionalString, + familyNumber: optionalString, gender: Yup.mixed() .oneOf(Object.values(Patient.GenderEnum)) .test("required", "Please select an option", (value) => value !== undefined), - familyNumber: requiredString, -}); +}).test("at-least-one-identifier", "an NHS number or a MRN is required", (form) => !!(form.mrn || form.nhsNumber)); export type PatientSchema = Yup.InferType; diff --git a/src/components/reports/formSteps/Patient.tsx b/src/components/reports/formSteps/Patient.tsx index 9e0b980..b8d07b6 100644 --- a/src/components/reports/formSteps/Patient.tsx +++ b/src/components/reports/formSteps/Patient.tsx @@ -46,11 +46,12 @@ const Patient: FC = (props) => {

Patient information

+
+
-
); }; diff --git a/src/fhir/resources.ts b/src/fhir/resources.ts index bc70752..3a9574d 100644 --- a/src/fhir/resources.ts +++ b/src/fhir/resources.ts @@ -9,6 +9,7 @@ import { v4 as uuidv4 } from "uuid"; import { DiagnosticReport, HumanName, + Identifier, Organization, Patient, PlanDefinition, @@ -53,37 +54,43 @@ type ResourceAndId = { * @param organisationIdentifier used to link resource */ export const patientAndIdentifier = (form: PatientSchema, organisationIdentifier: string): ResourceAndIdentifier => { + if (!(form.mrn || form.nhsNumber)) { + throw new Error("an NHS number or MRN must be specified"); + } + const patient = new Patient(); patient.active = true; patient.gender = form.gender; patient.name = [{ family: form.lastName, given: [form.firstName] }]; - const identifier = createIdentifier(form.mrn, makeGoshAssigner("MRN")); + const identifiers: Identifier[] = []; - patient.identifier = [ - identifier, - // implementing GOSH's structure, they chose this to represent a family as it doesn't exist in the specification - { - extension: [ - { - url: "https://fhir.nhs.uk/R4/StructureDefinition/Extension-UKCore-NHSNumberVerificationStatus", - valueCodeableConcept: { - coding: [ - { - system: "https://fhir.nhs.uk/R4/CodeSystem/UKCore-NHSNumberVerificationStatus", - code: form.familyNumber, - display: "Family Number", - }, - ], - }, - }, - ], - }, - ]; + if (form.mrn) { + identifiers.push( + createIdentifier(form.mrn, { + system: "http://fhir.nhs.uk/Id/mrn", + ...makeGoshAssigner("MRN"), + }), + ); + } + if (form.nhsNumber) { + identifiers.push(createIdentifier(form.nhsNumber, { system: "http://fhir.nhs.uk/Id/nhs-number" })); + } + const identifierQuery = identifiers.map((id) => `${id.system}|${id.value}`).join(","); + + if (form.familyNumber) { + identifiers.push( + createIdentifier(form.familyNumber, { + system: "http://fhir.nhs.uk/Id/nhs-family-number", + ...makeGoshAssigner("Family Number"), + }), + ); + } + patient.identifier = identifiers; patient.birthDate = form.dateOfBirth; patient.text = generatedNarrative(form.firstName, form.lastName); patient.resourceType = "Patient"; patient.managingOrganization = reference("Organization", organisationIdentifier); - return { identifier: identifier.value, resource: patient }; + return { identifier: identifierQuery, resource: patient }; }; export const organisationAndIdentifier = (form: AddressSchema): ResourceAndIdentifier => { From 4bffb415142e88cf2105cadb5ebbc1d9614da131 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Fri, 28 Oct 2022 16:45:43 +0100 Subject: [PATCH 12/24] Add issuer to practitioner --- src/fhir/api.ts | 2 +- src/fhir/resources.ts | 34 +++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/fhir/api.ts b/src/fhir/api.ts index a23934b..25a8202 100644 --- a/src/fhir/api.ts +++ b/src/fhir/api.ts @@ -38,7 +38,7 @@ export const createBundle = (form: FormValues, reportedGenes: RequiredCoding[]): const specimen = specimenAndIdentifier(form.sample, patient.identifier); const furtherTesting = furtherTestingAndId(form.result, patient.identifier); const plan = planDefinitionAndId(form.sample, form.result, patient.identifier); - const { authoriser, reporter } = practitionersAndQueries(form.result); + const { authoriser, reporter } = practitionersAndQueries(form.result, org.identifier); let variants: ResourceAndIdentifier[]; if (form.variant.length) { variants = form.variant.map((variant: VariantSchema) => diff --git a/src/fhir/resources.ts b/src/fhir/resources.ts index 3a9574d..0136c52 100644 --- a/src/fhir/resources.ts +++ b/src/fhir/resources.ts @@ -126,10 +126,20 @@ export const organisationAndIdentifier = (form: AddressSchema): ResourceAndIdent return { identifier: identifier.value, resource: org }; }; -export const practitionersAndQueries = (result: ReportDetailSchema) => { +export const practitionersAndQueries = (result: ReportDetailSchema, organisationIdentifier: string) => { return { - authoriser: practitionerAndIdentifier(result.authorisingScientist, result.authorisingScientistTitle, "auth"), - reporter: practitionerAndIdentifier(result.reportingScientist, result.reportingScientistTitle, "report"), + authoriser: practitionerAndIdentifier( + result.authorisingScientist, + result.authorisingScientistTitle, + "auth", + organisationIdentifier, + ), + reporter: practitionerAndIdentifier( + result.reportingScientist, + result.reportingScientistTitle, + "report", + organisationIdentifier, + ), }; }; @@ -142,8 +152,14 @@ type ScientistRole = "auth" | "report"; * @param fullName the first word will be the firstName, remaining words will be lastName * @param title job title within the laboratory * @param role role in the reporting process + * @param organisationIdentifier to link the organisation */ -const practitionerAndIdentifier = (fullName: string, title: string, role: ScientistRole): ResourceAndIdentifier => { +const practitionerAndIdentifier = ( + fullName: string, + title: string, + role: ScientistRole, + organisationIdentifier: string, +): ResourceAndIdentifier => { const nameSplit = fullName.split(/\s/g); const firstName = nameSplit[0]; const lastName = nameSplit.slice(1).join(" "); @@ -156,12 +172,16 @@ const practitionerAndIdentifier = (fullName: string, title: string, role: Scient const practitioner = new Practitioner(); practitioner.resourceType = "Practitioner"; practitioner.active = true; - const normalisedIdentifier = `${fullName}_${role}`.replaceAll(/\s/g, "").toLowerCase(); + const normalisedIdentifier = `${fullName}_${role}_${organisationIdentifier}`.replaceAll(/\s/g, "").toLowerCase(); const identifier = createIdentifier(normalisedIdentifier); practitioner.identifier = [identifier]; practitioner.name = [{ given: [firstName], family: lastName, use: HumanName.UseEnum.Official, text: roleText }]; - practitioner.qualification = [{ code: { text: title } }]; - // TODO: add issuer + practitioner.qualification = [ + { + code: { text: title }, + issuer: reference("Organization", organisationIdentifier), + }, + ]; return { identifier: identifier.value, resource: practitioner }; }; From 9ac3f81e453dd4e891414b5681a83310b94abe7f Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Fri, 28 Oct 2022 16:53:51 +0100 Subject: [PATCH 13/24] Remove unnecessary field --- src/fhir/resources.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fhir/resources.ts b/src/fhir/resources.ts index 0136c52..75483b7 100644 --- a/src/fhir/resources.ts +++ b/src/fhir/resources.ts @@ -200,7 +200,7 @@ export const specimenAndIdentifier = (sample: SampleSchema, patientIdentifier: s if (sample.authorisedDateTime !== undefined) { specimen.processing = [{ timeDateTime: parseDateTime(sample.authorisedDateTime).toISO() }]; } - const identifier = createIdentifier(sample.specimenCode, { id: "specimen id" }); + const identifier = createIdentifier(sample.specimenCode); specimen.identifier = [identifier]; specimen.type = { coding: [codedValue(sampleTypes, sample.specimenType)], From e29e708e878c60a654c5ecffe979a6e7d5d897b6 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Fri, 28 Oct 2022 16:54:47 +0100 Subject: [PATCH 14/24] Update bundle --- example_data/sample_bundle.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/example_data/sample_bundle.json b/example_data/sample_bundle.json index 5487cda..fb6edd3 100644 --- a/example_data/sample_bundle.json +++ b/example_data/sample_bundle.json @@ -113,13 +113,13 @@ { "system": "http://snomed.info/sct", "code": "122555007", - "display": "Venus blood specimen" + "display": "Venous blood specimen" } ] }, "subject": { "type": "Patient", - "reference": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914" + "reference": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914,http://fhir.nhs.uk/Id/nhs-number|8105688202" } }, "request": { @@ -132,7 +132,7 @@ "resourceType": "Practitioner", "identifier": [ { - "value": "freya_fredrick_auth" + "value": "freya_fredrick_auth_gosh" } ], "active": true, @@ -154,14 +154,14 @@ }, { "issuer": { - "reference": "Organization/gosh" + "reference": "Organization?identifier=gosh" } } ] }, "request": { "method": "PUT", - "url": "Practitioner?identifier=freya_fredrick_auth" + "url": "Practitioner?identifier=freya_fredrick_auth_gosh" } }, { @@ -169,7 +169,7 @@ "resourceType": "Practitioner", "identifier": [ { - "value": "ana_anooli_seo_report" + "value": "ana_anooli_seo_report_gosh" } ], "active": true, @@ -191,14 +191,14 @@ }, { "issuer": { - "reference": "Organization/gosh" + "reference": "Organization?identifier=gosh" } } ] }, "request": { "method": "PUT", - "url": "Practitioner?identifier=ana_anooli_seo_report" + "url": "Practitioner?identifier=ana_anooli_seo_report_gosh" } }, { From 79df636d9515fcc85a9c866e24078dc323831cf7 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Mon, 7 Nov 2022 11:50:16 +0000 Subject: [PATCH 15/24] Update bundle to use practitioner reference --- example_data/sample_bundle.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/example_data/sample_bundle.json b/example_data/sample_bundle.json index fb6edd3..4239cc0 100644 --- a/example_data/sample_bundle.json +++ b/example_data/sample_bundle.json @@ -235,11 +235,11 @@ "performer": [ { "type": "Practitioner", - "reference": "Practitioner?identifier=freya_fredrick_auth" + "reference": "Practitioner?identifier=freya_fredrick_auth_gosh" }, { "type": "Practitioner", - "reference": "Practitioner?identifier=ana_anooli_seo_report" + "reference": "Practitioner?identifier=ana_anooli_seo_report_gosh" } ], "note": [ @@ -478,7 +478,7 @@ }, "subject": { "type": "Patient", - "reference": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914" + "reference": "Patient?identifier=http://fhir.nhs.uk/Id/mrn|40388914,http://fhir.nhs.uk/Id/nhs-number|8105688202" }, "specimen": { "type": "Specimen", @@ -487,11 +487,11 @@ "performer": [ { "type": "Practitioner", - "reference": "Practitioner?identifier=freya_fredrick_auth" + "reference": "Practitioner?identifier=freya_fredrick_auth_gosh" }, { "type": "Practitioner", - "reference": "Practitioner?identifier=ana_anooli_seo_report" + "reference": "Practitioner?identifier=ana_anooli_seo_report_gosh" } ], "category": [ @@ -508,15 +508,15 @@ "note": [ { "authorString": "genomic interpretation", - "text": "Next generation sequence analysis indicates that Maria321 BrighGosh321 is heterozygous for the SMC1A c.1263del p.(Lys422Serfs*28) pathogenic variant that has been confirmed by Sanger sequence analysis (see technical information below)." + "text": "Next generation sequence analysis indicates that Duck Donald is heterozygous for the GNAO1 c.119G>T p.(Gly40Val) likely pathogenic variant that has been confirmed by Sanger sequence analysis (see technical information below)." } ], "valueCodeableConcept": { "coding": [ { - "system": "http://loinc.org", - "code": "LA6577-6", - "display": "Negative" + "code": "LA6576-8", + "display": "Positive", + "system": "http://loinc.org" } ], "text": "report finding" @@ -524,7 +524,7 @@ }, "request": { "method": "PUT", - "url": "Observation?identifier=20RG-205G0047_R59$overall-interpretation" + "url": "Observation?identifier=19RG-183G0127$overall-interpretation" } }, { @@ -597,11 +597,11 @@ "performer": [ { "type": "Practitioner", - "reference": "Practitioner?identifier=freya_fredrick_auth" + "reference": "Practitioner?identifier=freya_fredrick_auth_gosh" }, { "type": "Practitioner", - "reference": "Practitioner?identifier=ana_anooli_seo_report" + "reference": "Practitioner?identifier=ana_anooli_seo_report_gosh" } ], "category": [ @@ -671,11 +671,11 @@ "resultsInterpreter": [ { "type": "Practitioner", - "reference": "Practitioner?identifier=freya_fredrick_auth" + "reference": "Practitioner?identifier=freya_fredrick_auth_gosh" }, { "type": "Practitioner", - "reference": "Practitioner?identifier=ana_anooli_seo_report" + "reference": "Practitioner?identifier=ana_anooli_seo_report_gosh" } ], "specimen": [ From b73b12580caaf06dbe0cb39550b6e7c7d0a4886a Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Mon, 7 Nov 2022 13:38:59 +0000 Subject: [PATCH 16/24] Use common global identifier of sample and reason for test --- src/fhir/api.ts | 33 ++++++++++--------- src/fhir/resources.ts | 73 +++++++++++++++++++++++++------------------ 2 files changed, 58 insertions(+), 48 deletions(-) diff --git a/src/fhir/api.ts b/src/fhir/api.ts index 25a8202..7612064 100644 --- a/src/fhir/api.ts +++ b/src/fhir/api.ts @@ -14,7 +14,7 @@ import { specimenAndIdentifier, variantAndIdentifier, } from "./resources"; -import { VariantSchema } from "../components/reports/formDataValidation"; +import { SampleSchema, VariantSchema } from "../components/reports/formDataValidation"; import { loincResources } from "../code_systems/loincCodes"; import { RequiredCoding } from "../code_systems/types"; @@ -32,12 +32,19 @@ export const bundleRequest = (form: FormValues, reportedGenes: RequiredCoding[]) }; }; +/** + * Generates a unique report identifier that is unique for a sample and a reason for testing. + * @param sample data from the sample form + */ +const getUniqueReportIdentifier = (sample: SampleSchema) => `${sample.specimenCode}_${sample.reasonForTest}`; + export const createBundle = (form: FormValues, reportedGenes: RequiredCoding[]): Bundle => { + const reportIdentifier = getUniqueReportIdentifier(form.sample); const org = organisationAndIdentifier(form.address); const patient = patientAndIdentifier(form.patient, org.identifier); - const specimen = specimenAndIdentifier(form.sample, patient.identifier); - const furtherTesting = furtherTestingAndId(form.result, patient.identifier); - const plan = planDefinitionAndId(form.sample, form.result, patient.identifier); + const specimen = specimenAndIdentifier(form.sample, patient.identifier, reportIdentifier); + const furtherTesting = furtherTestingAndId(form.result, patient.identifier, reportIdentifier); + const plan = planDefinitionAndId(form.sample, form.result, patient.identifier, reportIdentifier); const { authoriser, reporter } = practitionersAndQueries(form.result, org.identifier); let variants: ResourceAndIdentifier[]; if (form.variant.length) { @@ -46,31 +53,23 @@ export const createBundle = (form: FormValues, reportedGenes: RequiredCoding[]): variant, reportedGenes, patient.identifier, - specimen.identifier, - specimen.identifier, reporter.identifier, authoriser.identifier, + reportIdentifier, ), ); } else { variants = [ - createNullVariantAndIdentifier( - patient.identifier, - specimen.identifier, - specimen.identifier, - reporter.identifier, - authoriser.identifier, - ), + createNullVariantAndIdentifier(patient.identifier, reporter.identifier, authoriser.identifier, reportIdentifier), ]; } const overallInterpretation = interpretationAndIdentifier( form.result, patient.identifier, - specimen.identifier, - specimen.identifier, reporter.identifier, authoriser.identifier, + reportIdentifier, ); const serviceRequest = serviceRequestAndId( form.sample, @@ -78,7 +77,7 @@ export const createBundle = (form: FormValues, reportedGenes: RequiredCoding[]): plan.identifier, reporter.identifier, authoriser.identifier, - specimen.identifier, + reportIdentifier, ); const report = reportAndId( form.result, @@ -87,8 +86,8 @@ export const createBundle = (form: FormValues, reportedGenes: RequiredCoding[]): reporter.identifier, authoriser.identifier, org.identifier, - specimen.identifier, variants.map((variant) => variant.identifier), + reportIdentifier, ); return { resourceType: "Bundle", diff --git a/src/fhir/resources.ts b/src/fhir/resources.ts index 75483b7..6d27a3c 100644 --- a/src/fhir/resources.ts +++ b/src/fhir/resources.ts @@ -43,11 +43,6 @@ export type ResourceAndIdentifier = { identifier: string; }; -type ResourceAndId = { - resource: Resource; - id: string; -}; - /** * Create a FHIR patient object from form data * @param form patient data @@ -189,8 +184,13 @@ const practitionerAndIdentifier = ( * Create specimen resource from form data and link it to the patient. * @param sample form data * @param patientIdentifier used to link resource + * @param reportIdentifier to link the specimen resource and for unique reference to the created resource */ -export const specimenAndIdentifier = (sample: SampleSchema, patientIdentifier: string): ResourceAndIdentifier => { +export const specimenAndIdentifier = ( + sample: SampleSchema, + patientIdentifier: string, + reportIdentifier: string, +): ResourceAndIdentifier => { const specimen = new Specimen(); specimen.resourceType = "Specimen"; specimen.receivedTime = parseDateTime(sample.receivedDateTime).toJSDate(); @@ -200,7 +200,7 @@ export const specimenAndIdentifier = (sample: SampleSchema, patientIdentifier: s if (sample.authorisedDateTime !== undefined) { specimen.processing = [{ timeDateTime: parseDateTime(sample.authorisedDateTime).toISO() }]; } - const identifier = createIdentifier(sample.specimenCode); + const identifier = createIdentifier(reportIdentifier); specimen.identifier = [identifier]; specimen.type = { coding: [codedValue(sampleTypes, sample.specimenType)], @@ -212,14 +212,13 @@ export const specimenAndIdentifier = (sample: SampleSchema, patientIdentifier: s export const createNullVariantAndIdentifier = ( patientIdentifier: string, - specimenIdentifier: string, - specimenBarcode: string, reporterIdentifier: string, authoriserIdentifier: string, + reportIdentifier: string, ): ResourceAndIdentifier => { const obs = createPatientObservation( patientIdentifier, - specimenIdentifier, + reportIdentifier, reporterIdentifier, authoriserIdentifier, "69548-6", @@ -231,7 +230,9 @@ export const createNullVariantAndIdentifier = ( text: "No variants reported", }, ]; - const identifier = createIdentifier(`${specimenBarcode}$null:null`, { id: "specimenBarcode$transcript:genomicHGVS" }); + const identifier = createIdentifier(`${reportIdentifier}$null:null`, { + id: "specimenBarcode$transcript:genomicHGVS", + }); obs.identifier = [identifier]; return { identifier: identifier.value, resource: obs }; @@ -240,14 +241,13 @@ export const createNullVariantAndIdentifier = ( export const interpretationAndIdentifier = ( result: ReportDetailSchema, patientIdentifier: string, - specimenIdentifier: string, - specimenBarcode: string, reporterIdentifier: string, authoriserIdentifier: string, + reportIdentifier: string, ): ResourceAndIdentifier => { const obs = createPatientObservation( patientIdentifier, - specimenIdentifier, + reportIdentifier, reporterIdentifier, authoriserIdentifier, "51968-6", @@ -271,7 +271,7 @@ export const interpretationAndIdentifier = ( coding: [codedValue(loincSelect.reportFinding, result.reportFinding)], text: "report finding", }; - const identifier = createIdentifier(`${specimenBarcode}$overall-interpretation`, { + const identifier = createIdentifier(`${reportIdentifier}$overall-interpretation`, { id: "{specimenBarcode}$overall-interpretation", }); obs.identifier = [identifier]; @@ -283,14 +283,13 @@ export const variantAndIdentifier = ( variant: VariantSchema, reportedGenes: RequiredCoding[], patientIdentifier: string, - specimenIdentifier: string, - specimenBarcode: string, reporterIdentifier: string, authoriserIdentifier: string, + reportIdentifier: string, ): ResourceAndIdentifier => { const obs = createPatientObservation( patientIdentifier, - specimenIdentifier, + reportIdentifier, reporterIdentifier, authoriserIdentifier, "69548-6", @@ -406,7 +405,7 @@ export const variantAndIdentifier = ( }); } - const identifier = createIdentifier(`${specimenBarcode}$${cDnaHgvs}`); + const identifier = createIdentifier(`${reportIdentifier}$${cDnaHgvs}`); obs.identifier = [identifier]; return { identifier: identifier.value, resource: obs }; @@ -416,6 +415,7 @@ export const planDefinitionAndId = ( sample: SampleSchema, report: ReportDetailSchema, patientIdentifier: string, + reportIdentifier: string, ): ResourceAndIdentifier => { const plan = new PlanDefinition(); plan.resourceType = "PlanDefinition"; @@ -442,13 +442,17 @@ export const planDefinitionAndId = ( ]; } plan.subjectReference = reference("Patient", patientIdentifier); - const identifier = createIdentifier(`${patientIdentifier}`); + const identifier = createIdentifier(reportIdentifier); plan.identifier = [identifier]; return { identifier: identifier.value, resource: plan }; }; -export const furtherTestingAndId = (report: ReportDetailSchema, patientIdentifier: string): ResourceAndId => { +export const furtherTestingAndId = ( + report: ReportDetailSchema, + patientIdentifier: string, + reportIdentifier: string, +): ResourceAndIdentifier => { const task = new Task(); task.id = uuidv4(); task.resourceType = "Task"; @@ -461,7 +465,9 @@ export const furtherTestingAndId = (report: ReportDetailSchema, patientIdentifie } task.description = report.furtherTesting; task.for = reference("Patient", patientIdentifier); - return { id: task.id, resource: task }; + const identifier = createIdentifier(reportIdentifier); + task.identifier = [identifier]; + return { identifier: identifier.value, resource: task }; }; /** @@ -471,7 +477,7 @@ export const furtherTestingAndId = (report: ReportDetailSchema, patientIdentifie * @param planIdentifier identifier search string for PlanDefinition * @param reporterIdentifier to link the resource for the reporting scientist * @param authoriserIdentifier to link the resource for the reporting scientist - * @param specimenIdentifier to link the resource + * @param reportIdentifier to link the specimen resource and for unique reference to the created resource */ export const serviceRequestAndId = ( sample: SampleSchema, @@ -479,8 +485,8 @@ export const serviceRequestAndId = ( planIdentifier: string, reporterIdentifier: string, authoriserIdentifier: string, - specimenIdentifier: string, -): ResourceAndId => { + reportIdentifier: string, +): ResourceAndIdentifier => { const request = new ServiceRequest(); request.resourceType = "ServiceRequest"; request.id = uuidv4(); @@ -501,7 +507,7 @@ export const serviceRequestAndId = ( }, ]; request.subject = reference("Patient", patientIdentifier); - request.specimen = [reference("Specimen", specimenIdentifier)]; + request.specimen = [reference("Specimen", reportIdentifier)]; request.performer = [reference("Practitioner", reporterIdentifier), reference("Practitioner", authoriserIdentifier)]; request.performerType = { coding: [ @@ -519,7 +525,10 @@ export const serviceRequestAndId = ( }, ]; - return { id: request.id, resource: request }; + const identifier = createIdentifier(reportIdentifier); + request.identifier = [identifier]; + + return { identifier: identifier.value, resource: request }; }; export const reportAndId = ( @@ -529,9 +538,9 @@ export const reportAndId = ( reporterIdentifier: string, authoriserIdentifier: string, organisationIdentifier: string, - specimenIdentifier: string, resultIds: string[], -): ResourceAndId => { + reportIdentifier: string, +): ResourceAndIdentifier => { const report = new DiagnosticReport(); report.id = uuidv4(); report.issued = result.reportingDate; @@ -539,7 +548,7 @@ export const reportAndId = ( report.resourceType = "DiagnosticReport"; report.status = DiagnosticReport.StatusEnum.Final; report.subject = reference("Patient", patientIdentifier); - report.specimen = [reference("Specimen", specimenIdentifier)]; + report.specimen = [reference("Specimen", reportIdentifier)]; report.performer = [reference("Organization", organisationIdentifier)]; report.result = resultIds.map((resultId) => reference("Observation", resultId)); report.resultsInterpreter = [ @@ -550,6 +559,8 @@ export const reportAndId = ( coding: [codedValue(diseases, sample.reasonForTest)], }; report.conclusion = result.clinicalConclusion; + const identifier = createIdentifier(reportIdentifier); + report.identifier = [identifier]; - return { id: report.id, resource: report }; + return { identifier: identifier.value, resource: report }; }; From 051d6dfcd31a8480fd60e32c618e5b3d9a6705e4 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Wed, 9 Nov 2022 11:04:08 +0000 Subject: [PATCH 17/24] Use panelApp codes for diseases --- package.json | 2 +- src/code_systems/panelappCodes.ts | 114 ++++++++++++++++++++ src/code_systems/snomedCodes.ts | 59 ---------- src/components/reports/FormDefaults.ts | 2 +- src/components/reports/ReportForm.test.tsx | 2 +- src/components/reports/formSteps/Sample.tsx | 3 +- src/fhir/resources.ts | 3 +- 7 files changed, 121 insertions(+), 64 deletions(-) create mode 100644 src/code_systems/panelappCodes.ts diff --git a/package.json b/package.json index 9091016..308a11f 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "build": "react-scripts build", "predeploy": "react-scripts build && cp build/index.html build/404.html", "deploy": "COMMIT_MSG=$(git log -1 --pretty=%B | sed 's/ /_/g'); gh-pages -d build --message ${COMMIT_MSG}", - "test": "react-scripts test", + "test": "react-scripts test --runInBand", "eject": "react-scripts eject", "lint": "eslint . --ext .js,.jsx,.ts,.tsx" }, diff --git a/src/code_systems/panelappCodes.ts b/src/code_systems/panelappCodes.ts new file mode 100644 index 0000000..ab71d15 --- /dev/null +++ b/src/code_systems/panelappCodes.ts @@ -0,0 +1,114 @@ +import { RequiredCoding } from "./types"; + +export const diseases: RequiredCoding[] = [ + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R14", + display: "Acutely unwell children with a likely monogenic disorder", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R127", + display: "Long QT syndrome", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R128", + display: "Brugada syndrome and cardiac sodium channel disease", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R129", + display: "Catecholaminergic polymorphic VT", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R130", + display: "Short QT syndrome", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R131", + display: "Hypertrophic cardiomyopathy", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R134", + display: "Familial hypercholesterolaemia", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R184", + display: "Cystic fibrosis diagnostic test", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R59", + display: "Early onset or syndromic epilepsy", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R226", + display: "Inherited parathyroid cancer", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R207", + display: "Inherited ovarian cancer (without breast cancer)", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R211", + display: "Inherited polyposis and early onset colorectal cancer - germline testing", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R215", + display: "CDH1-related cancer syndrome", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R404", + display: "Testing of unaffected individuals for inherited cancer predisposition syndromes", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R224", + display: "Inherited renal cancer", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R364", + display: "DICER1-related cancer predisposition", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R367", + display: "Inherited pancreatic cancer", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R193", + display: "Cystic renal disease", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R173", + display: "Polycystic liver disease", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R65", + display: "Aminoglycoside exposure posing risk to hearing", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R27", + display: "Congenital malformation and dysmorphism syndromes - microarray and sequencing", + }, + { + system: "http://panelapp.genomicsengland.co.uk/api/v1/entities", + code: "R29", + display: "Intellectual disability - microarray and sequencing", + }, +]; diff --git a/src/code_systems/snomedCodes.ts b/src/code_systems/snomedCodes.ts index 839b3aa..54f5613 100644 --- a/src/code_systems/snomedCodes.ts +++ b/src/code_systems/snomedCodes.ts @@ -27,62 +27,3 @@ export const sampleTypes: RequiredCoding[] = [ display: "Venous blood specimen", }, ]; - -export const diseases: RequiredCoding[] = [ - { - system: "http://snomed.info/sct", - code: "230387008", - display: "Benign occipital epilepsy of childhood - early onset variant", - }, - { - system: "http://snomed.info/sct", - code: "5262007", - display: "Spinal muscular atrophy", - }, - { - system: "http://snomed.info/sct", - code: "73297009", - display: "Muscular dystrophy", - }, - { - system: "http://snomed.info/sct", - code: "190905008", - display: "Cystic fibrosis", - }, - { - system: "http://snomed.info/sct", - code: "398036000", - display: "Familial hypercholesterolemia", - }, - // top level SNOMED CT term for cancer - { - system: "http://snomed.info/sct", - code: "363346000", - display: "Malignant neoplastic disease", - }, - { - system: "http://snomed.info/sct", - code: "432328008", - display: "Neuroblastoma", - }, - { - system: "http://snomed.info/sct", - code: "771233008", - display: "Inflammatory myofibroblastic tumor", - }, - { - system: "http://snomed.info/sct", - code: "253062001", - display: "Central nervous system tumor morphology", - }, - { - system: "http://snomed.info/sct", - code: "255032005", - display: "Medullary thyroid carcinoma", - }, - { - system: "http://snomed.info/sct", - code: "702785000", - display: "Large cell anaplastic lymphoma T cell and Null cell type", - }, -]; diff --git a/src/components/reports/FormDefaults.ts b/src/components/reports/FormDefaults.ts index afbf2e4..d85a976 100644 --- a/src/components/reports/FormDefaults.ts +++ b/src/components/reports/FormDefaults.ts @@ -25,7 +25,7 @@ export const initialValues: FormValues = { collectionDateTime: "04/06/2019 12:00", receivedDateTime: "04/06/2019 15:00", authorisedDateTime: "04/06/2019 15:30", - reasonForTest: "230387008", + reasonForTest: "R59", // epilepsy reasonForTestText: "Sequence variant screening in Donald Duck because of epilepsy and atypical absences. " + "An SLC2A1 variant is suspected.", diff --git a/src/components/reports/ReportForm.test.tsx b/src/components/reports/ReportForm.test.tsx index dbae86a..bef9b28 100644 --- a/src/components/reports/ReportForm.test.tsx +++ b/src/components/reports/ReportForm.test.tsx @@ -89,7 +89,7 @@ async function setDummyAndNext(withDates: boolean, dropDowns?: DropDown[]) { const setSample = () => { return setDummyAndNext(true, [ { field: /specimen type/i, value: "122555007" }, - { field: /test reason/i, value: "230387008" }, + { field: /test reason/i, value: "R59" }, ]); }; diff --git a/src/components/reports/formSteps/Sample.tsx b/src/components/reports/formSteps/Sample.tsx index 7d1eefb..6adb184 100644 --- a/src/components/reports/formSteps/Sample.tsx +++ b/src/components/reports/formSteps/Sample.tsx @@ -1,7 +1,8 @@ import { FC } from "react"; import FieldSet from "../FieldSet"; -import { diseases, sampleTypes } from "../../../code_systems/snomedCodes"; +import { sampleTypes } from "../../../code_systems/snomedCodes"; +import { diseases } from "../../../code_systems/panelappCodes"; const Sample: FC = () => { return ( diff --git a/src/fhir/resources.ts b/src/fhir/resources.ts index 6d27a3c..5d80923 100644 --- a/src/fhir/resources.ts +++ b/src/fhir/resources.ts @@ -30,8 +30,9 @@ import { } from "./resource_helpers"; import { parseDateTime } from "../utils/dateTime"; import { codedValue, loincSelect } from "../code_systems/loincCodes"; -import { diseases, sampleTypes } from "../code_systems/snomedCodes"; +import { sampleTypes } from "../code_systems/snomedCodes"; import { RequiredCoding } from "../code_systems/types"; +import { diseases } from "../code_systems/panelappCodes"; export const GOSH_GENETICS_IDENTIFIER = "gosh-genomics-fbf63df8-947b-4040-82bb-41fcacbe8bad"; From d889106cc6e9c79af76f1dd69b81f7901edd4b82 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Wed, 9 Nov 2022 13:29:20 +0000 Subject: [PATCH 18/24] Update variant schema for empty variant --- src/components/reports/formSteps/Variant.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/reports/formSteps/Variant.tsx b/src/components/reports/formSteps/Variant.tsx index a341c0a..70e98f6 100644 --- a/src/components/reports/formSteps/Variant.tsx +++ b/src/components/reports/formSteps/Variant.tsx @@ -8,6 +8,7 @@ import classes from "./Variant.module.css"; import { codedValue, loincSelect } from "../../../code_systems/loincCodes"; import { geneCoding, queryHgnc } from "../../../code_systems/hgnc"; import { RequiredCoding } from "../../../code_systems/types"; +import { VariantSchema } from "../formDataValidation"; interface Props { values: FormValues; @@ -15,10 +16,9 @@ interface Props { setReportFormGenes: React.Dispatch>; } -const emptyVariant = { +const emptyVariant: VariantSchema = { gene: "", geneInformation: "", - genomicHGVS: "", inheritanceMethod: "", classification: "", proteinHGVS: "", @@ -27,6 +27,7 @@ const emptyVariant = { classificationEvidence: "", confirmedVariant: false, comment: "", + cDnaHgvs: "", }; const mergeByHgncId = (hgncGenes: RequiredCoding[], selectedGenes: RequiredCoding[]) => { From cf81804bca06500e97bf467c606c7513f0a2afbf Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Wed, 9 Nov 2022 13:43:38 +0000 Subject: [PATCH 19/24] Ensure NHS number validation is carried out --- src/components/reports/formDataValidation.ts | 9 ++++++++- src/fhir/resources.ts | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/reports/formDataValidation.ts b/src/components/reports/formDataValidation.ts index f9ca9b7..6a1c738 100644 --- a/src/components/reports/formDataValidation.ts +++ b/src/components/reports/formDataValidation.ts @@ -32,7 +32,14 @@ export const patientSchema = Yup.object({ lastName: requiredString, dateOfBirth: requiredDate, mrn: optionalString, - nhsNumber: optionalString, + nhsNumber: Yup.string() + .optional() + .transform((value) => value.replace(/\s+/g, "")) + .test( + "nhs_number", + "NHS number should have 10 digits", + (value) => value === undefined || (value.length === 10 && !isNaN(+value)), + ), familyNumber: optionalString, gender: Yup.mixed() .oneOf(Object.values(Patient.GenderEnum)) diff --git a/src/fhir/resources.ts b/src/fhir/resources.ts index 5d80923..a7bf905 100644 --- a/src/fhir/resources.ts +++ b/src/fhir/resources.ts @@ -69,7 +69,9 @@ export const patientAndIdentifier = (form: PatientSchema, organisationIdentifier ); } if (form.nhsNumber) { - identifiers.push(createIdentifier(form.nhsNumber, { system: "http://fhir.nhs.uk/Id/nhs-number" })); + identifiers.push( + createIdentifier(form.nhsNumber.replace(/\s+/g, ""), { system: "http://fhir.nhs.uk/Id/nhs-number" }), + ); } const identifierQuery = identifiers.map((id) => `${id.system}|${id.value}`).join(","); From a16ab1994927af9f20ea877fecc88a785753ed04 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Wed, 9 Nov 2022 14:13:22 +0000 Subject: [PATCH 20/24] Catch error in bundle creation --- src/components/reports/ReportForm.tsx | 19 ++++++++++++++++--- src/fhir/api.ts | 3 ++- src/fhir/types.ts | 4 ++++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 src/fhir/types.ts diff --git a/src/components/reports/ReportForm.tsx b/src/components/reports/ReportForm.tsx index 837a06c..89c8640 100644 --- a/src/components/reports/ReportForm.tsx +++ b/src/components/reports/ReportForm.tsx @@ -15,6 +15,7 @@ import Confirmation from "./formSteps/Confirmation"; import FormStepBtn from "../UI/FormStepBtn"; import { RequiredCoding } from "../../code_systems/types"; import ModalWrapper, { ModalState } from "../UI/ModalWrapper"; +import { FhirRequest } from "../../fhir/types"; const PatientAndAddressValidation = Yup.object({ address: addressSchema.required(), @@ -59,9 +60,21 @@ const ReportForm: FC = (props: Props) => { const formRef = useRef>(null); const submitForm = (values: FormValues, actions: FormikHelpers) => { - const bundle = bundleRequest(values, reportedGenes); - - setResult(JSON.stringify(JSON.parse(bundle.body), null, 2)); + let bundle: FhirRequest = { body: "No data set", headers: {}, method: "POST", url: "/" }; + try { + bundle = bundleRequest(values, reportedGenes); + } catch (e) { + console.error(e); + setModal({ + message: "Something went wrong with converting the form data into a FHIR bundle", + isError: true, + }); + return; + } + if (bundle.body !== null) { + const result = JSON.stringify(JSON.parse(bundle.body as string), null, 2); + setResult(result); + } ctx.client ?.request(bundle) diff --git a/src/fhir/api.ts b/src/fhir/api.ts index 7612064..fb4a1aa 100644 --- a/src/fhir/api.ts +++ b/src/fhir/api.ts @@ -17,13 +17,14 @@ import { import { SampleSchema, VariantSchema } from "../components/reports/formDataValidation"; import { loincResources } from "../code_systems/loincCodes"; import { RequiredCoding } from "../code_systems/types"; +import { FhirRequest } from "./types"; /** * Create a report bundle * @param form values from the front end form * @param reportedGenes genes used in the report */ -export const bundleRequest = (form: FormValues, reportedGenes: RequiredCoding[]) => { +export const bundleRequest = (form: FormValues, reportedGenes: RequiredCoding[]): FhirRequest => { return { url: "/", method: "POST", diff --git a/src/fhir/types.ts b/src/fhir/types.ts new file mode 100644 index 0000000..9fe570d --- /dev/null +++ b/src/fhir/types.ts @@ -0,0 +1,4 @@ +import { fhirclient } from "fhirclient/lib/types"; +import RequestOptions = fhirclient.RequestOptions; + +export type FhirRequest = Required>; From 63cd1eb156c00d395e8079f1b7f70c85d77c2d95 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Wed, 9 Nov 2022 14:16:27 +0000 Subject: [PATCH 21/24] Update tests NHS number in correct format --- src/components/reports/ReportForm.test.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/reports/ReportForm.test.tsx b/src/components/reports/ReportForm.test.tsx index bef9b28..baf92f8 100644 --- a/src/components/reports/ReportForm.test.tsx +++ b/src/components/reports/ReportForm.test.tsx @@ -18,8 +18,15 @@ type DropDown = { const setDummyValues = (withDates: boolean, dropDowns?: DropDown[]) => { const dummyValue = "Always the same"; const form = screen.getByRole("form"); + + within(form) + .queryAllByLabelText(/nhs number/i) + .forEach((input) => { + clearAndType(input, "1234567890"); + }); + const textInputs = within(form).getAllByLabelText( - /^((?!resultOutput|date|address|gender|specimen type|search|gene symbol|follow up).)*$/i, + /^((?!nhs number|resultOutput|date|address|gender|specimen type|search|gene symbol|follow up).)*$/i, ); if (!dropDowns) { From 4b36bdec047873ce37d2ae0aeeb6629459e51fc0 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Wed, 9 Nov 2022 14:23:51 +0000 Subject: [PATCH 22/24] Check for either NHS number or parent being filled --- src/components/reports/formDataValidation.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/reports/formDataValidation.ts b/src/components/reports/formDataValidation.ts index 6a1c738..3c05cf0 100644 --- a/src/components/reports/formDataValidation.ts +++ b/src/components/reports/formDataValidation.ts @@ -31,20 +31,30 @@ export const patientSchema = Yup.object({ firstName: requiredString, lastName: requiredString, dateOfBirth: requiredDate, - mrn: optionalString, - nhsNumber: Yup.string() - .optional() + mrn: optionalString.test("validator-custom-name", (value, { createError, path, parent }) => { + if (!(value || parent.nhsNumber)) { + return createError({ path, message: "an NHS number or a MRN is required" }); + } + return true; + }), + nhsNumber: optionalString .transform((value) => value.replace(/\s+/g, "")) .test( "nhs_number", "NHS number should have 10 digits", (value) => value === undefined || (value.length === 10 && !isNaN(+value)), - ), + ) + .test("validator-custom-name", (value, { createError, path, parent }) => { + if (!(value || parent.mrn)) { + return createError({ path, message: "an NHS number or a MRN is required" }); + } + return true; + }), familyNumber: optionalString, gender: Yup.mixed() .oneOf(Object.values(Patient.GenderEnum)) .test("required", "Please select an option", (value) => value !== undefined), -}).test("at-least-one-identifier", "an NHS number or a MRN is required", (form) => !!(form.mrn || form.nhsNumber)); +}); export type PatientSchema = Yup.InferType; From d3f43058b4c2d9a0e05bcb8370ef46c83845f621 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Wed, 9 Nov 2022 14:37:46 +0000 Subject: [PATCH 23/24] Update duplicate practitioner identifier to match new format --- src/components/reports/ReportForm.test.tsx | 7 +++---- src/components/reports/ReportForm.tsx | 11 ++++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/reports/ReportForm.test.tsx b/src/components/reports/ReportForm.test.tsx index 6a89d88..0b005b4 100644 --- a/src/components/reports/ReportForm.test.tsx +++ b/src/components/reports/ReportForm.test.tsx @@ -2,9 +2,10 @@ import { render, screen, waitFor, within } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { Patient } from "@smile-cdr/fhirts/dist/FHIR-R4/classes/patient"; import { act } from "react-dom/test-utils"; -import { createPractitioner, deleteFhirData, getResources, TestReportForm } from "../../fhir/testUtilities"; +import { createPractitioner, deleteFhirData, TestReportForm } from "../../fhir/testUtilities"; import { Practitioner } from "@smile-cdr/fhirts/dist/FHIR-R4/classes/practitioner"; import { createIdentifier } from "../../fhir/resource_helpers"; +import { GOSH_GENETICS_IDENTIFIER } from "../../fhir/resources"; const clearAndType = (element: Element, value: string) => { userEvent.clear(element); @@ -156,7 +157,7 @@ describe("Report form", () => { // Arrange const practitioner = new Practitioner(); practitioner.resourceType = "Practitioner"; - const identifier = createIdentifier("always_the_same_report"); + const identifier = createIdentifier(`always_the_same_report_${GOSH_GENETICS_IDENTIFIER}`); practitioner.identifier = [identifier]; await createPractitioner(practitioner); @@ -177,8 +178,6 @@ describe("Report form", () => { await waitFor(() => { expect(screen.getByText(/error/i, { selector: "h2" })).toBeInTheDocument(); }); - // const errorModal = await screen.findByText(/error/i, { selector: "h2" }); - // expect(errorModal).toBeInTheDocument(); }); /** * Given the report form diff --git a/src/components/reports/ReportForm.tsx b/src/components/reports/ReportForm.tsx index fc7828d..3b7203d 100644 --- a/src/components/reports/ReportForm.tsx +++ b/src/components/reports/ReportForm.tsx @@ -71,12 +71,14 @@ const ReportForm: FC = (props: Props) => { }); return; } - if (bundle.body !== null) { - const result = JSON.stringify(JSON.parse(bundle.body as string), null, 2); - setResult(result); + if (bundle.body === null) { + return; } + const bodyJson = JSON.parse(bundle.body as string); - const resourceList = JSON.parse(bundle.body).entry.map((entry: any) => entry.resource.resourceType); + const result = JSON.stringify(bodyJson, null, 2); + setResult(result); + const resourceList = bodyJson.entry.map((entry: any) => entry.resource.resourceType); ctx.client ?.request(bundle) @@ -118,7 +120,6 @@ const ReportForm: FC = (props: Props) => { actions.setSubmitting(false); }; - const handleSubmit = (values: FormValues, actions: FormikHelpers) => { if (formStep === steps.length - 1) { submitForm(values, actions); From f25d9b8d5109b4725dd4d0b17a5b4abdb8ea57c0 Mon Sep 17 00:00:00 2001 From: Stef Piatek Date: Wed, 9 Nov 2022 14:43:03 +0000 Subject: [PATCH 24/24] Simplify NHS or MRN number validation --- src/components/reports/formDataValidation.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/components/reports/formDataValidation.ts b/src/components/reports/formDataValidation.ts index 3c05cf0..75b53f1 100644 --- a/src/components/reports/formDataValidation.ts +++ b/src/components/reports/formDataValidation.ts @@ -31,24 +31,18 @@ export const patientSchema = Yup.object({ firstName: requiredString, lastName: requiredString, dateOfBirth: requiredDate, - mrn: optionalString.test("validator-custom-name", (value, { createError, path, parent }) => { - if (!(value || parent.nhsNumber)) { - return createError({ path, message: "an NHS number or a MRN is required" }); - } - return true; + mrn: optionalString.test("nhs_or_mrn", "an NHS number or a MRN is required", (value, { parent }) => { + return value || parent.nhsNumber; }), nhsNumber: optionalString .transform((value) => value.replace(/\s+/g, "")) .test( - "nhs_number", + "nhs_number_format", "NHS number should have 10 digits", (value) => value === undefined || (value.length === 10 && !isNaN(+value)), ) - .test("validator-custom-name", (value, { createError, path, parent }) => { - if (!(value || parent.mrn)) { - return createError({ path, message: "an NHS number or a MRN is required" }); - } - return true; + .test("nhs_or_mrn", "an NHS number or a MRN is required", (value, { parent }) => { + return value || parent.mrn; }), familyNumber: optionalString, gender: Yup.mixed()