Ejemplo n.º 1
0
    def transform(cls, data: OrderedDict, model: Model) -> OrderedDict:

        data = super().transform(data, model)
        query_dict("metadata", data).pop("date_creation", None)
        query_dict("wellbore.metadata", data).pop("date_creation", None)
        data = cls.copy_header_to_root(data)
        data = cls.add_production_hash(data)

        return data
Ejemplo n.º 2
0
    def transform(cls, data: OrderedDict, model: Model) -> OrderedDict:
        id = query_dict("metadata.identification", data=data)
        existing = model.objects(_id=str(id)).first() or model()
        if not hasattr(existing, "hashes"):
            existing.hashes = {}

        data = super().transform(data, model)
        data = cls.copy_header_to_root(data)
        data = cls.copy_content_to_root(data)
        data = cls.copy_operator_to_root(data)
        data = cls.add_survey_hash(data)
        data = cls.add_location_hash(data)
        data = cls.create_geometries(data, existing)
        return data
Ejemplo n.º 3
0
    def production_header(self) -> Dict:
        output: Dict = OrderedDict()
        data: Dict = {}
        wellbore: Dict = {}

        if hasattr(self, "header"):
            data = self.header

        if hasattr(self, "wellbore"):
            wellbore = self.wellbore

        get = functools.partial(query_dict, data=data)

        output["api10"] = self.api10
        output["api14"] = self.api14
        output["entity"] = self.identification
        output["entity12"] = str(self.identification)[:12]
        output["status"] = self.status
        output["last_update_at"] = self.last_update_at
        output["name"] = get("designation.name")
        output["hole_direction"] = query_dict("header.designation.code",
                                              wellbore)
        output["county_name"] = get("geopolitical.county.name")
        output["county_code"] = get("geopolitical.county.code")
        output["state_name"] = get("geopolitical.province_state.name")
        output["state_code"] = get("geopolitical.province_state.code")
        output["region_name"] = get("geopolitical.region.name")
        output["operator_name"] = get("operators.current.name")
        output["operator_alias"] = get("operators.current.alternate")

        output["products"] = get("products.primary.code")
        output["production_type"] = get("type.name")
        output["product_primary"] = get("products.primary.name")

        output["perf_upper"] = get("depths.perforation_uppermost.value")
        output["perf_upper_uom"] = get("depths.perforation_uppermost.uom")
        output["perf_lower"] = get("depths.perforation_lowermost.value")
        output["perf_lower_uom"] = get("depths.perforation_lowermost.uom")
        if output["perf_upper"] and output["perf_lower"]:
            output["perfll"] = output["perf_lower"] - output["perf_upper"]
        else:
            output["perfll"] = None
        output["well_counts"] = get("wells")

        output["dates"] = self.dates
        output["statuses"] = self.statuses
        output["gatherers"] = self.gatherers

        return output
Ejemplo n.º 4
0
 def extract_last_updated_date(cls, data: OrderedDict) -> OrderedDict:
     return query_dict("header.dates.last_update.standard", data or {})
Ejemplo n.º 5
0
 def extract_identifier(cls, data: OrderedDict) -> str:
     return str(query_dict("wellbore.metadata.identification", data))
Ejemplo n.º 6
0
    def transform(self, data, **kwargs) -> Dict:
        header: Dict = {}
        engineering: Dict = {}
        if hasattr(data, "header"):
            header = data["header"]
        if hasattr(data, "engineering"):
            engineering = data["engineering"]

        get = functools.partial(query_dict, data=header)

        output = super().transform(data)
        output["county"] = get("geopolitical.county.name")
        output["county_code"] = get("geopolitical.county.code")
        output["state"] = get("geopolitical.province_state.name")
        output["state_code"] = get("geopolitical.province_state.code")
        output["products"] = get("products.objective.code")
        output["region"] = get("geopolitical.region.name")
        output["operator"] = get("operators.current.name")
        output["operator_alias"] = get("operators.current.alternate")
        output["operator_code"] = get("operators.current.code")
        output["operator_city"] = get("operators.current_city")
        output["operator_original"] = get("operators.original.name")
        output["operator_original_alias"] = get("operators.original.alternate")
        output["operator_original_code"] = get("operators.original.code")
        output["operator_original_city"] = get("operators.original_city")
        output["basin"] = get("basin.main.name")
        output["sub_basin"] = get("basin.sub_basin.name")
        output["permit_number"] = get("permit.number")
        output["permit_status"] = get("statuses.permit.name")
        output["tvd"] = get("depths.total_true_vertical.value")
        output["tvd_uom"] = get("depths.total_true_vertical.uom")
        output["md"] = get("depths.total_measured.value")
        output["md_uom"] = get("depths.total_measured.uom")
        output["plugback_depth"] = get("depths.plugback.value")
        output["plugback_depth_uom"] = get("depths.plugback.uom")
        output["area_rights_value"] = get("areas.rights.value")
        output["area_rights_uom"] = get("areas.rights.uom")

        output["product_primary"] = get("products.objective.code")

        output["perf_upper"] = query_dict(
            "completion.header.depths.top.value", data=engineering
        )
        output["perf_upper_uom"] = query_dict(
            "completion.header.depths.top.uom", data=engineering
        )

        output["perf_lower"] = query_dict(
            "completion.header.depths.base.value", data=engineering
        )
        output["perf_lower_uom"] = query_dict(
            "completion.header.depths.base.uom", data=engineering
        )

        if output["perf_upper"] and output["perf_lower"]:
            output["perfll"] = output["perf_lower"] - output["perf_upper"]
        else:
            output["perfll"] = None

        output["statuses"] = data.well_statuses or {}
        output["elevations"] = data.well_elevations or {}
        output["frac"] = data.frac or {}
        output["dates"] = data.well_dates or {}

        return output