diff --git a/.gitignore b/.gitignore index 5d43396..009f542 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,5 @@ virtualenv/ notebooks/ .ipynb_checkpoints .history/ +local_test/ +demo/ \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index e8f2035..5247d09 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,7 +21,7 @@ classifiers = [options] install_requires = deepdiff >=5.8, <6.0 - fhir.resources >=6.4, <7.0 + fhir.resources >=6.4, <7.1.0 numpy <2 pandas >=1.4 ,<1.5 pydantic >=1.9, <2.0 diff --git a/src/linuxforhealth/csvtofhir/fhirrs/meta.py b/src/linuxforhealth/csvtofhir/fhirrs/meta.py index 5d6809e..9068b2d 100644 --- a/src/linuxforhealth/csvtofhir/fhirrs/meta.py +++ b/src/linuxforhealth/csvtofhir/fhirrs/meta.py @@ -13,24 +13,7 @@ def create_meta( ) -> Meta: meta: Meta = Meta.construct() meta.extension = [] - - ext_tenant_id: Extension = Extension.construct(url=ExtensionUrl.META_TENANT_ID_EXTENSION_URL) - ext_tenant_id.valueString = general_directives.get("tenantId") - meta.extension.append(ext_tenant_id) - - ext_source_file_id: Extension = Extension.construct( - url=ExtensionUrl.META_SOURCE_FILE_ID_EXTENSION_URL - ) - ext_source_file_id.valueString = file_name - meta.extension.append(ext_source_file_id) - - ext_source_event_trigger: Extension = Extension.construct( - url=ExtensionUrl.META_SOURCE_EVENT_TRIGGER_EXTENSION_URL - ) - ext_source_event_trigger.valueCodeableConcept = CodeableConcept.construct( - text=mapped_resource_type - ) - meta.extension.append(ext_source_event_trigger) + meta.tag = [] ext_process_timestamp: Extension = Extension.construct( url=ExtensionUrl.META_PROCESS_TIMESTAMP_EXTENSION_URL @@ -38,10 +21,17 @@ def create_meta( ext_process_timestamp.valueDateTime = datetime.utcnow().replace(tzinfo=timezone.utc).isoformat() meta.extension.append(ext_process_timestamp) - ext_source_record_type: Extension = Extension.construct( - url=ExtensionUrl.META_SOURCE_RECORD_TYPE_EXTENSION_URL + # HEDIS profile URL logic based on resource type + if mapped_resource_type == "Patient": + meta.profile = [ + "https://ncqa.org/fhir/StructureDefinition/hedis-core-patient" + ] + + tag_hedis_data_source = fhir_utils.get_coding( + "https://ncqa.org/fhir/CodeSystem/hedis-data-source", + "administrative", + "Administrative" ) - ext_source_record_type.valueCodeableConcept = fhir_utils.get_codeable_concept(None, None, None, "csv") - meta.extension.append(ext_source_record_type) + meta.tag.append(tag_hedis_data_source) return meta